aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/sony-laptop.c
diff options
context:
space:
mode:
authorMattia Dongili <malattia@linux.it>2011-02-18 21:52:28 -0500
committerMatthew Garrett <mjg@redhat.com>2011-03-28 06:05:25 -0400
commitd669793802be5ac105d8ecbab00404ae886d3ebe (patch)
treefe2cdd3e343d856b4c4be5caad29d2391da99633 /drivers/platform/x86/sony-laptop.c
parent4eeb50220a4efd8c33598a228d03aff203a7ad07 (diff)
sony-laptop: use pr_<level> for messages
Signed-off-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/sony-laptop.c')
-rw-r--r--drivers/platform/x86/sony-laptop.c100
1 files changed, 46 insertions, 54 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 5fa93cb6f337..89d66c70d828 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -71,8 +71,9 @@
71#endif 71#endif
72 72
73#define DRV_PFX "sony-laptop: " 73#define DRV_PFX "sony-laptop: "
74#define dprintk(msg...) do { \ 74#define dprintk(msg...) do { \
75 if (debug) printk(KERN_WARNING DRV_PFX msg); \ 75 if (debug) \
76 pr_warn(DRV_PFX msg); \
76} while (0) 77} while (0)
77 78
78#define SONY_LAPTOP_DRIVER_VERSION "0.6" 79#define SONY_LAPTOP_DRIVER_VERSION "0.6"
@@ -402,7 +403,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
402 error = kfifo_alloc(&sony_laptop_input.fifo, 403 error = kfifo_alloc(&sony_laptop_input.fifo,
403 SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); 404 SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
404 if (error) { 405 if (error) {
405 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); 406 pr_err(DRV_PFX "kfifo_alloc failed\n");
406 goto err_dec_users; 407 goto err_dec_users;
407 } 408 }
408 409
@@ -686,7 +687,7 @@ static int acpi_callgetfunc(acpi_handle handle, char *name, int *result)
686 return 0; 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 return -1; 692 return -1;
692} 693}
@@ -712,7 +713,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,
712 if (status == AE_OK) { 713 if (status == AE_OK) {
713 if (result != NULL) { 714 if (result != NULL) {
714 if (out_obj.type != ACPI_TYPE_INTEGER) { 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 "return type\n"); 717 "return type\n");
717 return -1; 718 return -1;
718 } 719 }
@@ -721,7 +722,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,
721 return 0; 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 return -1; 727 return -1;
727} 728}
@@ -980,7 +981,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
980 } 981 }
981 982
982 if (!key_event->data) 983 if (!key_event->data)
983 printk(KERN_INFO DRV_PFX 984 pr_info(DRV_PFX
984 "Unknown event: 0x%x 0x%x\n", 985 "Unknown event: 0x%x 0x%x\n",
985 key_handle, 986 key_handle,
986 ev); 987 ev);
@@ -1004,7 +1005,7 @@ static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
1004 struct acpi_device_info *info; 1005 struct acpi_device_info *info;
1005 1006
1006 if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) { 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 (char *)&info->name, info->param_count); 1009 (char *)&info->name, info->param_count);
1009 1010
1010 kfree(info); 1011 kfree(info);
@@ -1045,7 +1046,7 @@ static int sony_nc_resume(struct acpi_device *device)
1045 ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset, 1046 ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset,
1046 item->value, NULL); 1047 item->value, NULL);
1047 if (ret < 0) { 1048 if (ret < 0) {
1048 printk("%s: %d\n", __func__, ret); 1049 pr_err(DRV_PFX "%s: %d\n", __func__, ret);
1049 break; 1050 break;
1050 } 1051 }
1051 } 1052 }
@@ -1065,7 +1066,7 @@ static int sony_nc_resume(struct acpi_device *device)
1065 /* set the last requested brightness level */ 1066 /* set the last requested brightness level */
1066 if (sony_backlight_device && 1067 if (sony_backlight_device &&
1067 sony_backlight_update_status(sony_backlight_device) < 0) 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 /* re-read rfkill state */ 1071 /* re-read rfkill state */
1071 sony_nc_rfkill_update(); 1072 sony_nc_rfkill_update();
@@ -1213,13 +1214,9 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
1213 } 1214 }
1214 1215
1215 device_enum = (union acpi_object *) buffer.pointer; 1216 device_enum = (union acpi_object *) buffer.pointer;
1216 if (!device_enum) { 1217 if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
1217 pr_err("Invalid SN06 return object\n"); 1218 pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n",
1218 goto out_no_enum; 1219 device_enum->type);
1219 }
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; 1220 goto out_no_enum;
1224 } 1221 }
1225 1222
@@ -1260,8 +1257,8 @@ static int sony_nc_add(struct acpi_device *device)
1260 acpi_handle handle; 1257 acpi_handle handle;
1261 struct sony_nc_value *item; 1258 struct sony_nc_value *item;
1262 1259
1263 printk(KERN_INFO DRV_PFX "%s v%s.\n", 1260 pr_info(DRV_PFX "%s v%s.\n", SONY_NC_DRIVER_NAME,
1264 SONY_NC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION); 1261 SONY_LAPTOP_DRIVER_VERSION);
1265 1262
1266 sony_nc_acpi_device = device; 1263 sony_nc_acpi_device = device;
1267 strcpy(acpi_device_class(device), "sony/hotkey"); 1264 strcpy(acpi_device_class(device), "sony/hotkey");
@@ -1278,10 +1275,11 @@ static int sony_nc_add(struct acpi_device *device)
1278 } 1275 }
1279 1276
1280 if (debug) { 1277 if (debug) {
1281 status = acpi_walk_namespace(ACPI_TYPE_METHOD, sony_nc_acpi_handle, 1278 status = acpi_walk_namespace(ACPI_TYPE_METHOD,
1282 1, sony_walk_callback, NULL, NULL, NULL); 1279 sony_nc_acpi_handle, 1, sony_walk_callback,
1280 NULL, NULL, NULL);
1283 if (ACPI_FAILURE(status)) { 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 result = -ENODEV; 1283 result = -ENODEV;
1286 goto outwalk; 1284 goto outwalk;
1287 } 1285 }
@@ -1303,13 +1301,12 @@ static int sony_nc_add(struct acpi_device *device)
1303 /* setup input devices and helper fifo */ 1301 /* setup input devices and helper fifo */
1304 result = sony_laptop_setup_input(device); 1302 result = sony_laptop_setup_input(device);
1305 if (result) { 1303 if (result) {
1306 printk(KERN_ERR DRV_PFX 1304 pr_err(DRV_PFX "Unable to create input devices.\n");
1307 "Unable to create input devices.\n");
1308 goto outwalk; 1305 goto outwalk;
1309 } 1306 }
1310 1307
1311 if (acpi_video_backlight_support()) { 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 "controlled by ACPI video driver\n"); 1310 "controlled by ACPI video driver\n");
1314 } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", 1311 } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT",
1315 &handle))) { 1312 &handle))) {
@@ -1323,7 +1320,7 @@ static int sony_nc_add(struct acpi_device *device)
1323 &props); 1320 &props);
1324 1321
1325 if (IS_ERR(sony_backlight_device)) { 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 sony_backlight_device = NULL; 1324 sony_backlight_device = NULL;
1328 } else { 1325 } else {
1329 sony_backlight_device->props.brightness = 1326 sony_backlight_device->props.brightness =
@@ -1850,7 +1847,7 @@ out:
1850 if (pcidev) 1847 if (pcidev)
1851 pci_dev_put(pcidev); 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 dev->model == SONYPI_DEVICE_TYPE1 ? 1 : 1851 dev->model == SONYPI_DEVICE_TYPE1 ? 1 :
1855 dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3); 1852 dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3);
1856} 1853}
@@ -1898,7 +1895,7 @@ static int __sony_pic_camera_ready(void)
1898static int __sony_pic_camera_off(void) 1895static int __sony_pic_camera_off(void)
1899{ 1896{
1900 if (!camera) { 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 return -ENODEV; 1899 return -ENODEV;
1903 } 1900 }
1904 1901
@@ -1918,7 +1915,7 @@ static int __sony_pic_camera_on(void)
1918 int i, j, x; 1915 int i, j, x;
1919 1916
1920 if (!camera) { 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 return -ENODEV; 1919 return -ENODEV;
1923 } 1920 }
1924 1921
@@ -1941,7 +1938,7 @@ static int __sony_pic_camera_on(void)
1941 } 1938 }
1942 1939
1943 if (j == 0) { 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 return -ENODEV; 1942 return -ENODEV;
1946 } 1943 }
1947 1944
@@ -1997,7 +1994,7 @@ int sony_pic_camera_command(int command, u8 value)
1997 ITERATIONS_SHORT); 1994 ITERATIONS_SHORT);
1998 break; 1995 break;
1999 default: 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 command); 1998 command);
2002 break; 1999 break;
2003 } 2000 }
@@ -2404,7 +2401,7 @@ static int sonypi_compat_init(void)
2404 error = 2401 error =
2405 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); 2402 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
2406 if (error) { 2403 if (error) {
2407 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); 2404 pr_err(DRV_PFX "kfifo_alloc failed\n");
2408 return error; 2405 return error;
2409 } 2406 }
2410 2407
@@ -2414,11 +2411,11 @@ static int sonypi_compat_init(void)
2414 sonypi_misc_device.minor = minor; 2411 sonypi_misc_device.minor = minor;
2415 error = misc_register(&sonypi_misc_device); 2412 error = misc_register(&sonypi_misc_device);
2416 if (error) { 2413 if (error) {
2417 printk(KERN_ERR DRV_PFX "misc_register failed\n"); 2414 pr_err(DRV_PFX "misc_register failed\n");
2418 goto err_free_kfifo; 2415 goto err_free_kfifo;
2419 } 2416 }
2420 if (minor == -1) 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 sonypi_misc_device.minor); 2419 sonypi_misc_device.minor);
2423 2420
2424 return 0; 2421 return 0;
@@ -2478,8 +2475,7 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2478 } 2475 }
2479 for (i = 0; i < p->interrupt_count; i++) { 2476 for (i = 0; i < p->interrupt_count; i++) {
2480 if (!p->interrupts[i]) { 2477 if (!p->interrupts[i]) {
2481 printk(KERN_WARNING DRV_PFX 2478 pr_warn(DRV_PFX "Invalid IRQ %d\n",
2482 "Invalid IRQ %d\n",
2483 p->interrupts[i]); 2479 p->interrupts[i]);
2484 continue; 2480 continue;
2485 } 2481 }
@@ -2518,7 +2514,7 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2518 ioport->io2.address_length); 2514 ioport->io2.address_length);
2519 } 2515 }
2520 else { 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 return AE_ERROR; 2518 return AE_ERROR;
2523 } 2519 }
2524 return AE_OK; 2520 return AE_OK;
@@ -2546,7 +2542,7 @@ static int sony_pic_possible_resources(struct acpi_device *device)
2546 dprintk("Evaluating _STA\n"); 2542 dprintk("Evaluating _STA\n");
2547 result = acpi_bus_get_status(device); 2543 result = acpi_bus_get_status(device);
2548 if (result) { 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 goto end; 2546 goto end;
2551 } 2547 }
2552 2548
@@ -2562,8 +2558,7 @@ static int sony_pic_possible_resources(struct acpi_device *device)
2562 status = acpi_walk_resources(device->handle, METHOD_NAME__PRS, 2558 status = acpi_walk_resources(device->handle, METHOD_NAME__PRS,
2563 sony_pic_read_possible_resource, &spic_dev); 2559 sony_pic_read_possible_resource, &spic_dev);
2564 if (ACPI_FAILURE(status)) { 2560 if (ACPI_FAILURE(status)) {
2565 printk(KERN_WARNING DRV_PFX 2561 pr_warn(DRV_PFX "Failure evaluating %s\n",
2566 "Failure evaluating %s\n",
2567 METHOD_NAME__PRS); 2562 METHOD_NAME__PRS);
2568 result = -ENODEV; 2563 result = -ENODEV;
2569 } 2564 }
@@ -2677,7 +2672,7 @@ static int sony_pic_enable(struct acpi_device *device,
2677 2672
2678 /* check for total failure */ 2673 /* check for total failure */
2679 if (ACPI_FAILURE(status)) { 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 result = -ENODEV; 2676 result = -ENODEV;
2682 goto end; 2677 goto end;
2683 } 2678 }
@@ -2769,7 +2764,7 @@ static int sony_pic_remove(struct acpi_device *device, int type)
2769 struct sony_pic_irq *irq, *tmp_irq; 2764 struct sony_pic_irq *irq, *tmp_irq;
2770 2765
2771 if (sony_pic_disable(device)) { 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 return -ENXIO; 2768 return -ENXIO;
2774 } 2769 }
2775 2770
@@ -2809,8 +2804,8 @@ static int sony_pic_add(struct acpi_device *device)
2809 struct sony_pic_ioport *io, *tmp_io; 2804 struct sony_pic_ioport *io, *tmp_io;
2810 struct sony_pic_irq *irq, *tmp_irq; 2805 struct sony_pic_irq *irq, *tmp_irq;
2811 2806
2812 printk(KERN_INFO DRV_PFX "%s v%s.\n", 2807 pr_info(DRV_PFX "%s v%s.\n", SONY_PIC_DRIVER_NAME,
2813 SONY_PIC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION); 2808 SONY_LAPTOP_DRIVER_VERSION);
2814 2809
2815 spic_dev.acpi_dev = device; 2810 spic_dev.acpi_dev = device;
2816 strcpy(acpi_device_class(device), "sony/hotkey"); 2811 strcpy(acpi_device_class(device), "sony/hotkey");
@@ -2820,16 +2815,14 @@ static int sony_pic_add(struct acpi_device *device)
2820 /* read _PRS resources */ 2815 /* read _PRS resources */
2821 result = sony_pic_possible_resources(device); 2816 result = sony_pic_possible_resources(device);
2822 if (result) { 2817 if (result) {
2823 printk(KERN_ERR DRV_PFX 2818 pr_err(DRV_PFX "Unable to read possible resources.\n");
2824 "Unable to read possible resources.\n");
2825 goto err_free_resources; 2819 goto err_free_resources;
2826 } 2820 }
2827 2821
2828 /* setup input devices and helper fifo */ 2822 /* setup input devices and helper fifo */
2829 result = sony_laptop_setup_input(device); 2823 result = sony_laptop_setup_input(device);
2830 if (result) { 2824 if (result) {
2831 printk(KERN_ERR DRV_PFX 2825 pr_err(DRV_PFX "Unable to create input devices.\n");
2832 "Unable to create input devices.\n");
2833 goto err_free_resources; 2826 goto err_free_resources;
2834 } 2827 }
2835 2828
@@ -2870,7 +2863,7 @@ static int sony_pic_add(struct acpi_device *device)
2870 } 2863 }
2871 } 2864 }
2872 if (!spic_dev.cur_ioport) { 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 result = -ENODEV; 2867 result = -ENODEV;
2875 goto err_remove_compat; 2868 goto err_remove_compat;
2876 } 2869 }
@@ -2890,7 +2883,7 @@ static int sony_pic_add(struct acpi_device *device)
2890 } 2883 }
2891 } 2884 }
2892 if (!spic_dev.cur_irq) { 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 result = -ENODEV; 2887 result = -ENODEV;
2895 goto err_release_region; 2888 goto err_release_region;
2896 } 2889 }
@@ -2898,7 +2891,7 @@ static int sony_pic_add(struct acpi_device *device)
2898 /* set resource status _SRS */ 2891 /* set resource status _SRS */
2899 result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq); 2892 result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq);
2900 if (result) { 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 goto err_free_irq; 2895 goto err_free_irq;
2903 } 2896 }
2904 2897
@@ -3007,8 +3000,7 @@ static int __init sony_laptop_init(void)
3007 if (!no_spic && dmi_check_system(sonypi_dmi_table)) { 3000 if (!no_spic && dmi_check_system(sonypi_dmi_table)) {
3008 result = acpi_bus_register_driver(&sony_pic_driver); 3001 result = acpi_bus_register_driver(&sony_pic_driver);
3009 if (result) { 3002 if (result) {
3010 printk(KERN_ERR DRV_PFX 3003 pr_err(DRV_PFX "Unable to register SPIC driver.");
3011 "Unable to register SPIC driver.");
3012 goto out; 3004 goto out;
3013 } 3005 }
3014 spic_drv_registered = 1; 3006 spic_drv_registered = 1;
@@ -3016,7 +3008,7 @@ static int __init sony_laptop_init(void)
3016 3008
3017 result = acpi_bus_register_driver(&sony_nc_driver); 3009 result = acpi_bus_register_driver(&sony_nc_driver);
3018 if (result) { 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 goto out_unregister_pic; 3012 goto out_unregister_pic;
3021 } 3013 }
3022 3014