diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-04-07 11:37:32 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-07 16:26:58 -0400 |
commit | 8037d6e67709cf497134bbabd77b07dfc7c31fd6 (patch) | |
tree | c0fd82ab4c28adf57237c1fec348f36c3b35bd38 /drivers/platform | |
parent | cddd1f71d972a43c88f0ef91e1b71023539cd6e0 (diff) |
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 <bjorn.helgaas@hp.com>
CC: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index a90ec5cb2f20..d3c92d777bde 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[] = { | |||
914 | /* | 914 | /* |
915 | * ACPI callbacks | 915 | * ACPI callbacks |
916 | */ | 916 | */ |
917 | static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | 917 | static void sony_nc_notify(struct acpi_device *device, u32 event) |
918 | { | 918 | { |
919 | u32 ev = event; | 919 | u32 ev = event; |
920 | 920 | ||
@@ -933,7 +933,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | |||
933 | struct sony_nc_event *key_event; | 933 | struct sony_nc_event *key_event; |
934 | 934 | ||
935 | if (sony_call_snc_handle(key_handle, 0x200, &result)) { | 935 | if (sony_call_snc_handle(key_handle, 0x200, &result)) { |
936 | dprintk("sony_acpi_notify, unable to decode" | 936 | dprintk("sony_nc_notify, unable to decode" |
937 | " event 0x%.2x 0x%.2x\n", key_handle, | 937 | " event 0x%.2x 0x%.2x\n", key_handle, |
938 | ev); | 938 | ev); |
939 | /* restore the original event */ | 939 | /* restore the original event */ |
@@ -968,7 +968,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | |||
968 | } else | 968 | } else |
969 | sony_laptop_report_input_event(ev); | 969 | sony_laptop_report_input_event(ev); |
970 | 970 | ||
971 | dprintk("sony_acpi_notify, event: 0x%.2x\n", ev); | 971 | dprintk("sony_nc_notify, event: 0x%.2x\n", ev); |
972 | acpi_bus_generate_proc_event(sony_nc_acpi_device, 1, ev); | 972 | acpi_bus_generate_proc_event(sony_nc_acpi_device, 1, ev); |
973 | } | 973 | } |
974 | 974 | ||
@@ -1276,15 +1276,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
1276 | goto outwalk; | 1276 | goto outwalk; |
1277 | } | 1277 | } |
1278 | 1278 | ||
1279 | status = acpi_install_notify_handler(sony_nc_acpi_handle, | ||
1280 | ACPI_DEVICE_NOTIFY, | ||
1281 | sony_acpi_notify, NULL); | ||
1282 | if (ACPI_FAILURE(status)) { | ||
1283 | printk(KERN_WARNING DRV_PFX "unable to install notify handler (%u)\n", status); | ||
1284 | result = -ENODEV; | ||
1285 | goto outinput; | ||
1286 | } | ||
1287 | |||
1288 | if (acpi_video_backlight_support()) { | 1279 | if (acpi_video_backlight_support()) { |
1289 | printk(KERN_INFO DRV_PFX "brightness ignored, must be " | 1280 | printk(KERN_INFO DRV_PFX "brightness ignored, must be " |
1290 | "controlled by ACPI video driver\n"); | 1281 | "controlled by ACPI video driver\n"); |
@@ -1362,13 +1353,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
1362 | if (sony_backlight_device) | 1353 | if (sony_backlight_device) |
1363 | backlight_device_unregister(sony_backlight_device); | 1354 | backlight_device_unregister(sony_backlight_device); |
1364 | 1355 | ||
1365 | status = acpi_remove_notify_handler(sony_nc_acpi_handle, | ||
1366 | ACPI_DEVICE_NOTIFY, | ||
1367 | sony_acpi_notify); | ||
1368 | if (ACPI_FAILURE(status)) | ||
1369 | printk(KERN_WARNING DRV_PFX "unable to remove notify handler\n"); | ||
1370 | |||
1371 | outinput: | ||
1372 | sony_laptop_remove_input(); | 1356 | sony_laptop_remove_input(); |
1373 | 1357 | ||
1374 | outwalk: | 1358 | outwalk: |
@@ -1378,7 +1362,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
1378 | 1362 | ||
1379 | static int sony_nc_remove(struct acpi_device *device, int type) | 1363 | static int sony_nc_remove(struct acpi_device *device, int type) |
1380 | { | 1364 | { |
1381 | acpi_status status; | ||
1382 | struct sony_nc_value *item; | 1365 | struct sony_nc_value *item; |
1383 | 1366 | ||
1384 | if (sony_backlight_device) | 1367 | if (sony_backlight_device) |
@@ -1386,12 +1369,6 @@ static int sony_nc_remove(struct acpi_device *device, int type) | |||
1386 | 1369 | ||
1387 | sony_nc_acpi_device = NULL; | 1370 | sony_nc_acpi_device = NULL; |
1388 | 1371 | ||
1389 | status = acpi_remove_notify_handler(sony_nc_acpi_handle, | ||
1390 | ACPI_DEVICE_NOTIFY, | ||
1391 | sony_acpi_notify); | ||
1392 | if (ACPI_FAILURE(status)) | ||
1393 | printk(KERN_WARNING DRV_PFX "unable to remove notify handler\n"); | ||
1394 | |||
1395 | for (item = sony_nc_values; item->name; ++item) { | 1372 | for (item = sony_nc_values; item->name; ++item) { |
1396 | device_remove_file(&sony_pf_device->dev, &item->devattr); | 1373 | device_remove_file(&sony_pf_device->dev, &item->devattr); |
1397 | } | 1374 | } |
@@ -1425,6 +1402,7 @@ static struct acpi_driver sony_nc_driver = { | |||
1425 | .add = sony_nc_add, | 1402 | .add = sony_nc_add, |
1426 | .remove = sony_nc_remove, | 1403 | .remove = sony_nc_remove, |
1427 | .resume = sony_nc_resume, | 1404 | .resume = sony_nc_resume, |
1405 | .notify = sony_nc_notify, | ||
1428 | }, | 1406 | }, |
1429 | }; | 1407 | }; |
1430 | 1408 | ||