All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Hans de Goede" <hansg@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Linux ACPI" <linux-acpi@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org,
	"Pali Rohár" <pali@kernel.org>
Subject: Re: [PATCH v1 1/2] platform/x86: dell/dell-rbtn: Register ACPI notify handler directly
Date: Tue, 17 Mar 2026 19:17:23 +0200 (EET)	[thread overview]
Message-ID: <678891a6-854f-8dbd-d488-ac06f27fca61@linux.intel.com> (raw)
In-Reply-To: <2272494.irdbgypaU6@rafael.j.wysocki>

On Thu, 12 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/x86/dell/dell-rbtn.c | 50 ++++++++++++++++++---------
>  1 file changed, 33 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell/dell-rbtn.c b/drivers/platform/x86/dell/dell-rbtn.c
> index a415c432d4c3..9271b27abb46 100644
> --- a/drivers/platform/x86/dell/dell-rbtn.c
> +++ b/drivers/platform/x86/dell/dell-rbtn.c
> @@ -207,7 +207,7 @@ static void rbtn_input_event(struct rbtn_data *rbtn_data)
>  
>  static int rbtn_add(struct acpi_device *device);
>  static void rbtn_remove(struct acpi_device *device);
> -static void rbtn_notify(struct acpi_device *device, u32 event);
> +static void rbtn_notify(acpi_handle handle, u32 event, void *data);
>  
>  static const struct acpi_device_id rbtn_ids[] = {
>  	{ "DELRBTN", 0 },
> @@ -293,7 +293,6 @@ static struct acpi_driver rbtn_driver = {
>  	.ops = {
>  		.add = rbtn_add,
>  		.remove = rbtn_remove,
> -		.notify = rbtn_notify,
>  	},
>  };
>  
> @@ -382,6 +381,22 @@ EXPORT_SYMBOL_GPL(dell_rbtn_notifier_unregister);
>   * acpi driver functions
>   */
>  
> +static void rbtn_cleanup(struct acpi_device *device)
> +{
> +	struct rbtn_data *rbtn_data = device->driver_data;
> +
> +	switch (rbtn_data->type) {
> +	case RBTN_TOGGLE:
> +		rbtn_input_exit(rbtn_data);
> +		break;
> +	case RBTN_SLIDER:
> +		rbtn_rfkill_exit(device);
> +		break;
> +	default:
> +		break;
> +	}
> +}
> +
>  static int rbtn_add(struct acpi_device *device)
>  {
>  	struct rbtn_data *rbtn_data;
> @@ -422,31 +437,32 @@ static int rbtn_add(struct acpi_device *device)
>  		break;
>  	}
>  	if (ret)
> -		rbtn_acquire(device, false);
> +		goto err;
> +
> +	ret = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
> +					      rbtn_notify, device);
> +	if (ret) {
> +		rbtn_cleanup(device);

If you add(/have) a rollback path, please put all rollbacks there unless 
there is a good reason not to (making a setup call that makes the rollback 
non-linear).

-- 
 i.


> +		goto err;
> +	}
>  
> +	return 0;
> +
> +err:
> +	rbtn_acquire(device, false);
>  	return ret;
>  }
>  
>  static void rbtn_remove(struct acpi_device *device)
>  {
> -	struct rbtn_data *rbtn_data = device->driver_data;
> -
> -	switch (rbtn_data->type) {
> -	case RBTN_TOGGLE:
> -		rbtn_input_exit(rbtn_data);
> -		break;
> -	case RBTN_SLIDER:
> -		rbtn_rfkill_exit(device);
> -		break;
> -	default:
> -		break;
> -	}
> -
> +	acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY, rbtn_notify);
> +	rbtn_cleanup(device);
>  	rbtn_acquire(device, false);
>  }
>  
> -static void rbtn_notify(struct acpi_device *device, u32 event)
> +static void rbtn_notify(acpi_handle handle, u32 event, void *data)
>  {
> +	struct acpi_device *device = data;
>  	struct rbtn_data *rbtn_data = device->driver_data;
>  
>  	/*
> 

  reply	other threads:[~2026-03-17 17:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 11:01 [PATCH v1 0/2] platform/x86: dell/dell-rbtn: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
2026-03-12 11:02 ` [PATCH v1 1/2] platform/x86: dell/dell-rbtn: Register ACPI notify handler directly Rafael J. Wysocki
2026-03-17 17:17   ` Ilpo Järvinen [this message]
2026-03-12 11:05 ` [PATCH v1 2/2] platform/x86: dell/dell-rbtn: Convert ACPI driver to a platform one Rafael J. Wysocki

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=678891a6-854f-8dbd-d488-ac06f27fca61@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=pali@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.