public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	 Linux ACPI <linux-acpi@vger.kernel.org>,
	Hans de Goede <hansg@kernel.org>,
	 Maximilian Luz <luzmaximilian@gmail.com>,
	 platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v1 2/3] platform/surface: surfacepro3_button: Register ACPI notify handler
Date: Mon, 9 Mar 2026 16:08:19 +0200 (EET)	[thread overview]
Message-ID: <25a550e1-bbe9-00b6-a2c6-836d96a9bdc7@linux.intel.com> (raw)
In-Reply-To: <461da326-7a86-552e-4d2e-9b7730bc1699@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2633 bytes --]

On Mon, 9 Mar 2026, Ilpo Järvinen wrote:

> On Wed, 4 Mar 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/surface/surfacepro3_button.c | 15 +++++++++++++--
> >  1 file changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c
> > index a6c9d4d370be..6d394daf5bc4 100644
> > --- a/drivers/platform/surface/surfacepro3_button.c
> > +++ b/drivers/platform/surface/surfacepro3_button.c
> > @@ -72,8 +72,9 @@ struct surface_button {
> >  	bool suspended;
> >  };
> >  
> > -static void surface_button_notify(struct acpi_device *device, u32 event)
> > +static void surface_button_notify(acpi_handle handle, u32 event, void *data)
> >  {
> > +	struct acpi_device *device = data;
> >  	struct surface_button *button = acpi_driver_data(device);
> >  	struct input_dev *input;
> >  	int key_code = KEY_RESERVED;
> > @@ -227,6 +228,15 @@ static int surface_button_add(struct acpi_device *device)
> >  		goto err_free_input;
> >  
> >  	device_init_wakeup(&device->dev, true);
> > +
> > +	error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
> > +						surface_button_notify, device);
> > +	if (error) {
> > +		device_init_wakeup(&device->dev, false);
> > +		input_unregister_device(input);
> 
> Add a new label to rollback path instead.

Nevermind.

-- 
 i.

> > +		goto err_free_button;
> > +	}
> > +
> >  	dev_info(&device->dev, "%s [%s]\n", acpi_device_name(device),
> >  		 acpi_device_bid(device));
> >  	return 0;
> > @@ -242,6 +252,8 @@ static void surface_button_remove(struct acpi_device *device)
> >  {
> >  	struct surface_button *button = acpi_driver_data(device);
> >  
> > +	acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
> > +				       surface_button_notify);
> >  	device_init_wakeup(&device->dev, false);
> >  	input_unregister_device(button->input);
> >  	kfree(button);
> > @@ -257,7 +269,6 @@ static struct acpi_driver surface_button_driver = {
> >  	.ops = {
> >  		.add = surface_button_add,
> >  		.remove = surface_button_remove,
> > -		.notify = surface_button_notify,
> >  	},
> >  	.drv.pm = &surface_button_pm,
> >  };
> > 
> 
> 

  reply	other threads:[~2026-03-09 14:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 18:53 [PATCH v1 0/3] platform/surface: surfacepro3_button: Use platform device for driver binding Rafael J. Wysocki
2026-03-04 18:54 ` [PATCH v1 1/3] platform/surface: surfacepro3_button: Drop wakeup source on remove Rafael J. Wysocki
2026-03-04 18:54 ` [PATCH v1 2/3] platform/surface: surfacepro3_button: Register ACPI notify handler Rafael J. Wysocki
2026-03-09 14:07   ` Ilpo Järvinen
2026-03-09 14:08     ` Ilpo Järvinen [this message]
2026-03-04 18:55 ` [PATCH v1 3/3] platform/surface: surfacepro3_button: Convert to a platform driver Rafael J. Wysocki
2026-03-09 14:58 ` [PATCH v1 0/3] platform/surface: surfacepro3_button: Use platform device for driver binding Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25a550e1-bbe9-00b6-a2c6-836d96a9bdc7@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hansg@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox