[PATCH v1 3/4] platform/x86: xo15-ebook: Register ACPI notify handler directly

Rafael J. Wysocki posted 1 patch 1 month ago
drivers/platform/x86/xo15-ebook.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
[PATCH v1 3/4] platform/x86: xo15-ebook: Register ACPI notify handler directly
Posted by Rafael J. Wysocki 1 month ago
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

To facilitate subsequent conversion of the driver to a platform one,
make it install an ACPI notify handler directly instead of using
a .notify() callback in struct acpi_driver.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/xo15-ebook.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
index 616f4bb3461a..8af1b9078db8 100644
--- a/drivers/platform/x86/xo15-ebook.c
+++ b/drivers/platform/x86/xo15-ebook.c
@@ -57,16 +57,15 @@ static int ebook_send_state(struct acpi_device *device)
 	return 0;
 }
 
-static void ebook_switch_notify(struct acpi_device *device, u32 event)
+static void ebook_switch_notify(acpi_handle handle, u32 event, void *data)
 {
 	switch (event) {
 	case ACPI_FIXED_HARDWARE_EVENT:
 	case XO15_EBOOK_NOTIFY_STATUS:
-		ebook_send_state(device);
+		ebook_send_state(data);
 		break;
 	default:
-		acpi_handle_debug(device->handle,
-				  "Unsupported event [0x%x]\n", event);
+		acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
 		break;
 	}
 }
@@ -123,6 +122,11 @@ static int ebook_switch_add(struct acpi_device *device)
 	if (error)
 		goto err_free_input;
 
+	error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
+						ebook_switch_notify, device);
+	if (error)
+		goto err_unregister_input;
+
 	ebook_send_state(device);
 
 	if (device->wakeup.flags.valid) {
@@ -139,6 +143,10 @@ static int ebook_switch_add(struct acpi_device *device)
 err_free_button:
 	kfree(button);
 	return error;
+
+err_unregister_input:
+	input_unregister_device(input);
+	goto err_free_button;
 }
 
 static void ebook_switch_remove(struct acpi_device *device)
@@ -149,6 +157,8 @@ static void ebook_switch_remove(struct acpi_device *device)
 		acpi_disable_gpe(device->wakeup.gpe_device,
 				 device->wakeup.gpe_number);
 
+	acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
+				       ebook_switch_notify);
 	input_unregister_device(button->input);
 	kfree(button);
 }
@@ -160,7 +170,6 @@ static struct acpi_driver xo15_ebook_driver = {
 	.ops = {
 		.add = ebook_switch_add,
 		.remove = ebook_switch_remove,
-		.notify = ebook_switch_notify,
 	},
 	.drv.pm = &ebook_switch_pm,
 };
Re: [PATCH v1 3/4] platform/x86: xo15-ebook: Register ACPI notify handler directly
Posted by Ilpo Järvinen 1 month ago
On Fri, 8 May 2026, Rafael J. Wysocki wrote:

> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> 
> To facilitate subsequent conversion of the driver to a platform one,
> make it install an ACPI notify handler directly instead of using
> a .notify() callback in struct acpi_driver.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/platform/x86/xo15-ebook.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
> index 616f4bb3461a..8af1b9078db8 100644
> --- a/drivers/platform/x86/xo15-ebook.c
> +++ b/drivers/platform/x86/xo15-ebook.c
> @@ -57,16 +57,15 @@ static int ebook_send_state(struct acpi_device *device)
>  	return 0;
>  }
>  
> -static void ebook_switch_notify(struct acpi_device *device, u32 event)
> +static void ebook_switch_notify(acpi_handle handle, u32 event, void *data)
>  {
>  	switch (event) {
>  	case ACPI_FIXED_HARDWARE_EVENT:
>  	case XO15_EBOOK_NOTIFY_STATUS:
> -		ebook_send_state(device);
> +		ebook_send_state(data);
>  		break;
>  	default:
> -		acpi_handle_debug(device->handle,
> -				  "Unsupported event [0x%x]\n", event);
> +		acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
>  		break;
>  	}
>  }
> @@ -123,6 +122,11 @@ static int ebook_switch_add(struct acpi_device *device)
>  	if (error)
>  		goto err_free_input;
>  
> +	error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
> +						ebook_switch_notify, device);
> +	if (error)
> +		goto err_unregister_input;
> +
>  	ebook_send_state(device);
>  
>  	if (device->wakeup.flags.valid) {
> @@ -139,6 +143,10 @@ static int ebook_switch_add(struct acpi_device *device)
>  err_free_button:
>  	kfree(button);
>  	return error;
> +
> +err_unregister_input:
> +	input_unregister_device(input);
> +	goto err_free_button;

The end result would be much simpler if there would be patch 5 to convert 
to devm_*().

>  }
>  
>  static void ebook_switch_remove(struct acpi_device *device)
> @@ -149,6 +157,8 @@ static void ebook_switch_remove(struct acpi_device *device)
>  		acpi_disable_gpe(device->wakeup.gpe_device,
>  				 device->wakeup.gpe_number);
>  
> +	acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
> +				       ebook_switch_notify);
>  	input_unregister_device(button->input);
>  	kfree(button);
>  }
> @@ -160,7 +170,6 @@ static struct acpi_driver xo15_ebook_driver = {
>  	.ops = {
>  		.add = ebook_switch_add,
>  		.remove = ebook_switch_remove,
> -		.notify = ebook_switch_notify,
>  	},
>  	.drv.pm = &ebook_switch_pm,
>  };
> 
> 
> 

-- 
 i.
Re: [PATCH v1 3/4] platform/x86: xo15-ebook: Register ACPI notify handler directly
Posted by Rafael J. Wysocki 1 month ago
On Mon, May 11, 2026 at 3:59 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> On Fri, 8 May 2026, Rafael J. Wysocki wrote:
>
> > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> >
> > To facilitate subsequent conversion of the driver to a platform one,
> > make it install an ACPI notify handler directly instead of using
> > a .notify() callback in struct acpi_driver.
> >
> > No intentional functional impact.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >  drivers/platform/x86/xo15-ebook.c | 19 ++++++++++++++-----
> >  1 file changed, 14 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
> > index 616f4bb3461a..8af1b9078db8 100644
> > --- a/drivers/platform/x86/xo15-ebook.c
> > +++ b/drivers/platform/x86/xo15-ebook.c
> > @@ -57,16 +57,15 @@ static int ebook_send_state(struct acpi_device *device)
> >       return 0;
> >  }
> >
> > -static void ebook_switch_notify(struct acpi_device *device, u32 event)
> > +static void ebook_switch_notify(acpi_handle handle, u32 event, void *data)
> >  {
> >       switch (event) {
> >       case ACPI_FIXED_HARDWARE_EVENT:
> >       case XO15_EBOOK_NOTIFY_STATUS:
> > -             ebook_send_state(device);
> > +             ebook_send_state(data);
> >               break;
> >       default:
> > -             acpi_handle_debug(device->handle,
> > -                               "Unsupported event [0x%x]\n", event);
> > +             acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
> >               break;
> >       }
> >  }
> > @@ -123,6 +122,11 @@ static int ebook_switch_add(struct acpi_device *device)
> >       if (error)
> >               goto err_free_input;
> >
> > +     error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
> > +                                             ebook_switch_notify, device);
> > +     if (error)
> > +             goto err_unregister_input;
> > +
> >       ebook_send_state(device);
> >
> >       if (device->wakeup.flags.valid) {
> > @@ -139,6 +143,10 @@ static int ebook_switch_add(struct acpi_device *device)
> >  err_free_button:
> >       kfree(button);
> >       return error;
> > +
> > +err_unregister_input:
> > +     input_unregister_device(input);
> > +     goto err_free_button;
>
> The end result would be much simpler if there would be patch 5 to convert
> to devm_*().

Well, I can add one.

Do you want me to resend an update of the series for this?

> >  }
> >
> >  static void ebook_switch_remove(struct acpi_device *device)
> > @@ -149,6 +157,8 @@ static void ebook_switch_remove(struct acpi_device *device)
> >               acpi_disable_gpe(device->wakeup.gpe_device,
> >                                device->wakeup.gpe_number);
> >
> > +     acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
> > +                                    ebook_switch_notify);
> >       input_unregister_device(button->input);
> >       kfree(button);
> >  }
> > @@ -160,7 +170,6 @@ static struct acpi_driver xo15_ebook_driver = {
> >       .ops = {
> >               .add = ebook_switch_add,
> >               .remove = ebook_switch_remove,
> > -             .notify = ebook_switch_notify,
> >       },
> >       .drv.pm = &ebook_switch_pm,
> >  };
> >
> >
> >
>
> --
Re: [PATCH v1 3/4] platform/x86: xo15-ebook: Register ACPI notify handler directly
Posted by Ilpo Järvinen 1 month ago
On Mon, 11 May 2026, Rafael J. Wysocki wrote:

> On Mon, May 11, 2026 at 3:59 PM Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> wrote:
> >
> > On Fri, 8 May 2026, Rafael J. Wysocki wrote:
> >
> > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> > >
> > > To facilitate subsequent conversion of the driver to a platform one,
> > > make it install an ACPI notify handler directly instead of using
> > > a .notify() callback in struct acpi_driver.
> > >
> > > No intentional functional impact.
> > >
> > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > ---
> > >  drivers/platform/x86/xo15-ebook.c | 19 ++++++++++++++-----
> > >  1 file changed, 14 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
> > > index 616f4bb3461a..8af1b9078db8 100644
> > > --- a/drivers/platform/x86/xo15-ebook.c
> > > +++ b/drivers/platform/x86/xo15-ebook.c
> > > @@ -57,16 +57,15 @@ static int ebook_send_state(struct acpi_device *device)
> > >       return 0;
> > >  }
> > >
> > > -static void ebook_switch_notify(struct acpi_device *device, u32 event)
> > > +static void ebook_switch_notify(acpi_handle handle, u32 event, void *data)
> > >  {
> > >       switch (event) {
> > >       case ACPI_FIXED_HARDWARE_EVENT:
> > >       case XO15_EBOOK_NOTIFY_STATUS:
> > > -             ebook_send_state(device);
> > > +             ebook_send_state(data);
> > >               break;
> > >       default:
> > > -             acpi_handle_debug(device->handle,
> > > -                               "Unsupported event [0x%x]\n", event);
> > > +             acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
> > >               break;
> > >       }
> > >  }
> > > @@ -123,6 +122,11 @@ static int ebook_switch_add(struct acpi_device *device)
> > >       if (error)
> > >               goto err_free_input;
> > >
> > > +     error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
> > > +                                             ebook_switch_notify, device);
> > > +     if (error)
> > > +             goto err_unregister_input;
> > > +
> > >       ebook_send_state(device);
> > >
> > >       if (device->wakeup.flags.valid) {
> > > @@ -139,6 +143,10 @@ static int ebook_switch_add(struct acpi_device *device)
> > >  err_free_button:
> > >       kfree(button);
> > >       return error;
> > > +
> > > +err_unregister_input:
> > > +     input_unregister_device(input);
> > > +     goto err_free_button;
> >
> > The end result would be much simpler if there would be patch 5 to convert
> > to devm_*().
> 
> Well, I can add one.
> 
> Do you want me to resend an update of the series for this?

Ah, right. I took these now to review-ilpo-next.

(I was initially thinking of making a little bit different suggestion 
which would have required changes to these patches but then realized it 
was better to just add the devm_*() conversion after these).

-- 
 i.
Re: [PATCH v1 3/4] platform/x86: xo15-ebook: Register ACPI notify handler directly
Posted by Rafael J. Wysocki 1 month ago
On Mon, May 11, 2026 at 6:17 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> On Mon, 11 May 2026, Rafael J. Wysocki wrote:
>
> > On Mon, May 11, 2026 at 3:59 PM Ilpo Järvinen
> > <ilpo.jarvinen@linux.intel.com> wrote:
> > >
> > > On Fri, 8 May 2026, Rafael J. Wysocki wrote:
> > >
> > > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> > > >
> > > > To facilitate subsequent conversion of the driver to a platform one,
> > > > make it install an ACPI notify handler directly instead of using
> > > > a .notify() callback in struct acpi_driver.
> > > >
> > > > No intentional functional impact.
> > > >
> > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > > ---
> > > >  drivers/platform/x86/xo15-ebook.c | 19 ++++++++++++++-----
> > > >  1 file changed, 14 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
> > > > index 616f4bb3461a..8af1b9078db8 100644
> > > > --- a/drivers/platform/x86/xo15-ebook.c
> > > > +++ b/drivers/platform/x86/xo15-ebook.c
> > > > @@ -57,16 +57,15 @@ static int ebook_send_state(struct acpi_device *device)
> > > >       return 0;
> > > >  }
> > > >
> > > > -static void ebook_switch_notify(struct acpi_device *device, u32 event)
> > > > +static void ebook_switch_notify(acpi_handle handle, u32 event, void *data)
> > > >  {
> > > >       switch (event) {
> > > >       case ACPI_FIXED_HARDWARE_EVENT:
> > > >       case XO15_EBOOK_NOTIFY_STATUS:
> > > > -             ebook_send_state(device);
> > > > +             ebook_send_state(data);
> > > >               break;
> > > >       default:
> > > > -             acpi_handle_debug(device->handle,
> > > > -                               "Unsupported event [0x%x]\n", event);
> > > > +             acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
> > > >               break;
> > > >       }
> > > >  }
> > > > @@ -123,6 +122,11 @@ static int ebook_switch_add(struct acpi_device *device)
> > > >       if (error)
> > > >               goto err_free_input;
> > > >
> > > > +     error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
> > > > +                                             ebook_switch_notify, device);
> > > > +     if (error)
> > > > +             goto err_unregister_input;
> > > > +
> > > >       ebook_send_state(device);
> > > >
> > > >       if (device->wakeup.flags.valid) {
> > > > @@ -139,6 +143,10 @@ static int ebook_switch_add(struct acpi_device *device)
> > > >  err_free_button:
> > > >       kfree(button);
> > > >       return error;
> > > > +
> > > > +err_unregister_input:
> > > > +     input_unregister_device(input);
> > > > +     goto err_free_button;
> > >
> > > The end result would be much simpler if there would be patch 5 to convert
> > > to devm_*().
> >
> > Well, I can add one.
> >
> > Do you want me to resend an update of the series for this?
>
> Ah, right. I took these now to review-ilpo-next.
>
> (I was initially thinking of making a little bit different suggestion
> which would have required changes to these patches but then realized it
> was better to just add the devm_*() conversion after these).

So I guess I'll prepare a follow-up patch for the devm_ conversion.

Note though that there's no devm_ counterpart of
acpi_dev_install_notify_handler() ATM, so I may need to add one while
at it.
Re: [PATCH v1 3/4] platform/x86: xo15-ebook: Register ACPI notify handler directly
Posted by Ilpo Järvinen 1 month ago
On Mon, 11 May 2026, Rafael J. Wysocki wrote:

> On Mon, May 11, 2026 at 6:17 PM Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> wrote:
> >
> > On Mon, 11 May 2026, Rafael J. Wysocki wrote:
> >
> > > On Mon, May 11, 2026 at 3:59 PM Ilpo Järvinen
> > > <ilpo.jarvinen@linux.intel.com> wrote:
> > > >
> > > > On Fri, 8 May 2026, Rafael J. Wysocki wrote:
> > > >
> > > > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> > > > >
> > > > > To facilitate subsequent conversion of the driver to a platform one,
> > > > > make it install an ACPI notify handler directly instead of using
> > > > > a .notify() callback in struct acpi_driver.
> > > > >
> > > > > No intentional functional impact.
> > > > >
> > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > > > ---
> > > > >  drivers/platform/x86/xo15-ebook.c | 19 ++++++++++++++-----
> > > > >  1 file changed, 14 insertions(+), 5 deletions(-)
> > > > >
> > > > > diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
> > > > > index 616f4bb3461a..8af1b9078db8 100644
> > > > > --- a/drivers/platform/x86/xo15-ebook.c
> > > > > +++ b/drivers/platform/x86/xo15-ebook.c
> > > > > @@ -57,16 +57,15 @@ static int ebook_send_state(struct acpi_device *device)
> > > > >       return 0;
> > > > >  }
> > > > >
> > > > > -static void ebook_switch_notify(struct acpi_device *device, u32 event)
> > > > > +static void ebook_switch_notify(acpi_handle handle, u32 event, void *data)
> > > > >  {
> > > > >       switch (event) {
> > > > >       case ACPI_FIXED_HARDWARE_EVENT:
> > > > >       case XO15_EBOOK_NOTIFY_STATUS:
> > > > > -             ebook_send_state(device);
> > > > > +             ebook_send_state(data);
> > > > >               break;
> > > > >       default:
> > > > > -             acpi_handle_debug(device->handle,
> > > > > -                               "Unsupported event [0x%x]\n", event);
> > > > > +             acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
> > > > >               break;
> > > > >       }
> > > > >  }
> > > > > @@ -123,6 +122,11 @@ static int ebook_switch_add(struct acpi_device *device)
> > > > >       if (error)
> > > > >               goto err_free_input;
> > > > >
> > > > > +     error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
> > > > > +                                             ebook_switch_notify, device);
> > > > > +     if (error)
> > > > > +             goto err_unregister_input;
> > > > > +
> > > > >       ebook_send_state(device);
> > > > >
> > > > >       if (device->wakeup.flags.valid) {
> > > > > @@ -139,6 +143,10 @@ static int ebook_switch_add(struct acpi_device *device)
> > > > >  err_free_button:
> > > > >       kfree(button);
> > > > >       return error;
> > > > > +
> > > > > +err_unregister_input:
> > > > > +     input_unregister_device(input);
> > > > > +     goto err_free_button;
> > > >
> > > > The end result would be much simpler if there would be patch 5 to convert
> > > > to devm_*().
> > >
> > > Well, I can add one.
> > >
> > > Do you want me to resend an update of the series for this?
> >
> > Ah, right. I took these now to review-ilpo-next.
> >
> > (I was initially thinking of making a little bit different suggestion
> > which would have required changes to these patches but then realized it
> > was better to just add the devm_*() conversion after these).
> 
> So I guess I'll prepare a follow-up patch for the devm_ conversion.
> 
> Note though that there's no devm_ counterpart of
> acpi_dev_install_notify_handler() ATM, so I may need to add one while
> at it.

While adding it will be able to remove acpi_dev_remove_notify_handler() 
call from ebook_switch_remove(), there's no such call in rollbacks for 
ebook_switch_probe() so it wouldn't be strictly required.

But it certainly wouldn't hurt to have one for other drivers.

-- 
 i.
Re: [PATCH v1 3/4] platform/x86: xo15-ebook: Register ACPI notify handler directly
Posted by Rafael J. Wysocki 1 month ago
On Mon, May 11, 2026 at 6:44 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> On Mon, 11 May 2026, Rafael J. Wysocki wrote:
>
> > On Mon, May 11, 2026 at 6:17 PM Ilpo Järvinen
> > <ilpo.jarvinen@linux.intel.com> wrote:
> > >
> > > On Mon, 11 May 2026, Rafael J. Wysocki wrote:
> > >
> > > > On Mon, May 11, 2026 at 3:59 PM Ilpo Järvinen
> > > > <ilpo.jarvinen@linux.intel.com> wrote:
> > > > >
> > > > > On Fri, 8 May 2026, Rafael J. Wysocki wrote:
> > > > >
> > > > > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> > > > > >
> > > > > > To facilitate subsequent conversion of the driver to a platform one,
> > > > > > make it install an ACPI notify handler directly instead of using
> > > > > > a .notify() callback in struct acpi_driver.
> > > > > >
> > > > > > No intentional functional impact.
> > > > > >
> > > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > > > > ---
> > > > > >  drivers/platform/x86/xo15-ebook.c | 19 ++++++++++++++-----
> > > > > >  1 file changed, 14 insertions(+), 5 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
> > > > > > index 616f4bb3461a..8af1b9078db8 100644
> > > > > > --- a/drivers/platform/x86/xo15-ebook.c
> > > > > > +++ b/drivers/platform/x86/xo15-ebook.c
> > > > > > @@ -57,16 +57,15 @@ static int ebook_send_state(struct acpi_device *device)
> > > > > >       return 0;
> > > > > >  }
> > > > > >
> > > > > > -static void ebook_switch_notify(struct acpi_device *device, u32 event)
> > > > > > +static void ebook_switch_notify(acpi_handle handle, u32 event, void *data)
> > > > > >  {
> > > > > >       switch (event) {
> > > > > >       case ACPI_FIXED_HARDWARE_EVENT:
> > > > > >       case XO15_EBOOK_NOTIFY_STATUS:
> > > > > > -             ebook_send_state(device);
> > > > > > +             ebook_send_state(data);
> > > > > >               break;
> > > > > >       default:
> > > > > > -             acpi_handle_debug(device->handle,
> > > > > > -                               "Unsupported event [0x%x]\n", event);
> > > > > > +             acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
> > > > > >               break;
> > > > > >       }
> > > > > >  }
> > > > > > @@ -123,6 +122,11 @@ static int ebook_switch_add(struct acpi_device *device)
> > > > > >       if (error)
> > > > > >               goto err_free_input;
> > > > > >
> > > > > > +     error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
> > > > > > +                                             ebook_switch_notify, device);
> > > > > > +     if (error)
> > > > > > +             goto err_unregister_input;
> > > > > > +
> > > > > >       ebook_send_state(device);
> > > > > >
> > > > > >       if (device->wakeup.flags.valid) {
> > > > > > @@ -139,6 +143,10 @@ static int ebook_switch_add(struct acpi_device *device)
> > > > > >  err_free_button:
> > > > > >       kfree(button);
> > > > > >       return error;
> > > > > > +
> > > > > > +err_unregister_input:
> > > > > > +     input_unregister_device(input);
> > > > > > +     goto err_free_button;
> > > > >
> > > > > The end result would be much simpler if there would be patch 5 to convert
> > > > > to devm_*().
> > > >
> > > > Well, I can add one.
> > > >
> > > > Do you want me to resend an update of the series for this?
> > >
> > > Ah, right. I took these now to review-ilpo-next.
> > >
> > > (I was initially thinking of making a little bit different suggestion
> > > which would have required changes to these patches but then realized it
> > > was better to just add the devm_*() conversion after these).
> >
> > So I guess I'll prepare a follow-up patch for the devm_ conversion.
> >
> > Note though that there's no devm_ counterpart of
> > acpi_dev_install_notify_handler() ATM, so I may need to add one while
> > at it.
>
> While adding it will be able to remove acpi_dev_remove_notify_handler()
> call from ebook_switch_remove(), there's no such call in rollbacks for
> ebook_switch_probe() so it wouldn't be strictly required.

Right.

> But it certainly wouldn't hurt to have one for other drivers.

Sure, I definitely have a plan to add one.