mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 22:50:41 +00:00
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>
This commit is contained in:
parent
cddd1f71d9
commit
8037d6e677
@ -914,7 +914,7 @@ static struct sony_nc_event sony_127_events[] = {
|
|||||||
/*
|
/*
|
||||||
* ACPI callbacks
|
* 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;
|
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;
|
struct sony_nc_event *key_event;
|
||||||
|
|
||||||
if (sony_call_snc_handle(key_handle, 0x200, &result)) {
|
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,
|
" event 0x%.2x 0x%.2x\n", key_handle,
|
||||||
ev);
|
ev);
|
||||||
/* restore the original event */
|
/* restore the original event */
|
||||||
@ -968,7 +968,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
|
|||||||
} else
|
} else
|
||||||
sony_laptop_report_input_event(ev);
|
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);
|
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;
|
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()) {
|
if (acpi_video_backlight_support()) {
|
||||||
printk(KERN_INFO DRV_PFX "brightness ignored, must be "
|
printk(KERN_INFO DRV_PFX "brightness ignored, must be "
|
||||||
"controlled by ACPI video driver\n");
|
"controlled by ACPI video driver\n");
|
||||||
@ -1362,13 +1353,6 @@ static int sony_nc_add(struct acpi_device *device)
|
|||||||
if (sony_backlight_device)
|
if (sony_backlight_device)
|
||||||
backlight_device_unregister(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();
|
sony_laptop_remove_input();
|
||||||
|
|
||||||
outwalk:
|
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)
|
static int sony_nc_remove(struct acpi_device *device, int type)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
|
||||||
struct sony_nc_value *item;
|
struct sony_nc_value *item;
|
||||||
|
|
||||||
if (sony_backlight_device)
|
if (sony_backlight_device)
|
||||||
@ -1386,12 +1369,6 @@ static int sony_nc_remove(struct acpi_device *device, int type)
|
|||||||
|
|
||||||
sony_nc_acpi_device = NULL;
|
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) {
|
for (item = sony_nc_values; item->name; ++item) {
|
||||||
device_remove_file(&sony_pf_device->dev, &item->devattr);
|
device_remove_file(&sony_pf_device->dev, &item->devattr);
|
||||||
}
|
}
|
||||||
@ -1425,6 +1402,7 @@ static struct acpi_driver sony_nc_driver = {
|
|||||||
.add = sony_nc_add,
|
.add = sony_nc_add,
|
||||||
.remove = sony_nc_remove,
|
.remove = sony_nc_remove,
|
||||||
.resume = sony_nc_resume,
|
.resume = sony_nc_resume,
|
||||||
|
.notify = sony_nc_notify,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user