aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-03-29 18:21:48 -0400
committerMatthew Garrett <mjg@redhat.com>2011-05-27 12:35:51 -0400
commit50f581a4f09f5b7f78a1c791e09b2c8d24a1e20c (patch)
tree74e396088b95c36e4d2cc1b7f2190d7e8b112b6d
parentdd3c7f2308e91d6ecbe5cd8a3310bb49e47e1ae7 (diff)
sony-laptop: Add and use #define pr_fmt
Add pr_fmt. Remove now unused #define DRV_PRX. Neaten dprintk macro. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r--drivers/platform/x86/sony-laptop.c104
1 files changed, 49 insertions, 55 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 6fe8cd6e23b5..12dd0a62f305 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -42,6 +42,8 @@
42 * 42 *
43 */ 43 */
44 44
45#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
46
45#include <linux/kernel.h> 47#include <linux/kernel.h>
46#include <linux/module.h> 48#include <linux/module.h>
47#include <linux/moduleparam.h> 49#include <linux/moduleparam.h>
@@ -70,10 +72,10 @@
70#include <linux/miscdevice.h> 72#include <linux/miscdevice.h>
71#endif 73#endif
72 74
73#define DRV_PFX "sony-laptop: " 75#define dprintk(fmt, ...) \
74#define dprintk(msg...) do { \ 76do { \
75 if (debug) \ 77 if (debug) \
76 pr_warn(DRV_PFX msg); \ 78 pr_warn(fmt, ##__VA_ARGS__); \
77} while (0) 79} while (0)
78 80
79#define SONY_LAPTOP_DRIVER_VERSION "0.6" 81#define SONY_LAPTOP_DRIVER_VERSION "0.6"
@@ -418,7 +420,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
418 error = kfifo_alloc(&sony_laptop_input.fifo, 420 error = kfifo_alloc(&sony_laptop_input.fifo,
419 SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); 421 SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
420 if (error) { 422 if (error) {
421 pr_err(DRV_PFX "kfifo_alloc failed\n"); 423 pr_err("kfifo_alloc failed\n");
422 goto err_dec_users; 424 goto err_dec_users;
423 } 425 }
424 426
@@ -702,7 +704,7 @@ static int acpi_callgetfunc(acpi_handle handle, char *name, int *result)
702 return 0; 704 return 0;
703 } 705 }
704 706
705 pr_warn(DRV_PFX "acpi_callreadfunc failed\n"); 707 pr_warn("acpi_callreadfunc failed\n");
706 708
707 return -1; 709 return -1;
708} 710}
@@ -728,8 +730,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,
728 if (status == AE_OK) { 730 if (status == AE_OK) {
729 if (result != NULL) { 731 if (result != NULL) {
730 if (out_obj.type != ACPI_TYPE_INTEGER) { 732 if (out_obj.type != ACPI_TYPE_INTEGER) {
731 pr_warn(DRV_PFX "acpi_evaluate_object bad " 733 pr_warn("acpi_evaluate_object bad return type\n");
732 "return type\n");
733 return -1; 734 return -1;
734 } 735 }
735 *result = out_obj.integer.value; 736 *result = out_obj.integer.value;
@@ -737,7 +738,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,
737 return 0; 738 return 0;
738 } 739 }
739 740
740 pr_warn(DRV_PFX "acpi_evaluate_object failed\n"); 741 pr_warn("acpi_evaluate_object failed\n");
741 742
742 return -1; 743 return -1;
743} 744}
@@ -1104,10 +1105,8 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
1104 } 1105 }
1105 1106
1106 if (!key_event->data) 1107 if (!key_event->data)
1107 pr_info(DRV_PFX 1108 pr_info("Unknown event: 0x%x 0x%x\n",
1108 "Unknown event: 0x%x 0x%x\n", 1109 key_handle, ev);
1109 key_handle,
1110 ev);
1111 else 1110 else
1112 sony_laptop_report_input_event(ev); 1111 sony_laptop_report_input_event(ev);
1113 } 1112 }
@@ -1128,7 +1127,7 @@ static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
1128 struct acpi_device_info *info; 1127 struct acpi_device_info *info;
1129 1128
1130 if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) { 1129 if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) {
1131 pr_warn(DRV_PFX "method: name: %4.4s, args %X\n", 1130 pr_warn("method: name: %4.4s, args %X\n",
1132 (char *)&info->name, info->param_count); 1131 (char *)&info->name, info->param_count);
1133 1132
1134 kfree(info); 1133 kfree(info);
@@ -1169,7 +1168,7 @@ static int sony_nc_resume(struct acpi_device *device)
1169 ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset, 1168 ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset,
1170 item->value, NULL); 1169 item->value, NULL);
1171 if (ret < 0) { 1170 if (ret < 0) {
1172 pr_err(DRV_PFX "%s: %d\n", __func__, ret); 1171 pr_err("%s: %d\n", __func__, ret);
1173 break; 1172 break;
1174 } 1173 }
1175 } 1174 }
@@ -1336,12 +1335,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
1336 1335
1337 device_enum = (union acpi_object *) buffer.pointer; 1336 device_enum = (union acpi_object *) buffer.pointer;
1338 if (!device_enum) { 1337 if (!device_enum) {
1339 pr_err(DRV_PFX "No SN06 return object."); 1338 pr_err("No SN06 return object\n");
1340 goto out_no_enum; 1339 goto out_no_enum;
1341 } 1340 }
1342 if (device_enum->type != ACPI_TYPE_BUFFER) { 1341 if (device_enum->type != ACPI_TYPE_BUFFER) {
1343 pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n", 1342 pr_err("Invalid SN06 return object 0x%.2x\n",
1344 device_enum->type); 1343 device_enum->type);
1345 goto out_no_enum; 1344 goto out_no_enum;
1346 } 1345 }
1347 1346
@@ -1662,7 +1661,7 @@ static void sony_nc_backlight_setup(void)
1662 ops, &props); 1661 ops, &props);
1663 1662
1664 if (IS_ERR(sony_bl_props.dev)) { 1663 if (IS_ERR(sony_bl_props.dev)) {
1665 pr_warn(DRV_PFX "unable to register backlight device\n"); 1664 pr_warn("unable to register backlight device\n");
1666 sony_bl_props.dev = NULL; 1665 sony_bl_props.dev = NULL;
1667 } else 1666 } else
1668 sony_bl_props.dev->props.brightness = 1667 sony_bl_props.dev->props.brightness =
@@ -1682,8 +1681,7 @@ static int sony_nc_add(struct acpi_device *device)
1682 acpi_handle handle; 1681 acpi_handle handle;
1683 struct sony_nc_value *item; 1682 struct sony_nc_value *item;
1684 1683
1685 pr_info(DRV_PFX "%s v%s.\n", SONY_NC_DRIVER_NAME, 1684 pr_info("%s v%s\n", SONY_NC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION);
1686 SONY_LAPTOP_DRIVER_VERSION);
1687 1685
1688 sony_nc_acpi_device = device; 1686 sony_nc_acpi_device = device;
1689 strcpy(acpi_device_class(device), "sony/hotkey"); 1687 strcpy(acpi_device_class(device), "sony/hotkey");
@@ -1708,7 +1706,7 @@ static int sony_nc_add(struct acpi_device *device)
1708 sony_nc_acpi_handle, 1, sony_walk_callback, 1706 sony_nc_acpi_handle, 1, sony_walk_callback,
1709 NULL, NULL, NULL); 1707 NULL, NULL, NULL);
1710 if (ACPI_FAILURE(status)) { 1708 if (ACPI_FAILURE(status)) {
1711 pr_warn(DRV_PFX "unable to walk acpi resources\n"); 1709 pr_warn("unable to walk acpi resources\n");
1712 result = -ENODEV; 1710 result = -ENODEV;
1713 goto outpresent; 1711 goto outpresent;
1714 } 1712 }
@@ -1736,13 +1734,12 @@ static int sony_nc_add(struct acpi_device *device)
1736 /* setup input devices and helper fifo */ 1734 /* setup input devices and helper fifo */
1737 result = sony_laptop_setup_input(device); 1735 result = sony_laptop_setup_input(device);
1738 if (result) { 1736 if (result) {
1739 pr_err(DRV_PFX "Unable to create input devices.\n"); 1737 pr_err("Unable to create input devices\n");
1740 goto outkbdbacklight; 1738 goto outkbdbacklight;
1741 } 1739 }
1742 1740
1743 if (acpi_video_backlight_support()) { 1741 if (acpi_video_backlight_support()) {
1744 pr_info(DRV_PFX "brightness ignored, must be " 1742 pr_info("brightness ignored, must be controlled by ACPI video driver\n");
1745 "controlled by ACPI video driver\n");
1746 } else { 1743 } else {
1747 sony_nc_backlight_setup(); 1744 sony_nc_backlight_setup();
1748 } 1745 }
@@ -2265,9 +2262,9 @@ out:
2265 if (pcidev) 2262 if (pcidev)
2266 pci_dev_put(pcidev); 2263 pci_dev_put(pcidev);
2267 2264
2268 pr_info(DRV_PFX "detected Type%d model\n", 2265 pr_info("detected Type%d model\n",
2269 dev->model == SONYPI_DEVICE_TYPE1 ? 1 : 2266 dev->model == SONYPI_DEVICE_TYPE1 ? 1 :
2270 dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3); 2267 dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3);
2271} 2268}
2272 2269
2273/* camera tests and poweron/poweroff */ 2270/* camera tests and poweron/poweroff */
@@ -2313,7 +2310,7 @@ static int __sony_pic_camera_ready(void)
2313static int __sony_pic_camera_off(void) 2310static int __sony_pic_camera_off(void)
2314{ 2311{
2315 if (!camera) { 2312 if (!camera) {
2316 pr_warn(DRV_PFX "camera control not enabled\n"); 2313 pr_warn("camera control not enabled\n");
2317 return -ENODEV; 2314 return -ENODEV;
2318 } 2315 }
2319 2316
@@ -2333,7 +2330,7 @@ static int __sony_pic_camera_on(void)
2333 int i, j, x; 2330 int i, j, x;
2334 2331
2335 if (!camera) { 2332 if (!camera) {
2336 pr_warn(DRV_PFX "camera control not enabled\n"); 2333 pr_warn("camera control not enabled\n");
2337 return -ENODEV; 2334 return -ENODEV;
2338 } 2335 }
2339 2336
@@ -2356,7 +2353,7 @@ static int __sony_pic_camera_on(void)
2356 } 2353 }
2357 2354
2358 if (j == 0) { 2355 if (j == 0) {
2359 pr_warn(DRV_PFX "failed to power on camera\n"); 2356 pr_warn("failed to power on camera\n");
2360 return -ENODEV; 2357 return -ENODEV;
2361 } 2358 }
2362 2359
@@ -2412,8 +2409,7 @@ int sony_pic_camera_command(int command, u8 value)
2412 ITERATIONS_SHORT); 2409 ITERATIONS_SHORT);
2413 break; 2410 break;
2414 default: 2411 default:
2415 pr_err(DRV_PFX "sony_pic_camera_command invalid: %d\n", 2412 pr_err("sony_pic_camera_command invalid: %d\n", command);
2416 command);
2417 break; 2413 break;
2418 } 2414 }
2419 mutex_unlock(&spic_dev.lock); 2415 mutex_unlock(&spic_dev.lock);
@@ -2819,7 +2815,7 @@ static int sonypi_compat_init(void)
2819 error = 2815 error =
2820 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); 2816 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
2821 if (error) { 2817 if (error) {
2822 pr_err(DRV_PFX "kfifo_alloc failed\n"); 2818 pr_err("kfifo_alloc failed\n");
2823 return error; 2819 return error;
2824 } 2820 }
2825 2821
@@ -2829,12 +2825,12 @@ static int sonypi_compat_init(void)
2829 sonypi_misc_device.minor = minor; 2825 sonypi_misc_device.minor = minor;
2830 error = misc_register(&sonypi_misc_device); 2826 error = misc_register(&sonypi_misc_device);
2831 if (error) { 2827 if (error) {
2832 pr_err(DRV_PFX "misc_register failed\n"); 2828 pr_err("misc_register failed\n");
2833 goto err_free_kfifo; 2829 goto err_free_kfifo;
2834 } 2830 }
2835 if (minor == -1) 2831 if (minor == -1)
2836 pr_info(DRV_PFX "device allocated minor is %d\n", 2832 pr_info("device allocated minor is %d\n",
2837 sonypi_misc_device.minor); 2833 sonypi_misc_device.minor);
2838 2834
2839 return 0; 2835 return 0;
2840 2836
@@ -2893,8 +2889,8 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2893 } 2889 }
2894 for (i = 0; i < p->interrupt_count; i++) { 2890 for (i = 0; i < p->interrupt_count; i++) {
2895 if (!p->interrupts[i]) { 2891 if (!p->interrupts[i]) {
2896 pr_warn(DRV_PFX "Invalid IRQ %d\n", 2892 pr_warn("Invalid IRQ %d\n",
2897 p->interrupts[i]); 2893 p->interrupts[i]);
2898 continue; 2894 continue;
2899 } 2895 }
2900 interrupt = kzalloc(sizeof(*interrupt), 2896 interrupt = kzalloc(sizeof(*interrupt),
@@ -2932,14 +2928,14 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2932 ioport->io2.address_length); 2928 ioport->io2.address_length);
2933 } 2929 }
2934 else { 2930 else {
2935 pr_err(DRV_PFX "Unknown SPIC Type, more than 2 IO Ports\n"); 2931 pr_err("Unknown SPIC Type, more than 2 IO Ports\n");
2936 return AE_ERROR; 2932 return AE_ERROR;
2937 } 2933 }
2938 return AE_OK; 2934 return AE_OK;
2939 } 2935 }
2940 default: 2936 default:
2941 dprintk("Resource %d isn't an IRQ nor an IO port\n", 2937 dprintk("Resource %d isn't an IRQ nor an IO port\n",
2942 resource->type); 2938 resource->type);
2943 2939
2944 case ACPI_RESOURCE_TYPE_END_TAG: 2940 case ACPI_RESOURCE_TYPE_END_TAG:
2945 return AE_OK; 2941 return AE_OK;
@@ -2960,7 +2956,7 @@ static int sony_pic_possible_resources(struct acpi_device *device)
2960 dprintk("Evaluating _STA\n"); 2956 dprintk("Evaluating _STA\n");
2961 result = acpi_bus_get_status(device); 2957 result = acpi_bus_get_status(device);
2962 if (result) { 2958 if (result) {
2963 pr_warn(DRV_PFX "Unable to read status\n"); 2959 pr_warn("Unable to read status\n");
2964 goto end; 2960 goto end;
2965 } 2961 }
2966 2962
@@ -2976,8 +2972,7 @@ static int sony_pic_possible_resources(struct acpi_device *device)
2976 status = acpi_walk_resources(device->handle, METHOD_NAME__PRS, 2972 status = acpi_walk_resources(device->handle, METHOD_NAME__PRS,
2977 sony_pic_read_possible_resource, &spic_dev); 2973 sony_pic_read_possible_resource, &spic_dev);
2978 if (ACPI_FAILURE(status)) { 2974 if (ACPI_FAILURE(status)) {
2979 pr_warn(DRV_PFX "Failure evaluating %s\n", 2975 pr_warn("Failure evaluating %s\n", METHOD_NAME__PRS);
2980 METHOD_NAME__PRS);
2981 result = -ENODEV; 2976 result = -ENODEV;
2982 } 2977 }
2983end: 2978end:
@@ -3090,7 +3085,7 @@ static int sony_pic_enable(struct acpi_device *device,
3090 3085
3091 /* check for total failure */ 3086 /* check for total failure */
3092 if (ACPI_FAILURE(status)) { 3087 if (ACPI_FAILURE(status)) {
3093 pr_err(DRV_PFX "Error evaluating _SRS\n"); 3088 pr_err("Error evaluating _SRS\n");
3094 result = -ENODEV; 3089 result = -ENODEV;
3095 goto end; 3090 goto end;
3096 } 3091 }
@@ -3182,7 +3177,7 @@ static int sony_pic_remove(struct acpi_device *device, int type)
3182 struct sony_pic_irq *irq, *tmp_irq; 3177 struct sony_pic_irq *irq, *tmp_irq;
3183 3178
3184 if (sony_pic_disable(device)) { 3179 if (sony_pic_disable(device)) {
3185 pr_err(DRV_PFX "Couldn't disable device.\n"); 3180 pr_err("Couldn't disable device\n");
3186 return -ENXIO; 3181 return -ENXIO;
3187 } 3182 }
3188 3183
@@ -3222,8 +3217,7 @@ static int sony_pic_add(struct acpi_device *device)
3222 struct sony_pic_ioport *io, *tmp_io; 3217 struct sony_pic_ioport *io, *tmp_io;
3223 struct sony_pic_irq *irq, *tmp_irq; 3218 struct sony_pic_irq *irq, *tmp_irq;
3224 3219
3225 pr_info(DRV_PFX "%s v%s.\n", SONY_PIC_DRIVER_NAME, 3220 pr_info("%s v%s\n", SONY_PIC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION);
3226 SONY_LAPTOP_DRIVER_VERSION);
3227 3221
3228 spic_dev.acpi_dev = device; 3222 spic_dev.acpi_dev = device;
3229 strcpy(acpi_device_class(device), "sony/hotkey"); 3223 strcpy(acpi_device_class(device), "sony/hotkey");
@@ -3233,14 +3227,14 @@ static int sony_pic_add(struct acpi_device *device)
3233 /* read _PRS resources */ 3227 /* read _PRS resources */
3234 result = sony_pic_possible_resources(device); 3228 result = sony_pic_possible_resources(device);
3235 if (result) { 3229 if (result) {
3236 pr_err(DRV_PFX "Unable to read possible resources.\n"); 3230 pr_err("Unable to read possible resources\n");
3237 goto err_free_resources; 3231 goto err_free_resources;
3238 } 3232 }
3239 3233
3240 /* setup input devices and helper fifo */ 3234 /* setup input devices and helper fifo */
3241 result = sony_laptop_setup_input(device); 3235 result = sony_laptop_setup_input(device);
3242 if (result) { 3236 if (result) {
3243 pr_err(DRV_PFX "Unable to create input devices.\n"); 3237 pr_err("Unable to create input devices\n");
3244 goto err_free_resources; 3238 goto err_free_resources;
3245 } 3239 }
3246 3240
@@ -3281,7 +3275,7 @@ static int sony_pic_add(struct acpi_device *device)
3281 } 3275 }
3282 } 3276 }
3283 if (!spic_dev.cur_ioport) { 3277 if (!spic_dev.cur_ioport) {
3284 pr_err(DRV_PFX "Failed to request_region.\n"); 3278 pr_err("Failed to request_region\n");
3285 result = -ENODEV; 3279 result = -ENODEV;
3286 goto err_remove_compat; 3280 goto err_remove_compat;
3287 } 3281 }
@@ -3301,7 +3295,7 @@ static int sony_pic_add(struct acpi_device *device)
3301 } 3295 }
3302 } 3296 }
3303 if (!spic_dev.cur_irq) { 3297 if (!spic_dev.cur_irq) {
3304 pr_err(DRV_PFX "Failed to request_irq.\n"); 3298 pr_err("Failed to request_irq\n");
3305 result = -ENODEV; 3299 result = -ENODEV;
3306 goto err_release_region; 3300 goto err_release_region;
3307 } 3301 }
@@ -3309,7 +3303,7 @@ static int sony_pic_add(struct acpi_device *device)
3309 /* set resource status _SRS */ 3303 /* set resource status _SRS */
3310 result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq); 3304 result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq);
3311 if (result) { 3305 if (result) {
3312 pr_err(DRV_PFX "Couldn't enable device.\n"); 3306 pr_err("Couldn't enable device\n");
3313 goto err_free_irq; 3307 goto err_free_irq;
3314 } 3308 }
3315 3309
@@ -3418,7 +3412,7 @@ static int __init sony_laptop_init(void)
3418 if (!no_spic && dmi_check_system(sonypi_dmi_table)) { 3412 if (!no_spic && dmi_check_system(sonypi_dmi_table)) {
3419 result = acpi_bus_register_driver(&sony_pic_driver); 3413 result = acpi_bus_register_driver(&sony_pic_driver);
3420 if (result) { 3414 if (result) {
3421 pr_err(DRV_PFX "Unable to register SPIC driver."); 3415 pr_err("Unable to register SPIC driver\n");
3422 goto out; 3416 goto out;
3423 } 3417 }
3424 spic_drv_registered = 1; 3418 spic_drv_registered = 1;
@@ -3426,7 +3420,7 @@ static int __init sony_laptop_init(void)
3426 3420
3427 result = acpi_bus_register_driver(&sony_nc_driver); 3421 result = acpi_bus_register_driver(&sony_nc_driver);
3428 if (result) { 3422 if (result) {
3429 pr_err(DRV_PFX "Unable to register SNC driver."); 3423 pr_err("Unable to register SNC driver\n");
3430 goto out_unregister_pic; 3424 goto out_unregister_pic;
3431 } 3425 }
3432 3426