From 07d19ffce54faa5591954bab3644b6f2ff31640c Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 13 Jul 2010 09:13:23 -0700 Subject: Input: atlas_btns - adds a missing owner field for atlas_acpi_driver The owner field provides the link between drivers and modules in sysfs. After setting the owner field, we can see which module provides which driver and vice versa by looking at /sys/bus/acpi/drivers/Atlas ACPI/module and /sys/module/atlas_btns/drivers/acpi:Atlas ACPI Signed-off-by: Axel Lin Signed-off-by: Dmitry Torokhov --- drivers/input/misc/atlas_btns.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/input/misc/atlas_btns.c') diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c index dfaa9a045ed8..7d5360869047 100644 --- a/drivers/input/misc/atlas_btns.c +++ b/drivers/input/misc/atlas_btns.c @@ -145,6 +145,7 @@ MODULE_DEVICE_TABLE(acpi, atlas_device_ids); static struct acpi_driver atlas_acpi_driver = { .name = ACPI_ATLAS_NAME, .class = ACPI_ATLAS_CLASS, + .owner = THIS_MODULE, .ids = atlas_device_ids, .ops = { .add = atlas_acpi_button_add, -- cgit v1.2.3 From 02b5fac1f71c21a84da025973ccb14e4ec6f6d4a Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 13 Jul 2010 09:25:12 -0700 Subject: Input: atlas_btns - fix mixing acpi_status and int for return value To improve readability, this patch fixes mixing acpi_status and int for return value. Signed-off-by: Axel Lin Signed-off-by: Dmitry Torokhov --- drivers/input/misc/atlas_btns.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'drivers/input/misc/atlas_btns.c') diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c index 7d5360869047..2391a86aeb0f 100644 --- a/drivers/input/misc/atlas_btns.c +++ b/drivers/input/misc/atlas_btns.c @@ -60,12 +60,12 @@ static acpi_status acpi_atlas_button_handler(u32 function, input_report_key(input_dev, atlas_keymap[code], key_down); input_sync(input_dev); - status = 0; + status = AE_OK; } else { printk(KERN_WARNING "atlas: shrugged on unexpected function" ":function=%x,address=%lx,value=%x\n", function, (unsigned long)address, (u32)*value); - status = -EINVAL; + status = AE_BAD_PARAMETER; } return status; @@ -114,10 +114,10 @@ static int atlas_acpi_button_add(struct acpi_device *device) if (ACPI_FAILURE(status)) { printk(KERN_ERR "Atlas: Error installing addr spc handler\n"); input_unregister_device(input_dev); - status = -EINVAL; + err = -EINVAL; } - return status; + return err; } static int atlas_acpi_button_remove(struct acpi_device *device, int type) @@ -126,14 +126,12 @@ static int atlas_acpi_button_remove(struct acpi_device *device, int type) status = acpi_remove_address_space_handler(device->handle, 0x81, &acpi_atlas_button_handler); - if (ACPI_FAILURE(status)) { + if (ACPI_FAILURE(status)) printk(KERN_ERR "Atlas: Error removing addr spc handler\n"); - status = -EINVAL; - } input_unregister_device(input_dev); - return status; + return 0; } static const struct acpi_device_id atlas_device_ids[] = { -- cgit v1.2.3 From bf77499faa1c566ccfb1bbb3a85ae5eb5ca926c6 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 13 Jul 2010 09:33:20 -0700 Subject: Input: atlas_btns - switch to using pr_err() and friends This ensures consistent prefixes on all messages emitted by the driver. Signed-off-by: Dmitry Torokhov --- drivers/input/misc/atlas_btns.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'drivers/input/misc/atlas_btns.c') diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c index 2391a86aeb0f..601f7372f9c4 100644 --- a/drivers/input/misc/atlas_btns.c +++ b/drivers/input/misc/atlas_btns.c @@ -21,6 +21,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -62,8 +64,7 @@ static acpi_status acpi_atlas_button_handler(u32 function, status = AE_OK; } else { - printk(KERN_WARNING "atlas: shrugged on unexpected function" - ":function=%x,address=%lx,value=%x\n", + pr_warn("shrugged on unexpected function: function=%x,address=%lx,value=%x\n", function, (unsigned long)address, (u32)*value); status = AE_BAD_PARAMETER; } @@ -79,7 +80,7 @@ static int atlas_acpi_button_add(struct acpi_device *device) input_dev = input_allocate_device(); if (!input_dev) { - printk(KERN_ERR "atlas: unable to allocate input device\n"); + pr_err("unable to allocate input device\n"); return -ENOMEM; } @@ -102,7 +103,7 @@ static int atlas_acpi_button_add(struct acpi_device *device) err = input_register_device(input_dev); if (err) { - printk(KERN_ERR "atlas: couldn't register input device\n"); + pr_err("couldn't register input device\n"); input_free_device(input_dev); return err; } @@ -112,7 +113,7 @@ static int atlas_acpi_button_add(struct acpi_device *device) 0x81, &acpi_atlas_button_handler, &acpi_atlas_button_setup, device); if (ACPI_FAILURE(status)) { - printk(KERN_ERR "Atlas: Error installing addr spc handler\n"); + pr_err("error installing addr spc handler\n"); input_unregister_device(input_dev); err = -EINVAL; } @@ -127,7 +128,7 @@ static int atlas_acpi_button_remove(struct acpi_device *device, int type) status = acpi_remove_address_space_handler(device->handle, 0x81, &acpi_atlas_button_handler); if (ACPI_FAILURE(status)) - printk(KERN_ERR "Atlas: Error removing addr spc handler\n"); + pr_err("error removing addr spc handler\n"); input_unregister_device(input_dev); @@ -153,18 +154,10 @@ static struct acpi_driver atlas_acpi_driver = { static int __init atlas_acpi_init(void) { - int result; - if (acpi_disabled) return -ENODEV; - result = acpi_bus_register_driver(&atlas_acpi_driver); - if (result < 0) { - printk(KERN_ERR "Atlas ACPI: Unable to register driver\n"); - return -ENODEV; - } - - return 0; + return acpi_bus_register_driver(&atlas_acpi_driver); } static void __exit atlas_acpi_exit(void) -- cgit v1.2.3