aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-picolcd.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-12-09 22:29:03 -0500
committerJiri Kosina <jkosina@suse.cz>2010-12-10 09:10:38 -0500
commit4291ee305e9bb0699504a66f0e2b7aefcf0512a5 (patch)
tree3996b77eb64d4f3b76a0799f30a5b2ba6cbc9ddb /drivers/hid/hid-picolcd.c
parent5bea7660bba973dc5e8e9d92b11fb1dd5b524ebf (diff)
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: Joe Perches <joe@perches.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-picolcd.c')
-rw-r--r--drivers/hid/hid-picolcd.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
index 38565fee7bf1..e4ce47156106 100644
--- a/drivers/hid/hid-picolcd.c
+++ b/drivers/hid/hid-picolcd.c
@@ -253,7 +253,7 @@ static struct hid_report *picolcd_report(int id, struct hid_device *hdev, int di
253 if (report->id == id) 253 if (report->id == id)
254 return report; 254 return report;
255 } 255 }
256 dev_warn(&hdev->dev, "No report with id 0x%x found\n", id); 256 hid_warn(hdev, "No report with id 0x%x found\n", id);
257 return NULL; 257 return NULL;
258} 258}
259 259
@@ -1329,7 +1329,7 @@ static int picolcd_check_version(struct hid_device *hdev)
1329 1329
1330 verinfo = picolcd_send_and_wait(hdev, REPORT_VERSION, NULL, 0); 1330 verinfo = picolcd_send_and_wait(hdev, REPORT_VERSION, NULL, 0);
1331 if (!verinfo) { 1331 if (!verinfo) {
1332 dev_err(&hdev->dev, "no version response from PicoLCD"); 1332 hid_err(hdev, "no version response from PicoLCD\n");
1333 return -ENODEV; 1333 return -ENODEV;
1334 } 1334 }
1335 1335
@@ -1337,14 +1337,14 @@ static int picolcd_check_version(struct hid_device *hdev)
1337 data->version[0] = verinfo->raw_data[1]; 1337 data->version[0] = verinfo->raw_data[1];
1338 data->version[1] = verinfo->raw_data[0]; 1338 data->version[1] = verinfo->raw_data[0];
1339 if (data->status & PICOLCD_BOOTLOADER) { 1339 if (data->status & PICOLCD_BOOTLOADER) {
1340 dev_info(&hdev->dev, "PicoLCD, bootloader version %d.%d\n", 1340 hid_info(hdev, "PicoLCD, bootloader version %d.%d\n",
1341 verinfo->raw_data[1], verinfo->raw_data[0]); 1341 verinfo->raw_data[1], verinfo->raw_data[0]);
1342 } else { 1342 } else {
1343 dev_info(&hdev->dev, "PicoLCD, firmware version %d.%d\n", 1343 hid_info(hdev, "PicoLCD, firmware version %d.%d\n",
1344 verinfo->raw_data[1], verinfo->raw_data[0]); 1344 verinfo->raw_data[1], verinfo->raw_data[0]);
1345 } 1345 }
1346 } else { 1346 } else {
1347 dev_err(&hdev->dev, "confused, got unexpected version response from PicoLCD\n"); 1347 hid_err(hdev, "confused, got unexpected version response from PicoLCD\n");
1348 ret = -EINVAL; 1348 ret = -EINVAL;
1349 } 1349 }
1350 kfree(verinfo); 1350 kfree(verinfo);
@@ -2328,8 +2328,7 @@ static void picolcd_init_devfs(struct picolcd_data *data,
2328 (flash_w ? S_IWUSR : 0) | (flash_r ? S_IRUSR : 0), 2328 (flash_w ? S_IWUSR : 0) | (flash_r ? S_IRUSR : 0),
2329 hdev->debug_dir, data, &picolcd_debug_flash_fops); 2329 hdev->debug_dir, data, &picolcd_debug_flash_fops);
2330 } else if (flash_r || flash_w) 2330 } else if (flash_r || flash_w)
2331 dev_warn(&hdev->dev, "Unexpected FLASH access reports, " 2331 hid_warn(hdev, "Unexpected FLASH access reports, please submit rdesc for review\n");
2332 "please submit rdesc for review\n");
2333} 2332}
2334 2333
2335static void picolcd_exit_devfs(struct picolcd_data *data) 2334static void picolcd_exit_devfs(struct picolcd_data *data)
@@ -2457,13 +2456,13 @@ static int picolcd_init_keys(struct picolcd_data *data,
2457 return -ENODEV; 2456 return -ENODEV;
2458 if (report->maxfield != 1 || report->field[0]->report_count != 2 || 2457 if (report->maxfield != 1 || report->field[0]->report_count != 2 ||
2459 report->field[0]->report_size != 8) { 2458 report->field[0]->report_size != 8) {
2460 dev_err(&hdev->dev, "unsupported KEY_STATE report"); 2459 hid_err(hdev, "unsupported KEY_STATE report\n");
2461 return -EINVAL; 2460 return -EINVAL;
2462 } 2461 }
2463 2462
2464 idev = input_allocate_device(); 2463 idev = input_allocate_device();
2465 if (idev == NULL) { 2464 if (idev == NULL) {
2466 dev_err(&hdev->dev, "failed to allocate input device"); 2465 hid_err(hdev, "failed to allocate input device\n");
2467 return -ENOMEM; 2466 return -ENOMEM;
2468 } 2467 }
2469 input_set_drvdata(idev, hdev); 2468 input_set_drvdata(idev, hdev);
@@ -2485,7 +2484,7 @@ static int picolcd_init_keys(struct picolcd_data *data,
2485 input_set_capability(idev, EV_KEY, data->keycode[i]); 2484 input_set_capability(idev, EV_KEY, data->keycode[i]);
2486 error = input_register_device(idev); 2485 error = input_register_device(idev);
2487 if (error) { 2486 if (error) {
2488 dev_err(&hdev->dev, "error registering the input device"); 2487 hid_err(hdev, "error registering the input device\n");
2489 input_free_device(idev); 2488 input_free_device(idev);
2490 return error; 2489 return error;
2491 } 2490 }
@@ -2522,9 +2521,8 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
2522 return error; 2521 return error;
2523 2522
2524 if (data->version[0] != 0 && data->version[1] != 3) 2523 if (data->version[0] != 0 && data->version[1] != 3)
2525 dev_info(&hdev->dev, "Device with untested firmware revision, " 2524 hid_info(hdev, "Device with untested firmware revision, please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n",
2526 "please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n", 2525 dev_name(&hdev->dev));
2527 dev_name(&hdev->dev));
2528 2526
2529 /* Setup keypad input device */ 2527 /* Setup keypad input device */
2530 error = picolcd_init_keys(data, picolcd_in_report(REPORT_KEY_STATE, hdev)); 2528 error = picolcd_init_keys(data, picolcd_in_report(REPORT_KEY_STATE, hdev));
@@ -2581,9 +2579,8 @@ static int picolcd_probe_bootloader(struct hid_device *hdev, struct picolcd_data
2581 return error; 2579 return error;
2582 2580
2583 if (data->version[0] != 1 && data->version[1] != 0) 2581 if (data->version[0] != 1 && data->version[1] != 0)
2584 dev_info(&hdev->dev, "Device with untested bootloader revision, " 2582 hid_info(hdev, "Device with untested bootloader revision, please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n",
2585 "please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n", 2583 dev_name(&hdev->dev));
2586 dev_name(&hdev->dev));
2587 2584
2588 picolcd_init_devfs(data, NULL, NULL, 2585 picolcd_init_devfs(data, NULL, NULL,
2589 picolcd_out_report(REPORT_BL_READ_MEMORY, hdev), 2586 picolcd_out_report(REPORT_BL_READ_MEMORY, hdev),
@@ -2605,7 +2602,7 @@ static int picolcd_probe(struct hid_device *hdev,
2605 */ 2602 */
2606 data = kzalloc(sizeof(struct picolcd_data), GFP_KERNEL); 2603 data = kzalloc(sizeof(struct picolcd_data), GFP_KERNEL);
2607 if (data == NULL) { 2604 if (data == NULL) {
2608 dev_err(&hdev->dev, "can't allocate space for Minibox PicoLCD device data\n"); 2605 hid_err(hdev, "can't allocate space for Minibox PicoLCD device data\n");
2609 error = -ENOMEM; 2606 error = -ENOMEM;
2610 goto err_no_cleanup; 2607 goto err_no_cleanup;
2611 } 2608 }
@@ -2621,7 +2618,7 @@ static int picolcd_probe(struct hid_device *hdev,
2621 /* Parse the device reports and start it up */ 2618 /* Parse the device reports and start it up */
2622 error = hid_parse(hdev); 2619 error = hid_parse(hdev);
2623 if (error) { 2620 if (error) {
2624 dev_err(&hdev->dev, "device report parse failed\n"); 2621 hid_err(hdev, "device report parse failed\n");
2625 goto err_cleanup_data; 2622 goto err_cleanup_data;
2626 } 2623 }
2627 2624
@@ -2631,25 +2628,25 @@ static int picolcd_probe(struct hid_device *hdev,
2631 error = hid_hw_start(hdev, 0); 2628 error = hid_hw_start(hdev, 0);
2632 hdev->claimed = 0; 2629 hdev->claimed = 0;
2633 if (error) { 2630 if (error) {
2634 dev_err(&hdev->dev, "hardware start failed\n"); 2631 hid_err(hdev, "hardware start failed\n");
2635 goto err_cleanup_data; 2632 goto err_cleanup_data;
2636 } 2633 }
2637 2634
2638 error = hid_hw_open(hdev); 2635 error = hid_hw_open(hdev);
2639 if (error) { 2636 if (error) {
2640 dev_err(&hdev->dev, "failed to open input interrupt pipe for key and IR events\n"); 2637 hid_err(hdev, "failed to open input interrupt pipe for key and IR events\n");
2641 goto err_cleanup_hid_hw; 2638 goto err_cleanup_hid_hw;
2642 } 2639 }
2643 2640
2644 error = device_create_file(&hdev->dev, &dev_attr_operation_mode_delay); 2641 error = device_create_file(&hdev->dev, &dev_attr_operation_mode_delay);
2645 if (error) { 2642 if (error) {
2646 dev_err(&hdev->dev, "failed to create sysfs attributes\n"); 2643 hid_err(hdev, "failed to create sysfs attributes\n");
2647 goto err_cleanup_hid_ll; 2644 goto err_cleanup_hid_ll;
2648 } 2645 }
2649 2646
2650 error = device_create_file(&hdev->dev, &dev_attr_operation_mode); 2647 error = device_create_file(&hdev->dev, &dev_attr_operation_mode);
2651 if (error) { 2648 if (error) {
2652 dev_err(&hdev->dev, "failed to create sysfs attributes\n"); 2649 hid_err(hdev, "failed to create sysfs attributes\n");
2653 goto err_cleanup_sysfs1; 2650 goto err_cleanup_sysfs1;
2654 } 2651 }
2655 2652