From a3c270561ea4455cbcea0ac2b53335655d9fc805 Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Thu, 5 Mar 2009 20:15:44 +0100 Subject: NULL noise: drivers/platform/x86/panasonic-laptop.c Fix this sparse warning: drivers/platform/x86/panasonic-laptop.c:273:70: warning: Using plain integer as NULL pointer Signed-off-by: Hannes Eder Signed-off-by: Len Brown --- drivers/platform/x86/panasonic-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/platform/x86') diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index a5ce4bc202e..41cf3e79493 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c @@ -271,7 +271,7 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc, u32 *sinf) union acpi_object *hkey = NULL; int i; - status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, 0, + status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, -- cgit v1.2.3 From 700b6721cd1b891b67c2dcee046be12154a21fd6 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 7 Apr 2009 15:37:16 +0000 Subject: fujitsu-laptop: use .notify method instead of installing handler directly This patch adds a .notify() method. The presence of .notify() causes Linux/ACPI to manage event handlers and notify handlers on our behalf, so we don't have to install and remove them ourselves. Tested by Tony on Fujitsu-Siemens Lifebook S6420 [FJNB1E6] with BIOS 1.18 (01/09/2009). Tested by Jonathan on Fujitsu S7020. Signed-off-by: Bjorn Helgaas Acked-By: Tony Vroon Tested-By: Tony Vroon Acked-by: Jonathan Woithe Tested-by: Jonathan Woithe Signed-off-by: Len Brown --- drivers/platform/x86/fujitsu-laptop.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'drivers/platform/x86') diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 45940f31fe9..10f879648f2 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -203,7 +203,7 @@ struct led_classdev kblamps_led = { static u32 dbg_level = 0x03; #endif -static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data); +static void acpi_fujitsu_notify(struct acpi_device *device, u32 event); /* Fujitsu ACPI interface function */ @@ -658,7 +658,6 @@ static struct dmi_system_id fujitsu_dmi_table[] = { static int acpi_fujitsu_add(struct acpi_device *device) { - acpi_status status; acpi_handle handle; int result = 0; int state = 0; @@ -673,20 +672,10 @@ static int acpi_fujitsu_add(struct acpi_device *device) sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); device->driver_data = fujitsu; - status = acpi_install_notify_handler(device->handle, - ACPI_DEVICE_NOTIFY, - acpi_fujitsu_notify, fujitsu); - - if (ACPI_FAILURE(status)) { - printk(KERN_ERR "Error installing notify handler\n"); - error = -ENODEV; - goto err_stop; - } - fujitsu->input = input = input_allocate_device(); if (!input) { error = -ENOMEM; - goto err_uninstall_notify; + goto err_stop; } snprintf(fujitsu->phys, sizeof(fujitsu->phys), @@ -743,9 +732,6 @@ static int acpi_fujitsu_add(struct acpi_device *device) end: err_free_input_dev: input_free_device(input); -err_uninstall_notify: - acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, - acpi_fujitsu_notify); err_stop: return result; @@ -753,7 +739,6 @@ err_stop: static int acpi_fujitsu_remove(struct acpi_device *device, int type) { - acpi_status status; struct fujitsu_t *fujitsu = NULL; if (!device || !acpi_driver_data(device)) @@ -761,10 +746,6 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type) fujitsu = acpi_driver_data(device); - status = acpi_remove_notify_handler(fujitsu->acpi_handle, - ACPI_DEVICE_NOTIFY, - acpi_fujitsu_notify); - if (!device || !acpi_driver_data(device)) return -EINVAL; @@ -775,7 +756,7 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type) /* Brightness notify */ -static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) +static void acpi_fujitsu_notify(struct acpi_device *device, u32 event) { struct input_dev *input; int keycode; @@ -829,8 +810,6 @@ static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) input_report_key(input, keycode, 0); input_sync(input); } - - return; } /* ACPI device for hotkey handling */ @@ -1107,6 +1086,7 @@ static struct acpi_driver acpi_fujitsu_driver = { .ops = { .add = acpi_fujitsu_add, .remove = acpi_fujitsu_remove, + .notify = acpi_fujitsu_notify, }, }; -- cgit v1.2.3 From b4ec0275464756f4fd4108b4a4ca7aff61358ad3 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 7 Apr 2009 15:37:22 +0000 Subject: fujitsu-laptop: use .notify method instead of installing hotkey handler directly This patch adds a .notify() method. The presence of .notify() causes Linux/ACPI to manage event handlers and notify handlers on our behalf, so we don't have to install and remove them ourselves. Tested by Tony on Fujitsu-Siemens Lifebook S6420 [FJNB1E6] with BIOS 1.18 (01/09/2009). Tested by Jonathan on Fujitsu S7020. Signed-off-by: Bjorn Helgaas Acked-By: Tony Vroon Tested-By: Tony Vroon Acked-by: Jonathan Woithe Tested-by: Jonathan Woithe Signed-off-by: Len Brown --- drivers/platform/x86/fujitsu-laptop.c | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'drivers/platform/x86') diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 10f879648f2..218b9a16ac3 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -174,8 +174,7 @@ struct fujitsu_hotkey_t { static struct fujitsu_hotkey_t *fujitsu_hotkey; -static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, - void *data); +static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event); #ifdef CONFIG_LEDS_CLASS static enum led_brightness logolamp_get(struct led_classdev *cdev); @@ -816,7 +815,6 @@ static void acpi_fujitsu_notify(struct acpi_device *device, u32 event) static int acpi_fujitsu_hotkey_add(struct acpi_device *device) { - acpi_status status; acpi_handle handle; int result = 0; int state = 0; @@ -833,17 +831,6 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); device->driver_data = fujitsu_hotkey; - status = acpi_install_notify_handler(device->handle, - ACPI_DEVICE_NOTIFY, - acpi_fujitsu_hotkey_notify, - fujitsu_hotkey); - - if (ACPI_FAILURE(status)) { - printk(KERN_ERR "Error installing notify handler\n"); - error = -ENODEV; - goto err_stop; - } - /* kfifo */ spin_lock_init(&fujitsu_hotkey->fifo_lock); fujitsu_hotkey->fifo = @@ -858,7 +845,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) fujitsu_hotkey->input = input = input_allocate_device(); if (!input) { error = -ENOMEM; - goto err_uninstall_notify; + goto err_free_fifo; } snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys), @@ -954,9 +941,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) end: err_free_input_dev: input_free_device(input); -err_uninstall_notify: - acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, - acpi_fujitsu_hotkey_notify); +err_free_fifo: kfifo_free(fujitsu_hotkey->fifo); err_stop: @@ -965,7 +950,6 @@ err_stop: static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) { - acpi_status status; struct fujitsu_hotkey_t *fujitsu_hotkey = NULL; if (!device || !acpi_driver_data(device)) @@ -973,10 +957,6 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) fujitsu_hotkey = acpi_driver_data(device); - status = acpi_remove_notify_handler(fujitsu_hotkey->acpi_handle, - ACPI_DEVICE_NOTIFY, - acpi_fujitsu_hotkey_notify); - fujitsu_hotkey->acpi_handle = NULL; kfifo_free(fujitsu_hotkey->fifo); @@ -984,8 +964,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) return 0; } -static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, - void *data) +static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) { struct input_dev *input; int keycode, keycode_r; @@ -1068,8 +1047,6 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, input_sync(input); break; } - - return; } /* Initialization */ @@ -1102,6 +1079,7 @@ static struct acpi_driver acpi_fujitsu_hotkey_driver = { .ops = { .add = acpi_fujitsu_hotkey_add, .remove = acpi_fujitsu_hotkey_remove, + .notify = acpi_fujitsu_hotkey_notify, }, }; -- cgit v1.2.3 From cddd1f71d972a43c88f0ef91e1b71023539cd6e0 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 7 Apr 2009 15:37:27 +0000 Subject: panasonic-laptop: use .notify method instead of installing handler directly This patch adds a .notify() method. The presence of .notify() causes Linux/ACPI to manage event handlers and notify handlers on our behalf, so we don't have to install and remove them ourselves. Signed-off-by: Bjorn Helgaas CC: Harald Welte Signed-off-by: Len Brown --- drivers/platform/x86/panasonic-laptop.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'drivers/platform/x86') diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index a5ce4bc202e..1a11de0d3e6 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c @@ -176,6 +176,7 @@ enum SINF_BITS { SINF_NUM_BATTERIES = 0, static int acpi_pcc_hotkey_add(struct acpi_device *device); static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type); static int acpi_pcc_hotkey_resume(struct acpi_device *device); +static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event); static const struct acpi_device_id pcc_device_ids[] = { { "MAT0012", 0}, @@ -194,6 +195,7 @@ static struct acpi_driver acpi_pcc_driver = { .add = acpi_pcc_hotkey_add, .remove = acpi_pcc_hotkey_remove, .resume = acpi_pcc_hotkey_resume, + .notify = acpi_pcc_hotkey_notify, }, }; @@ -527,9 +529,9 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) return; } -static void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data) +static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event) { - struct pcc_acpi *pcc = (struct pcc_acpi *) data; + struct pcc_acpi *pcc = acpi_driver_data(device); switch (event) { case HKEY_NOTIFY: @@ -599,7 +601,6 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device) static int acpi_pcc_hotkey_add(struct acpi_device *device) { - acpi_status status; struct pcc_acpi *pcc; int num_sifr, result; @@ -640,22 +641,11 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) goto out_sinf; } - /* initialize hotkey input device */ - status = acpi_install_notify_handler(pcc->handle, ACPI_DEVICE_NOTIFY, - acpi_pcc_hotkey_notify, pcc); - - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); - result = -ENODEV; - goto out_input; - } - /* initialize backlight */ pcc->backlight = backlight_device_register("panasonic", NULL, pcc, &pcc_backlight_ops); if (IS_ERR(pcc->backlight)) - goto out_notify; + goto out_input; if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, @@ -680,9 +670,6 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) out_backlight: backlight_device_unregister(pcc->backlight); -out_notify: - acpi_remove_notify_handler(pcc->handle, ACPI_DEVICE_NOTIFY, - acpi_pcc_hotkey_notify); out_input: input_unregister_device(pcc->input_dev); /* no need to input_free_device() since core input API refcount and @@ -723,9 +710,6 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type) backlight_device_unregister(pcc->backlight); - acpi_remove_notify_handler(pcc->handle, ACPI_DEVICE_NOTIFY, - acpi_pcc_hotkey_notify); - input_unregister_device(pcc->input_dev); /* no need to input_free_device() since core input API refcount and * free()s the device */ -- cgit v1.2.3 From 8037d6e67709cf497134bbabd77b07dfc7c31fd6 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 7 Apr 2009 15:37:32 +0000 Subject: sony-laptop: use .notify method instead of installing handler directly This patch adds a .notify() method. The presence of .notify() causes Linux/ACPI to manage event handlers and notify handlers on our behalf, so we don't have to install and remove them ourselves. Signed-off-by: Bjorn Helgaas CC: Mattia Dongili Signed-off-by: Len Brown --- drivers/platform/x86/sony-laptop.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'drivers/platform/x86') diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index a90ec5cb2f2..d3c92d777bd 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -914,7 +914,7 @@ static struct sony_nc_event sony_127_events[] = { /* * ACPI callbacks */ -static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) +static void sony_nc_notify(struct acpi_device *device, u32 event) { u32 ev = event; @@ -933,7 +933,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) struct sony_nc_event *key_event; if (sony_call_snc_handle(key_handle, 0x200, &result)) { - dprintk("sony_acpi_notify, unable to decode" + dprintk("sony_nc_notify, unable to decode" " event 0x%.2x 0x%.2x\n", key_handle, ev); /* restore the original event */ @@ -968,7 +968,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) } else sony_laptop_report_input_event(ev); - dprintk("sony_acpi_notify, event: 0x%.2x\n", ev); + dprintk("sony_nc_notify, event: 0x%.2x\n", ev); acpi_bus_generate_proc_event(sony_nc_acpi_device, 1, ev); } @@ -1276,15 +1276,6 @@ static int sony_nc_add(struct acpi_device *device) goto outwalk; } - status = acpi_install_notify_handler(sony_nc_acpi_handle, - ACPI_DEVICE_NOTIFY, - sony_acpi_notify, NULL); - if (ACPI_FAILURE(status)) { - printk(KERN_WARNING DRV_PFX "unable to install notify handler (%u)\n", status); - result = -ENODEV; - goto outinput; - } - if (acpi_video_backlight_support()) { printk(KERN_INFO DRV_PFX "brightness ignored, must be " "controlled by ACPI video driver\n"); @@ -1362,13 +1353,6 @@ static int sony_nc_add(struct acpi_device *device) if (sony_backlight_device) backlight_device_unregister(sony_backlight_device); - status = acpi_remove_notify_handler(sony_nc_acpi_handle, - ACPI_DEVICE_NOTIFY, - sony_acpi_notify); - if (ACPI_FAILURE(status)) - printk(KERN_WARNING DRV_PFX "unable to remove notify handler\n"); - - outinput: sony_laptop_remove_input(); outwalk: @@ -1378,7 +1362,6 @@ static int sony_nc_add(struct acpi_device *device) static int sony_nc_remove(struct acpi_device *device, int type) { - acpi_status status; struct sony_nc_value *item; if (sony_backlight_device) @@ -1386,12 +1369,6 @@ static int sony_nc_remove(struct acpi_device *device, int type) sony_nc_acpi_device = NULL; - status = acpi_remove_notify_handler(sony_nc_acpi_handle, - ACPI_DEVICE_NOTIFY, - sony_acpi_notify); - if (ACPI_FAILURE(status)) - printk(KERN_WARNING DRV_PFX "unable to remove notify handler\n"); - for (item = sony_nc_values; item->name; ++item) { device_remove_file(&sony_pf_device->dev, &item->devattr); } @@ -1425,6 +1402,7 @@ static struct acpi_driver sony_nc_driver = { .add = sony_nc_add, .remove = sony_nc_remove, .resume = sony_nc_resume, + .notify = sony_nc_notify, }, }; -- cgit v1.2.3 From f61bb93927fbc2933abe870813daba9d331aa121 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 7 Apr 2009 15:37:37 +0000 Subject: ACPI: WMI: use .notify method instead of installing handler directly This patch adds a .notify() method. The presence of .notify() causes Linux/ACPI to manage event handlers and notify handlers on our behalf, so we don't have to install and remove them ourselves. Signed-off-by: Bjorn Helgaas CC: Carlos Corbacho Signed-off-by: Len Brown --- drivers/platform/x86/wmi.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'drivers/platform/x86') diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 2f269e117b8..043b208d971 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -81,6 +81,7 @@ static struct wmi_block wmi_blocks; static int acpi_wmi_remove(struct acpi_device *device, int type); static int acpi_wmi_add(struct acpi_device *device); +static void acpi_wmi_notify(struct acpi_device *device, u32 event); static const struct acpi_device_id wmi_device_ids[] = { {"PNP0C14", 0}, @@ -96,6 +97,7 @@ static struct acpi_driver acpi_wmi_driver = { .ops = { .add = acpi_wmi_add, .remove = acpi_wmi_remove, + .notify = acpi_wmi_notify, }, }; @@ -643,12 +645,11 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, } } -static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) +static void acpi_wmi_notify(struct acpi_device *device, u32 event) { struct guid_block *block; struct wmi_block *wblock; struct list_head *p; - struct acpi_device *device = data; list_for_each(p, &wmi_blocks.list) { wblock = list_entry(p, struct wmi_block, list); @@ -669,9 +670,6 @@ static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) static int acpi_wmi_remove(struct acpi_device *device, int type) { - acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, - acpi_wmi_notify); - acpi_remove_address_space_handler(device->handle, ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler); @@ -683,13 +681,6 @@ static int __init acpi_wmi_add(struct acpi_device *device) acpi_status status; int result = 0; - status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, - acpi_wmi_notify, device); - if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Error installing notify handler\n"); - return -ENODEV; - } - status = acpi_install_address_space_handler(device->handle, ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler, -- cgit v1.2.3