Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4291ee30 authored by Joe Perches's avatar Joe Perches Committed by Jiri Kosina
Browse files

HID: Add and use hid_<level>: dev_<level> equivalents



Neaten current uses of dev_<level> by adding and using
hid specific hid_<level> macros.

Convert existing uses of dev_<level> uses to hid_<level>.
Convert hid-pidff printk uses to hid_<level>.

Remove err_hid and use hid_err instead.

Add missing newlines to logging messages where necessary.
Coalesce format strings.

Add and use pr_fmt(fmt) KBUILD_MODNAME ": " fmt

Other miscellaneous changes:

Add const struct hid_device * argument to hid-core functions
extract() and implement() so hid_<level> can be used by them.
Fix bad indentation in hid-core hid_input_field function
that calls extract() function above.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 5bea7660
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -274,7 +274,7 @@ static int mmm_probe(struct hid_device *hdev, const struct hid_device_id *id)


	md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL);
	md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL);
	if (!md) {
	if (!md) {
		dev_err(&hdev->dev, "cannot allocate 3M data\n");
		hid_err(hdev, "cannot allocate 3M data\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}
	hid_set_drvdata(hdev, md);
	hid_set_drvdata(hdev, md);
+3 −3
Original line number Original line Diff line number Diff line
@@ -93,7 +93,7 @@ static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id)


	a4 = kzalloc(sizeof(*a4), GFP_KERNEL);
	a4 = kzalloc(sizeof(*a4), GFP_KERNEL);
	if (a4 == NULL) {
	if (a4 == NULL) {
		dev_err(&hdev->dev, "can't alloc device descriptor\n");
		hid_err(hdev, "can't alloc device descriptor\n");
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto err_free;
		goto err_free;
	}
	}
@@ -104,13 +104,13 @@ static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id)


	ret = hid_parse(hdev);
	ret = hid_parse(hdev);
	if (ret) {
	if (ret) {
		dev_err(&hdev->dev, "parse failed\n");
		hid_err(hdev, "parse failed\n");
		goto err_free;
		goto err_free;
	}
	}


	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
	if (ret) {
	if (ret) {
		dev_err(&hdev->dev, "hw start failed\n");
		hid_err(hdev, "hw start failed\n");
		goto err_free;
		goto err_free;
	}
	}


+8 −6
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@
 * any later version.
 * any later version.
 */
 */


#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/device.h>
#include <linux/device.h>
#include <linux/hid.h>
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/module.h>
@@ -280,8 +282,8 @@ static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,


	if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
	if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
			rdesc[53] == 0x65 && rdesc[59] == 0x65) {
			rdesc[53] == 0x65 && rdesc[59] == 0x65) {
		dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report "
		hid_info(hdev,
				"descriptor\n");
			 "fixing up MacBook JIS keyboard report descriptor\n");
		rdesc[53] = rdesc[59] = 0xe7;
		rdesc[53] = rdesc[59] = 0xe7;
	}
	}
	return rdesc;
	return rdesc;
@@ -351,7 +353,7 @@ static int apple_probe(struct hid_device *hdev,


	asc = kzalloc(sizeof(*asc), GFP_KERNEL);
	asc = kzalloc(sizeof(*asc), GFP_KERNEL);
	if (asc == NULL) {
	if (asc == NULL) {
		dev_err(&hdev->dev, "can't alloc apple descriptor\n");
		hid_err(hdev, "can't alloc apple descriptor\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}


@@ -361,7 +363,7 @@ static int apple_probe(struct hid_device *hdev,


	ret = hid_parse(hdev);
	ret = hid_parse(hdev);
	if (ret) {
	if (ret) {
		dev_err(&hdev->dev, "parse failed\n");
		hid_err(hdev, "parse failed\n");
		goto err_free;
		goto err_free;
	}
	}


@@ -372,7 +374,7 @@ static int apple_probe(struct hid_device *hdev,


	ret = hid_hw_start(hdev, connect_mask);
	ret = hid_hw_start(hdev, connect_mask);
	if (ret) {
	if (ret) {
		dev_err(&hdev->dev, "hw start failed\n");
		hid_err(hdev, "hw start failed\n");
		goto err_free;
		goto err_free;
	}
	}


@@ -512,7 +514,7 @@ static int __init apple_init(void)


	ret = hid_register_driver(&apple_driver);
	ret = hid_register_driver(&apple_driver);
	if (ret)
	if (ret)
		printk(KERN_ERR "can't register apple driver\n");
		pr_err("can't register apple driver\n");


	return ret;
	return ret;
}
}
+7 −7
Original line number Original line Diff line number Diff line
@@ -73,14 +73,14 @@ static int axff_init(struct hid_device *hid)
	int error;
	int error;


	if (list_empty(report_list)) {
	if (list_empty(report_list)) {
		dev_err(&hid->dev, "no output reports found\n");
		hid_err(hid, "no output reports found\n");
		return -ENODEV;
		return -ENODEV;
	}
	}


	report = list_first_entry(report_list, struct hid_report, list);
	report = list_first_entry(report_list, struct hid_report, list);


	if (report->maxfield < 4) {
	if (report->maxfield < 4) {
		dev_err(&hid->dev, "no fields in the report: %d\n", report->maxfield);
		hid_err(hid, "no fields in the report: %d\n", report->maxfield);
		return -ENODEV;
		return -ENODEV;
	}
	}


@@ -101,7 +101,7 @@ static int axff_init(struct hid_device *hid)
	axff->report->field[3]->value[0] = 0x00;
	axff->report->field[3]->value[0] = 0x00;
	usbhid_submit_report(hid, axff->report, USB_DIR_OUT);
	usbhid_submit_report(hid, axff->report, USB_DIR_OUT);


	dev_info(&hid->dev, "Force Feedback for ACRUX game controllers by Sergei Kolzun<x0r@dv-life.ru>\n");
	hid_info(hid, "Force Feedback for ACRUX game controllers by Sergei Kolzun<x0r@dv-life.ru>\n");


	return 0;
	return 0;


@@ -114,17 +114,17 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
{
	int error;
	int error;


	dev_dbg(&hdev->dev, "ACRUX HID hardware probe...");
	dev_dbg(&hdev->dev, "ACRUX HID hardware probe...\n");


	error = hid_parse(hdev);
	error = hid_parse(hdev);
	if (error) {
	if (error) {
		dev_err(&hdev->dev, "parse failed\n");
		hid_err(hdev, "parse failed\n");
		return error;
		return error;
	}
	}


	error = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
	error = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
	if (error) {
	if (error) {
		dev_err(&hdev->dev, "hw start failed\n");
		hid_err(hdev, "hw start failed\n");
		return error;
		return error;
	}
	}


@@ -134,7 +134,7 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
		 * Do not fail device initialization completely as device
		 * Do not fail device initialization completely as device
		 * may still be partially operable, just warn.
		 * may still be partially operable, just warn.
		 */
		 */
		dev_warn(&hdev->dev,
		hid_warn(hdev,
			 "Failed to enable force feedback support, error: %d\n",
			 "Failed to enable force feedback support, error: %d\n",
			 error);
			 error);
	}
	}
+2 −2
Original line number Original line Diff line number Diff line
@@ -56,14 +56,14 @@ static int belkin_probe(struct hid_device *hdev, const struct hid_device_id *id)


	ret = hid_parse(hdev);
	ret = hid_parse(hdev);
	if (ret) {
	if (ret) {
		dev_err(&hdev->dev, "parse failed\n");
		hid_err(hdev, "parse failed\n");
		goto err_free;
		goto err_free;
	}
	}


	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |
	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |
		((quirks & BELKIN_HIDDEV) ? HID_CONNECT_HIDDEV_FORCE : 0));
		((quirks & BELKIN_HIDDEV) ? HID_CONNECT_HIDDEV_FORCE : 0));
	if (ret) {
	if (ret) {
		dev_err(&hdev->dev, "hw start failed\n");
		hid_err(hdev, "hw start failed\n");
		goto err_free;
		goto err_free;
	}
	}


Loading