Commit 50f581a4 authored by Joe Perches's avatar Joe Perches Committed by Matthew Garrett

sony-laptop: Add and use #define pr_fmt

Add pr_fmt.
Remove now unused #define DRV_PRX.
Neaten dprintk macro.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent dd3c7f23
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
...@@ -70,10 +72,10 @@ ...@@ -70,10 +72,10 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#endif #endif
#define DRV_PFX "sony-laptop: " #define dprintk(fmt, ...) \
#define dprintk(msg...) do { \ do { \
if (debug) \ if (debug) \
pr_warn(DRV_PFX msg); \ pr_warn(fmt, ##__VA_ARGS__); \
} while (0) } while (0)
#define SONY_LAPTOP_DRIVER_VERSION "0.6" #define SONY_LAPTOP_DRIVER_VERSION "0.6"
...@@ -418,7 +420,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) ...@@ -418,7 +420,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
error = kfifo_alloc(&sony_laptop_input.fifo, error = kfifo_alloc(&sony_laptop_input.fifo,
SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
if (error) { if (error) {
pr_err(DRV_PFX "kfifo_alloc failed\n"); pr_err("kfifo_alloc failed\n");
goto err_dec_users; goto err_dec_users;
} }
...@@ -702,7 +704,7 @@ static int acpi_callgetfunc(acpi_handle handle, char *name, int *result) ...@@ -702,7 +704,7 @@ static int acpi_callgetfunc(acpi_handle handle, char *name, int *result)
return 0; return 0;
} }
pr_warn(DRV_PFX "acpi_callreadfunc failed\n"); pr_warn("acpi_callreadfunc failed\n");
return -1; return -1;
} }
...@@ -728,8 +730,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value, ...@@ -728,8 +730,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,
if (status == AE_OK) { if (status == AE_OK) {
if (result != NULL) { if (result != NULL) {
if (out_obj.type != ACPI_TYPE_INTEGER) { if (out_obj.type != ACPI_TYPE_INTEGER) {
pr_warn(DRV_PFX "acpi_evaluate_object bad " pr_warn("acpi_evaluate_object bad return type\n");
"return type\n");
return -1; return -1;
} }
*result = out_obj.integer.value; *result = out_obj.integer.value;
...@@ -737,7 +738,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value, ...@@ -737,7 +738,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,
return 0; return 0;
} }
pr_warn(DRV_PFX "acpi_evaluate_object failed\n"); pr_warn("acpi_evaluate_object failed\n");
return -1; return -1;
} }
...@@ -1104,10 +1105,8 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) ...@@ -1104,10 +1105,8 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
} }
if (!key_event->data) if (!key_event->data)
pr_info(DRV_PFX pr_info("Unknown event: 0x%x 0x%x\n",
"Unknown event: 0x%x 0x%x\n", key_handle, ev);
key_handle,
ev);
else else
sony_laptop_report_input_event(ev); sony_laptop_report_input_event(ev);
} }
...@@ -1128,7 +1127,7 @@ static acpi_status sony_walk_callback(acpi_handle handle, u32 level, ...@@ -1128,7 +1127,7 @@ static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
struct acpi_device_info *info; struct acpi_device_info *info;
if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) { if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) {
pr_warn(DRV_PFX "method: name: %4.4s, args %X\n", pr_warn("method: name: %4.4s, args %X\n",
(char *)&info->name, info->param_count); (char *)&info->name, info->param_count);
kfree(info); kfree(info);
...@@ -1169,7 +1168,7 @@ static int sony_nc_resume(struct acpi_device *device) ...@@ -1169,7 +1168,7 @@ static int sony_nc_resume(struct acpi_device *device)
ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset, ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset,
item->value, NULL); item->value, NULL);
if (ret < 0) { if (ret < 0) {
pr_err(DRV_PFX "%s: %d\n", __func__, ret); pr_err("%s: %d\n", __func__, ret);
break; break;
} }
} }
...@@ -1336,12 +1335,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device) ...@@ -1336,12 +1335,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
device_enum = (union acpi_object *) buffer.pointer; device_enum = (union acpi_object *) buffer.pointer;
if (!device_enum) { if (!device_enum) {
pr_err(DRV_PFX "No SN06 return object."); pr_err("No SN06 return object\n");
goto out_no_enum; goto out_no_enum;
} }
if (device_enum->type != ACPI_TYPE_BUFFER) { if (device_enum->type != ACPI_TYPE_BUFFER) {
pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n", pr_err("Invalid SN06 return object 0x%.2x\n",
device_enum->type); device_enum->type);
goto out_no_enum; goto out_no_enum;
} }
...@@ -1662,7 +1661,7 @@ static void sony_nc_backlight_setup(void) ...@@ -1662,7 +1661,7 @@ static void sony_nc_backlight_setup(void)
ops, &props); ops, &props);
if (IS_ERR(sony_bl_props.dev)) { if (IS_ERR(sony_bl_props.dev)) {
pr_warn(DRV_PFX "unable to register backlight device\n"); pr_warn("unable to register backlight device\n");
sony_bl_props.dev = NULL; sony_bl_props.dev = NULL;
} else } else
sony_bl_props.dev->props.brightness = sony_bl_props.dev->props.brightness =
...@@ -1682,8 +1681,7 @@ static int sony_nc_add(struct acpi_device *device) ...@@ -1682,8 +1681,7 @@ static int sony_nc_add(struct acpi_device *device)
acpi_handle handle; acpi_handle handle;
struct sony_nc_value *item; struct sony_nc_value *item;
pr_info(DRV_PFX "%s v%s.\n", SONY_NC_DRIVER_NAME, pr_info("%s v%s\n", SONY_NC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION);
SONY_LAPTOP_DRIVER_VERSION);
sony_nc_acpi_device = device; sony_nc_acpi_device = device;
strcpy(acpi_device_class(device), "sony/hotkey"); strcpy(acpi_device_class(device), "sony/hotkey");
...@@ -1708,7 +1706,7 @@ static int sony_nc_add(struct acpi_device *device) ...@@ -1708,7 +1706,7 @@ static int sony_nc_add(struct acpi_device *device)
sony_nc_acpi_handle, 1, sony_walk_callback, sony_nc_acpi_handle, 1, sony_walk_callback,
NULL, NULL, NULL); NULL, NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
pr_warn(DRV_PFX "unable to walk acpi resources\n"); pr_warn("unable to walk acpi resources\n");
result = -ENODEV; result = -ENODEV;
goto outpresent; goto outpresent;
} }
...@@ -1736,13 +1734,12 @@ static int sony_nc_add(struct acpi_device *device) ...@@ -1736,13 +1734,12 @@ static int sony_nc_add(struct acpi_device *device)
/* setup input devices and helper fifo */ /* setup input devices and helper fifo */
result = sony_laptop_setup_input(device); result = sony_laptop_setup_input(device);
if (result) { if (result) {
pr_err(DRV_PFX "Unable to create input devices.\n"); pr_err("Unable to create input devices\n");
goto outkbdbacklight; goto outkbdbacklight;
} }
if (acpi_video_backlight_support()) { if (acpi_video_backlight_support()) {
pr_info(DRV_PFX "brightness ignored, must be " pr_info("brightness ignored, must be controlled by ACPI video driver\n");
"controlled by ACPI video driver\n");
} else { } else {
sony_nc_backlight_setup(); sony_nc_backlight_setup();
} }
...@@ -2265,9 +2262,9 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev) ...@@ -2265,9 +2262,9 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev)
if (pcidev) if (pcidev)
pci_dev_put(pcidev); pci_dev_put(pcidev);
pr_info(DRV_PFX "detected Type%d model\n", pr_info("detected Type%d model\n",
dev->model == SONYPI_DEVICE_TYPE1 ? 1 : dev->model == SONYPI_DEVICE_TYPE1 ? 1 :
dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3); dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3);
} }
/* camera tests and poweron/poweroff */ /* camera tests and poweron/poweroff */
...@@ -2313,7 +2310,7 @@ static int __sony_pic_camera_ready(void) ...@@ -2313,7 +2310,7 @@ static int __sony_pic_camera_ready(void)
static int __sony_pic_camera_off(void) static int __sony_pic_camera_off(void)
{ {
if (!camera) { if (!camera) {
pr_warn(DRV_PFX "camera control not enabled\n"); pr_warn("camera control not enabled\n");
return -ENODEV; return -ENODEV;
} }
...@@ -2333,7 +2330,7 @@ static int __sony_pic_camera_on(void) ...@@ -2333,7 +2330,7 @@ static int __sony_pic_camera_on(void)
int i, j, x; int i, j, x;
if (!camera) { if (!camera) {
pr_warn(DRV_PFX "camera control not enabled\n"); pr_warn("camera control not enabled\n");
return -ENODEV; return -ENODEV;
} }
...@@ -2356,7 +2353,7 @@ static int __sony_pic_camera_on(void) ...@@ -2356,7 +2353,7 @@ static int __sony_pic_camera_on(void)
} }
if (j == 0) { if (j == 0) {
pr_warn(DRV_PFX "failed to power on camera\n"); pr_warn("failed to power on camera\n");
return -ENODEV; return -ENODEV;
} }
...@@ -2412,8 +2409,7 @@ int sony_pic_camera_command(int command, u8 value) ...@@ -2412,8 +2409,7 @@ int sony_pic_camera_command(int command, u8 value)
ITERATIONS_SHORT); ITERATIONS_SHORT);
break; break;
default: default:
pr_err(DRV_PFX "sony_pic_camera_command invalid: %d\n", pr_err("sony_pic_camera_command invalid: %d\n", command);
command);
break; break;
} }
mutex_unlock(&spic_dev.lock); mutex_unlock(&spic_dev.lock);
...@@ -2819,7 +2815,7 @@ static int sonypi_compat_init(void) ...@@ -2819,7 +2815,7 @@ static int sonypi_compat_init(void)
error = error =
kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
if (error) { if (error) {
pr_err(DRV_PFX "kfifo_alloc failed\n"); pr_err("kfifo_alloc failed\n");
return error; return error;
} }
...@@ -2829,12 +2825,12 @@ static int sonypi_compat_init(void) ...@@ -2829,12 +2825,12 @@ static int sonypi_compat_init(void)
sonypi_misc_device.minor = minor; sonypi_misc_device.minor = minor;
error = misc_register(&sonypi_misc_device); error = misc_register(&sonypi_misc_device);
if (error) { if (error) {
pr_err(DRV_PFX "misc_register failed\n"); pr_err("misc_register failed\n");
goto err_free_kfifo; goto err_free_kfifo;
} }
if (minor == -1) if (minor == -1)
pr_info(DRV_PFX "device allocated minor is %d\n", pr_info("device allocated minor is %d\n",
sonypi_misc_device.minor); sonypi_misc_device.minor);
return 0; return 0;
...@@ -2893,8 +2889,8 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context) ...@@ -2893,8 +2889,8 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
} }
for (i = 0; i < p->interrupt_count; i++) { for (i = 0; i < p->interrupt_count; i++) {
if (!p->interrupts[i]) { if (!p->interrupts[i]) {
pr_warn(DRV_PFX "Invalid IRQ %d\n", pr_warn("Invalid IRQ %d\n",
p->interrupts[i]); p->interrupts[i]);
continue; continue;
} }
interrupt = kzalloc(sizeof(*interrupt), interrupt = kzalloc(sizeof(*interrupt),
...@@ -2932,14 +2928,14 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context) ...@@ -2932,14 +2928,14 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
ioport->io2.address_length); ioport->io2.address_length);
} }
else { else {
pr_err(DRV_PFX "Unknown SPIC Type, more than 2 IO Ports\n"); pr_err("Unknown SPIC Type, more than 2 IO Ports\n");
return AE_ERROR; return AE_ERROR;
} }
return AE_OK; return AE_OK;
} }
default: default:
dprintk("Resource %d isn't an IRQ nor an IO port\n", dprintk("Resource %d isn't an IRQ nor an IO port\n",
resource->type); resource->type);
case ACPI_RESOURCE_TYPE_END_TAG: case ACPI_RESOURCE_TYPE_END_TAG:
return AE_OK; return AE_OK;
...@@ -2960,7 +2956,7 @@ static int sony_pic_possible_resources(struct acpi_device *device) ...@@ -2960,7 +2956,7 @@ static int sony_pic_possible_resources(struct acpi_device *device)
dprintk("Evaluating _STA\n"); dprintk("Evaluating _STA\n");
result = acpi_bus_get_status(device); result = acpi_bus_get_status(device);
if (result) { if (result) {
pr_warn(DRV_PFX "Unable to read status\n"); pr_warn("Unable to read status\n");
goto end; goto end;
} }
...@@ -2976,8 +2972,7 @@ static int sony_pic_possible_resources(struct acpi_device *device) ...@@ -2976,8 +2972,7 @@ static int sony_pic_possible_resources(struct acpi_device *device)
status = acpi_walk_resources(device->handle, METHOD_NAME__PRS, status = acpi_walk_resources(device->handle, METHOD_NAME__PRS,
sony_pic_read_possible_resource, &spic_dev); sony_pic_read_possible_resource, &spic_dev);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
pr_warn(DRV_PFX "Failure evaluating %s\n", pr_warn("Failure evaluating %s\n", METHOD_NAME__PRS);
METHOD_NAME__PRS);
result = -ENODEV; result = -ENODEV;
} }
end: end:
...@@ -3090,7 +3085,7 @@ static int sony_pic_enable(struct acpi_device *device, ...@@ -3090,7 +3085,7 @@ static int sony_pic_enable(struct acpi_device *device,
/* check for total failure */ /* check for total failure */
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
pr_err(DRV_PFX "Error evaluating _SRS\n"); pr_err("Error evaluating _SRS\n");
result = -ENODEV; result = -ENODEV;
goto end; goto end;
} }
...@@ -3182,7 +3177,7 @@ static int sony_pic_remove(struct acpi_device *device, int type) ...@@ -3182,7 +3177,7 @@ static int sony_pic_remove(struct acpi_device *device, int type)
struct sony_pic_irq *irq, *tmp_irq; struct sony_pic_irq *irq, *tmp_irq;
if (sony_pic_disable(device)) { if (sony_pic_disable(device)) {
pr_err(DRV_PFX "Couldn't disable device.\n"); pr_err("Couldn't disable device\n");
return -ENXIO; return -ENXIO;
} }
...@@ -3222,8 +3217,7 @@ static int sony_pic_add(struct acpi_device *device) ...@@ -3222,8 +3217,7 @@ static int sony_pic_add(struct acpi_device *device)
struct sony_pic_ioport *io, *tmp_io; struct sony_pic_ioport *io, *tmp_io;
struct sony_pic_irq *irq, *tmp_irq; struct sony_pic_irq *irq, *tmp_irq;
pr_info(DRV_PFX "%s v%s.\n", SONY_PIC_DRIVER_NAME, pr_info("%s v%s\n", SONY_PIC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION);
SONY_LAPTOP_DRIVER_VERSION);
spic_dev.acpi_dev = device; spic_dev.acpi_dev = device;
strcpy(acpi_device_class(device), "sony/hotkey"); strcpy(acpi_device_class(device), "sony/hotkey");
...@@ -3233,14 +3227,14 @@ static int sony_pic_add(struct acpi_device *device) ...@@ -3233,14 +3227,14 @@ static int sony_pic_add(struct acpi_device *device)
/* read _PRS resources */ /* read _PRS resources */
result = sony_pic_possible_resources(device); result = sony_pic_possible_resources(device);
if (result) { if (result) {
pr_err(DRV_PFX "Unable to read possible resources.\n"); pr_err("Unable to read possible resources\n");
goto err_free_resources; goto err_free_resources;
} }
/* setup input devices and helper fifo */ /* setup input devices and helper fifo */
result = sony_laptop_setup_input(device); result = sony_laptop_setup_input(device);
if (result) { if (result) {
pr_err(DRV_PFX "Unable to create input devices.\n"); pr_err("Unable to create input devices\n");
goto err_free_resources; goto err_free_resources;
} }
...@@ -3281,7 +3275,7 @@ static int sony_pic_add(struct acpi_device *device) ...@@ -3281,7 +3275,7 @@ static int sony_pic_add(struct acpi_device *device)
} }
} }
if (!spic_dev.cur_ioport) { if (!spic_dev.cur_ioport) {
pr_err(DRV_PFX "Failed to request_region.\n"); pr_err("Failed to request_region\n");
result = -ENODEV; result = -ENODEV;
goto err_remove_compat; goto err_remove_compat;
} }
...@@ -3301,7 +3295,7 @@ static int sony_pic_add(struct acpi_device *device) ...@@ -3301,7 +3295,7 @@ static int sony_pic_add(struct acpi_device *device)
} }
} }
if (!spic_dev.cur_irq) { if (!spic_dev.cur_irq) {
pr_err(DRV_PFX "Failed to request_irq.\n"); pr_err("Failed to request_irq\n");
result = -ENODEV; result = -ENODEV;
goto err_release_region; goto err_release_region;
} }
...@@ -3309,7 +3303,7 @@ static int sony_pic_add(struct acpi_device *device) ...@@ -3309,7 +3303,7 @@ static int sony_pic_add(struct acpi_device *device)
/* set resource status _SRS */ /* set resource status _SRS */
result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq); result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq);
if (result) { if (result) {
pr_err(DRV_PFX "Couldn't enable device.\n"); pr_err("Couldn't enable device\n");
goto err_free_irq; goto err_free_irq;
} }
...@@ -3418,7 +3412,7 @@ static int __init sony_laptop_init(void) ...@@ -3418,7 +3412,7 @@ static int __init sony_laptop_init(void)
if (!no_spic && dmi_check_system(sonypi_dmi_table)) { if (!no_spic && dmi_check_system(sonypi_dmi_table)) {
result = acpi_bus_register_driver(&sony_pic_driver); result = acpi_bus_register_driver(&sony_pic_driver);
if (result) { if (result) {
pr_err(DRV_PFX "Unable to register SPIC driver."); pr_err("Unable to register SPIC driver\n");
goto out; goto out;
} }
spic_drv_registered = 1; spic_drv_registered = 1;
...@@ -3426,7 +3420,7 @@ static int __init sony_laptop_init(void) ...@@ -3426,7 +3420,7 @@ static int __init sony_laptop_init(void)
result = acpi_bus_register_driver(&sony_nc_driver); result = acpi_bus_register_driver(&sony_nc_driver);
if (result) { if (result) {
pr_err(DRV_PFX "Unable to register SNC driver."); pr_err("Unable to register SNC driver\n");
goto out_unregister_pic; goto out_unregister_pic;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment