Commit d669793802be5ac105d8ecbab00404ae886d3ebe
Committed by
Matthew Garrett
1 parent
4eeb50220a
Exists in
master
and in
4 other branches
sony-laptop: use pr_<level> for messages
Signed-off-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Showing 1 changed file with 46 additions and 54 deletions Side-by-side Diff
drivers/platform/x86/sony-laptop.c
... | ... | @@ -71,8 +71,9 @@ |
71 | 71 | #endif |
72 | 72 | |
73 | 73 | #define DRV_PFX "sony-laptop: " |
74 | -#define dprintk(msg...) do { \ | |
75 | - if (debug) printk(KERN_WARNING DRV_PFX msg); \ | |
74 | +#define dprintk(msg...) do { \ | |
75 | + if (debug) \ | |
76 | + pr_warn(DRV_PFX msg); \ | |
76 | 77 | } while (0) |
77 | 78 | |
78 | 79 | #define SONY_LAPTOP_DRIVER_VERSION "0.6" |
... | ... | @@ -402,7 +403,7 @@ |
402 | 403 | error = kfifo_alloc(&sony_laptop_input.fifo, |
403 | 404 | SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); |
404 | 405 | if (error) { |
405 | - printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); | |
406 | + pr_err(DRV_PFX "kfifo_alloc failed\n"); | |
406 | 407 | goto err_dec_users; |
407 | 408 | } |
408 | 409 | |
... | ... | @@ -686,7 +687,7 @@ |
686 | 687 | return 0; |
687 | 688 | } |
688 | 689 | |
689 | - printk(KERN_WARNING DRV_PFX "acpi_callreadfunc failed\n"); | |
690 | + pr_warn(DRV_PFX "acpi_callreadfunc failed\n"); | |
690 | 691 | |
691 | 692 | return -1; |
692 | 693 | } |
... | ... | @@ -712,7 +713,7 @@ |
712 | 713 | if (status == AE_OK) { |
713 | 714 | if (result != NULL) { |
714 | 715 | if (out_obj.type != ACPI_TYPE_INTEGER) { |
715 | - printk(KERN_WARNING DRV_PFX "acpi_evaluate_object bad " | |
716 | + pr_warn(DRV_PFX "acpi_evaluate_object bad " | |
716 | 717 | "return type\n"); |
717 | 718 | return -1; |
718 | 719 | } |
... | ... | @@ -721,7 +722,7 @@ |
721 | 722 | return 0; |
722 | 723 | } |
723 | 724 | |
724 | - printk(KERN_WARNING DRV_PFX "acpi_evaluate_object failed\n"); | |
725 | + pr_warn(DRV_PFX "acpi_evaluate_object failed\n"); | |
725 | 726 | |
726 | 727 | return -1; |
727 | 728 | } |
... | ... | @@ -980,7 +981,7 @@ |
980 | 981 | } |
981 | 982 | |
982 | 983 | if (!key_event->data) |
983 | - printk(KERN_INFO DRV_PFX | |
984 | + pr_info(DRV_PFX | |
984 | 985 | "Unknown event: 0x%x 0x%x\n", |
985 | 986 | key_handle, |
986 | 987 | ev); |
... | ... | @@ -1004,7 +1005,7 @@ |
1004 | 1005 | struct acpi_device_info *info; |
1005 | 1006 | |
1006 | 1007 | if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) { |
1007 | - printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", | |
1008 | + pr_warn(DRV_PFX "method: name: %4.4s, args %X\n", | |
1008 | 1009 | (char *)&info->name, info->param_count); |
1009 | 1010 | |
1010 | 1011 | kfree(info); |
... | ... | @@ -1045,7 +1046,7 @@ |
1045 | 1046 | ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset, |
1046 | 1047 | item->value, NULL); |
1047 | 1048 | if (ret < 0) { |
1048 | - printk("%s: %d\n", __func__, ret); | |
1049 | + pr_err(DRV_PFX "%s: %d\n", __func__, ret); | |
1049 | 1050 | break; |
1050 | 1051 | } |
1051 | 1052 | } |
... | ... | @@ -1065,7 +1066,7 @@ |
1065 | 1066 | /* set the last requested brightness level */ |
1066 | 1067 | if (sony_backlight_device && |
1067 | 1068 | sony_backlight_update_status(sony_backlight_device) < 0) |
1068 | - printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n"); | |
1069 | + pr_warn(DRV_PFX "unable to restore brightness level\n"); | |
1069 | 1070 | |
1070 | 1071 | /* re-read rfkill state */ |
1071 | 1072 | sony_nc_rfkill_update(); |
1072 | 1073 | |
... | ... | @@ -1213,15 +1214,11 @@ |
1213 | 1214 | } |
1214 | 1215 | |
1215 | 1216 | device_enum = (union acpi_object *) buffer.pointer; |
1216 | - if (!device_enum) { | |
1217 | - pr_err("Invalid SN06 return object\n"); | |
1217 | + if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) { | |
1218 | + pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n", | |
1219 | + device_enum->type); | |
1218 | 1220 | goto out_no_enum; |
1219 | 1221 | } |
1220 | - if (device_enum->type != ACPI_TYPE_BUFFER) { | |
1221 | - pr_err("Invalid SN06 return object type 0x%.2x\n", | |
1222 | - device_enum->type); | |
1223 | - goto out_no_enum; | |
1224 | - } | |
1225 | 1222 | |
1226 | 1223 | /* the buffer is filled with magic numbers describing the devices |
1227 | 1224 | * available, 0xff terminates the enumeration |
... | ... | @@ -1260,8 +1257,8 @@ |
1260 | 1257 | acpi_handle handle; |
1261 | 1258 | struct sony_nc_value *item; |
1262 | 1259 | |
1263 | - printk(KERN_INFO DRV_PFX "%s v%s.\n", | |
1264 | - SONY_NC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION); | |
1260 | + pr_info(DRV_PFX "%s v%s.\n", SONY_NC_DRIVER_NAME, | |
1261 | + SONY_LAPTOP_DRIVER_VERSION); | |
1265 | 1262 | |
1266 | 1263 | sony_nc_acpi_device = device; |
1267 | 1264 | strcpy(acpi_device_class(device), "sony/hotkey"); |
1268 | 1265 | |
... | ... | @@ -1278,10 +1275,11 @@ |
1278 | 1275 | } |
1279 | 1276 | |
1280 | 1277 | if (debug) { |
1281 | - status = acpi_walk_namespace(ACPI_TYPE_METHOD, sony_nc_acpi_handle, | |
1282 | - 1, sony_walk_callback, NULL, NULL, NULL); | |
1278 | + status = acpi_walk_namespace(ACPI_TYPE_METHOD, | |
1279 | + sony_nc_acpi_handle, 1, sony_walk_callback, | |
1280 | + NULL, NULL, NULL); | |
1283 | 1281 | if (ACPI_FAILURE(status)) { |
1284 | - printk(KERN_WARNING DRV_PFX "unable to walk acpi resources\n"); | |
1282 | + pr_warn(DRV_PFX "unable to walk acpi resources\n"); | |
1285 | 1283 | result = -ENODEV; |
1286 | 1284 | goto outwalk; |
1287 | 1285 | } |
1288 | 1286 | |
... | ... | @@ -1303,13 +1301,12 @@ |
1303 | 1301 | /* setup input devices and helper fifo */ |
1304 | 1302 | result = sony_laptop_setup_input(device); |
1305 | 1303 | if (result) { |
1306 | - printk(KERN_ERR DRV_PFX | |
1307 | - "Unable to create input devices.\n"); | |
1304 | + pr_err(DRV_PFX "Unable to create input devices.\n"); | |
1308 | 1305 | goto outwalk; |
1309 | 1306 | } |
1310 | 1307 | |
1311 | 1308 | if (acpi_video_backlight_support()) { |
1312 | - printk(KERN_INFO DRV_PFX "brightness ignored, must be " | |
1309 | + pr_info(DRV_PFX "brightness ignored, must be " | |
1313 | 1310 | "controlled by ACPI video driver\n"); |
1314 | 1311 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", |
1315 | 1312 | &handle))) { |
... | ... | @@ -1323,7 +1320,7 @@ |
1323 | 1320 | &props); |
1324 | 1321 | |
1325 | 1322 | if (IS_ERR(sony_backlight_device)) { |
1326 | - printk(KERN_WARNING DRV_PFX "unable to register backlight device\n"); | |
1323 | + pr_warning(DRV_PFX "unable to register backlight device\n"); | |
1327 | 1324 | sony_backlight_device = NULL; |
1328 | 1325 | } else { |
1329 | 1326 | sony_backlight_device->props.brightness = |
... | ... | @@ -1850,7 +1847,7 @@ |
1850 | 1847 | if (pcidev) |
1851 | 1848 | pci_dev_put(pcidev); |
1852 | 1849 | |
1853 | - printk(KERN_INFO DRV_PFX "detected Type%d model\n", | |
1850 | + pr_info(DRV_PFX "detected Type%d model\n", | |
1854 | 1851 | dev->model == SONYPI_DEVICE_TYPE1 ? 1 : |
1855 | 1852 | dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3); |
1856 | 1853 | } |
... | ... | @@ -1898,7 +1895,7 @@ |
1898 | 1895 | static int __sony_pic_camera_off(void) |
1899 | 1896 | { |
1900 | 1897 | if (!camera) { |
1901 | - printk(KERN_WARNING DRV_PFX "camera control not enabled\n"); | |
1898 | + pr_warn(DRV_PFX "camera control not enabled\n"); | |
1902 | 1899 | return -ENODEV; |
1903 | 1900 | } |
1904 | 1901 | |
... | ... | @@ -1918,7 +1915,7 @@ |
1918 | 1915 | int i, j, x; |
1919 | 1916 | |
1920 | 1917 | if (!camera) { |
1921 | - printk(KERN_WARNING DRV_PFX "camera control not enabled\n"); | |
1918 | + pr_warn(DRV_PFX "camera control not enabled\n"); | |
1922 | 1919 | return -ENODEV; |
1923 | 1920 | } |
1924 | 1921 | |
... | ... | @@ -1941,7 +1938,7 @@ |
1941 | 1938 | } |
1942 | 1939 | |
1943 | 1940 | if (j == 0) { |
1944 | - printk(KERN_WARNING DRV_PFX "failed to power on camera\n"); | |
1941 | + pr_warn(DRV_PFX "failed to power on camera\n"); | |
1945 | 1942 | return -ENODEV; |
1946 | 1943 | } |
1947 | 1944 | |
... | ... | @@ -1997,7 +1994,7 @@ |
1997 | 1994 | ITERATIONS_SHORT); |
1998 | 1995 | break; |
1999 | 1996 | default: |
2000 | - printk(KERN_ERR DRV_PFX "sony_pic_camera_command invalid: %d\n", | |
1997 | + pr_err(DRV_PFX "sony_pic_camera_command invalid: %d\n", | |
2001 | 1998 | command); |
2002 | 1999 | break; |
2003 | 2000 | } |
... | ... | @@ -2404,7 +2401,7 @@ |
2404 | 2401 | error = |
2405 | 2402 | kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); |
2406 | 2403 | if (error) { |
2407 | - printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); | |
2404 | + pr_err(DRV_PFX "kfifo_alloc failed\n"); | |
2408 | 2405 | return error; |
2409 | 2406 | } |
2410 | 2407 | |
2411 | 2408 | |
... | ... | @@ -2414,11 +2411,11 @@ |
2414 | 2411 | sonypi_misc_device.minor = minor; |
2415 | 2412 | error = misc_register(&sonypi_misc_device); |
2416 | 2413 | if (error) { |
2417 | - printk(KERN_ERR DRV_PFX "misc_register failed\n"); | |
2414 | + pr_err(DRV_PFX "misc_register failed\n"); | |
2418 | 2415 | goto err_free_kfifo; |
2419 | 2416 | } |
2420 | 2417 | if (minor == -1) |
2421 | - printk(KERN_INFO DRV_PFX "device allocated minor is %d\n", | |
2418 | + pr_info(DRV_PFX "device allocated minor is %d\n", | |
2422 | 2419 | sonypi_misc_device.minor); |
2423 | 2420 | |
2424 | 2421 | return 0; |
... | ... | @@ -2478,8 +2475,7 @@ |
2478 | 2475 | } |
2479 | 2476 | for (i = 0; i < p->interrupt_count; i++) { |
2480 | 2477 | if (!p->interrupts[i]) { |
2481 | - printk(KERN_WARNING DRV_PFX | |
2482 | - "Invalid IRQ %d\n", | |
2478 | + pr_warn(DRV_PFX "Invalid IRQ %d\n", | |
2483 | 2479 | p->interrupts[i]); |
2484 | 2480 | continue; |
2485 | 2481 | } |
... | ... | @@ -2518,7 +2514,7 @@ |
2518 | 2514 | ioport->io2.address_length); |
2519 | 2515 | } |
2520 | 2516 | else { |
2521 | - printk(KERN_ERR DRV_PFX "Unknown SPIC Type, more than 2 IO Ports\n"); | |
2517 | + pr_err(DRV_PFX "Unknown SPIC Type, more than 2 IO Ports\n"); | |
2522 | 2518 | return AE_ERROR; |
2523 | 2519 | } |
2524 | 2520 | return AE_OK; |
... | ... | @@ -2546,7 +2542,7 @@ |
2546 | 2542 | dprintk("Evaluating _STA\n"); |
2547 | 2543 | result = acpi_bus_get_status(device); |
2548 | 2544 | if (result) { |
2549 | - printk(KERN_WARNING DRV_PFX "Unable to read status\n"); | |
2545 | + pr_warn(DRV_PFX "Unable to read status\n"); | |
2550 | 2546 | goto end; |
2551 | 2547 | } |
2552 | 2548 | |
... | ... | @@ -2562,8 +2558,7 @@ |
2562 | 2558 | status = acpi_walk_resources(device->handle, METHOD_NAME__PRS, |
2563 | 2559 | sony_pic_read_possible_resource, &spic_dev); |
2564 | 2560 | if (ACPI_FAILURE(status)) { |
2565 | - printk(KERN_WARNING DRV_PFX | |
2566 | - "Failure evaluating %s\n", | |
2561 | + pr_warn(DRV_PFX "Failure evaluating %s\n", | |
2567 | 2562 | METHOD_NAME__PRS); |
2568 | 2563 | result = -ENODEV; |
2569 | 2564 | } |
... | ... | @@ -2677,7 +2672,7 @@ |
2677 | 2672 | |
2678 | 2673 | /* check for total failure */ |
2679 | 2674 | if (ACPI_FAILURE(status)) { |
2680 | - printk(KERN_ERR DRV_PFX "Error evaluating _SRS\n"); | |
2675 | + pr_err(DRV_PFX "Error evaluating _SRS\n"); | |
2681 | 2676 | result = -ENODEV; |
2682 | 2677 | goto end; |
2683 | 2678 | } |
... | ... | @@ -2769,7 +2764,7 @@ |
2769 | 2764 | struct sony_pic_irq *irq, *tmp_irq; |
2770 | 2765 | |
2771 | 2766 | if (sony_pic_disable(device)) { |
2772 | - printk(KERN_ERR DRV_PFX "Couldn't disable device.\n"); | |
2767 | + pr_err(DRV_PFX "Couldn't disable device.\n"); | |
2773 | 2768 | return -ENXIO; |
2774 | 2769 | } |
2775 | 2770 | |
... | ... | @@ -2809,8 +2804,8 @@ |
2809 | 2804 | struct sony_pic_ioport *io, *tmp_io; |
2810 | 2805 | struct sony_pic_irq *irq, *tmp_irq; |
2811 | 2806 | |
2812 | - printk(KERN_INFO DRV_PFX "%s v%s.\n", | |
2813 | - SONY_PIC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION); | |
2807 | + pr_info(DRV_PFX "%s v%s.\n", SONY_PIC_DRIVER_NAME, | |
2808 | + SONY_LAPTOP_DRIVER_VERSION); | |
2814 | 2809 | |
2815 | 2810 | spic_dev.acpi_dev = device; |
2816 | 2811 | strcpy(acpi_device_class(device), "sony/hotkey"); |
2817 | 2812 | |
... | ... | @@ -2820,16 +2815,14 @@ |
2820 | 2815 | /* read _PRS resources */ |
2821 | 2816 | result = sony_pic_possible_resources(device); |
2822 | 2817 | if (result) { |
2823 | - printk(KERN_ERR DRV_PFX | |
2824 | - "Unable to read possible resources.\n"); | |
2818 | + pr_err(DRV_PFX "Unable to read possible resources.\n"); | |
2825 | 2819 | goto err_free_resources; |
2826 | 2820 | } |
2827 | 2821 | |
2828 | 2822 | /* setup input devices and helper fifo */ |
2829 | 2823 | result = sony_laptop_setup_input(device); |
2830 | 2824 | if (result) { |
2831 | - printk(KERN_ERR DRV_PFX | |
2832 | - "Unable to create input devices.\n"); | |
2825 | + pr_err(DRV_PFX "Unable to create input devices.\n"); | |
2833 | 2826 | goto err_free_resources; |
2834 | 2827 | } |
2835 | 2828 | |
... | ... | @@ -2870,7 +2863,7 @@ |
2870 | 2863 | } |
2871 | 2864 | } |
2872 | 2865 | if (!spic_dev.cur_ioport) { |
2873 | - printk(KERN_ERR DRV_PFX "Failed to request_region.\n"); | |
2866 | + pr_err(DRV_PFX "Failed to request_region.\n"); | |
2874 | 2867 | result = -ENODEV; |
2875 | 2868 | goto err_remove_compat; |
2876 | 2869 | } |
... | ... | @@ -2890,7 +2883,7 @@ |
2890 | 2883 | } |
2891 | 2884 | } |
2892 | 2885 | if (!spic_dev.cur_irq) { |
2893 | - printk(KERN_ERR DRV_PFX "Failed to request_irq.\n"); | |
2886 | + pr_err(DRV_PFX "Failed to request_irq.\n"); | |
2894 | 2887 | result = -ENODEV; |
2895 | 2888 | goto err_release_region; |
2896 | 2889 | } |
... | ... | @@ -2898,7 +2891,7 @@ |
2898 | 2891 | /* set resource status _SRS */ |
2899 | 2892 | result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq); |
2900 | 2893 | if (result) { |
2901 | - printk(KERN_ERR DRV_PFX "Couldn't enable device.\n"); | |
2894 | + pr_err(DRV_PFX "Couldn't enable device.\n"); | |
2902 | 2895 | goto err_free_irq; |
2903 | 2896 | } |
2904 | 2897 | |
... | ... | @@ -3007,8 +3000,7 @@ |
3007 | 3000 | if (!no_spic && dmi_check_system(sonypi_dmi_table)) { |
3008 | 3001 | result = acpi_bus_register_driver(&sony_pic_driver); |
3009 | 3002 | if (result) { |
3010 | - printk(KERN_ERR DRV_PFX | |
3011 | - "Unable to register SPIC driver."); | |
3003 | + pr_err(DRV_PFX "Unable to register SPIC driver."); | |
3012 | 3004 | goto out; |
3013 | 3005 | } |
3014 | 3006 | spic_drv_registered = 1; |
... | ... | @@ -3016,7 +3008,7 @@ |
3016 | 3008 | |
3017 | 3009 | result = acpi_bus_register_driver(&sony_nc_driver); |
3018 | 3010 | if (result) { |
3019 | - printk(KERN_ERR DRV_PFX "Unable to register SNC driver."); | |
3011 | + pr_err(DRV_PFX "Unable to register SNC driver."); | |
3020 | 3012 | goto out_unregister_pic; |
3021 | 3013 | } |
3022 | 3014 |