aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/button.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-05 11:16:25 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-05 11:16:25 -0700
commit32fb6c17566ec66de87324a834c7776f40e35e78 (patch)
tree87b8ed5d66495536fbb452255c3eacd1cfb0c43a /drivers/acpi/button.c
parent45e36c1666aa6c8b0c538abcf984b336184d8c3f (diff)
parent7ec0a7290797f57b780f792d12f4bcc19c83aa4f (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (140 commits) ACPI: processor: use .notify method instead of installing handler directly ACPI: button: use .notify method instead of installing handler directly ACPI: support acpi_device_ops .notify methods toshiba-acpi: remove MAINTAINERS entry ACPI: battery: asynchronous init acer-wmi: Update copyright notice & documentation acer-wmi: Cleanup the failure cleanup handling acer-wmi: Blacklist Acer Aspire One video: build fix thinkpad-acpi: rework brightness support thinkpad-acpi: enhanced debugging messages for the fan subdriver thinkpad-acpi: enhanced debugging messages for the hotkey subdriver thinkpad-acpi: enhanced debugging messages for rfkill subdrivers thinkpad-acpi: restrict access to some firmware LEDs thinkpad-acpi: remove HKEY disable functionality thinkpad-acpi: add new debug helpers and warn of deprecated atts thinkpad-acpi: add missing log levels thinkpad-acpi: cleanup debug helpers thinkpad-acpi: documentation cleanup thinkpad-acpi: drop ibm-acpi alias ...
Diffstat (limited to 'drivers/acpi/button.c')
-rw-r--r--drivers/acpi/button.c77
1 files changed, 8 insertions, 69 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index c2f06069dcd..d73c94b8441 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -78,6 +78,7 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids);
static int acpi_button_add(struct acpi_device *device);
static int acpi_button_remove(struct acpi_device *device, int type);
static int acpi_button_resume(struct acpi_device *device);
+static void acpi_button_notify(struct acpi_device *device, u32 event);
static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
@@ -89,6 +90,7 @@ static struct acpi_driver acpi_button_driver = {
.add = acpi_button_add,
.resume = acpi_button_resume,
.remove = acpi_button_remove,
+ .notify = acpi_button_notify,
},
};
@@ -263,15 +265,18 @@ static int acpi_lid_send_state(struct acpi_button *button)
return 0;
}
-static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
+static void acpi_button_notify(struct acpi_device *device, u32 event)
{
- struct acpi_button *button = data;
+ struct acpi_button *button = acpi_driver_data(device);
struct input_dev *input;
if (!button || !button->device)
return;
switch (event) {
+ case ACPI_FIXED_HARDWARE_EVENT:
+ event = ACPI_BUTTON_NOTIFY_STATUS;
+ /* fall through */
case ACPI_BUTTON_NOTIFY_STATUS:
input = button->input;
if (button->type == ACPI_BUTTON_TYPE_LID) {
@@ -298,46 +303,6 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
return;
}
-static acpi_status acpi_button_notify_fixed(void *data)
-{
- struct acpi_button *button = data;
-
- if (!button)
- return AE_BAD_PARAMETER;
-
- acpi_button_notify(button->device->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
-
- return AE_OK;
-}
-
-static int acpi_button_install_notify_handlers(struct acpi_button *button)
-{
- acpi_status status;
-
- switch (button->type) {
- case ACPI_BUTTON_TYPE_POWERF:
- status =
- acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
- acpi_button_notify_fixed,
- button);
- break;
- case ACPI_BUTTON_TYPE_SLEEPF:
- status =
- acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
- acpi_button_notify_fixed,
- button);
- break;
- default:
- status = acpi_install_notify_handler(button->device->handle,
- ACPI_DEVICE_NOTIFY,
- acpi_button_notify,
- button);
- break;
- }
-
- return ACPI_FAILURE(status) ? -ENODEV : 0;
-}
-
static int acpi_button_resume(struct acpi_device *device)
{
struct acpi_button *button;
@@ -349,25 +314,6 @@ static int acpi_button_resume(struct acpi_device *device)
return 0;
}
-static void acpi_button_remove_notify_handlers(struct acpi_button *button)
-{
- switch (button->type) {
- case ACPI_BUTTON_TYPE_POWERF:
- acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
- acpi_button_notify_fixed);
- break;
- case ACPI_BUTTON_TYPE_SLEEPF:
- acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
- acpi_button_notify_fixed);
- break;
- default:
- acpi_remove_notify_handler(button->device->handle,
- ACPI_DEVICE_NOTIFY,
- acpi_button_notify);
- break;
- }
-}
-
static int acpi_button_add(struct acpi_device *device)
{
int error;
@@ -432,10 +378,6 @@ static int acpi_button_add(struct acpi_device *device)
if (error)
goto err_free_input;
- error = acpi_button_install_notify_handlers(button);
- if (error)
- goto err_remove_fs;
-
snprintf(button->phys, sizeof(button->phys),
"%s/button/input0", acpi_device_hid(device));
@@ -466,7 +408,7 @@ static int acpi_button_add(struct acpi_device *device)
error = input_register_device(input);
if (error)
- goto err_remove_handlers;
+ goto err_remove_fs;
if (button->type == ACPI_BUTTON_TYPE_LID)
acpi_lid_send_state(button);
@@ -485,8 +427,6 @@ static int acpi_button_add(struct acpi_device *device)
return 0;
- err_remove_handlers:
- acpi_button_remove_notify_handlers(button);
err_remove_fs:
acpi_button_remove_fs(device);
err_free_input:
@@ -505,7 +445,6 @@ static int acpi_button_remove(struct acpi_device *device, int type)
button = acpi_driver_data(device);
- acpi_button_remove_notify_handlers(button);
acpi_button_remove_fs(device);
input_unregister_device(button->input);
kfree(button);