public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Wilczynski, Michal" <michal.wilczynski@intel.com>
Cc: "Pali Rohár" <pali@kernel.org>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Mark Gross" <markgross@kernel.org>,
	platform-driver-x86@vger.kernel.org, linux-acpi@vger.kernel.org,
	rafael@kernel.org
Subject: Re: [PATCH v4 19/35] platform/x86/dell/dell-rbtn: Move handler installing logic to driver
Date: Fri, 2 Jun 2023 17:01:38 +0300 (EEST)	[thread overview]
Message-ID: <55b4cc-22c-42c7-ec38-3985d724c84@linux.intel.com> (raw)
In-Reply-To: <d7e2577e-b6c3-a392-4331-5ff16e68a609@intel.com>

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

On Fri, 2 Jun 2023, Wilczynski, Michal wrote:
> On 6/2/2023 3:20 PM, Ilpo Järvinen wrote:
> > On Thu, 1 Jun 2023, Michal Wilczynski wrote:
> >
> >> Currently logic for installing notifications from ACPI devices is
> >> implemented using notify callback in struct acpi_driver. Preparations
> >> are being made to replace acpi_driver with more generic struct
> >> platform_driver, which doesn't contain notify callback. Furthermore
> >> as of now handlers are being called indirectly through
> >> acpi_notify_device(), which decreases performance.
> >>
> >> Call acpi_device_install_event_handler() at the end of .add() callback.
> >> Call acpi_device_remove_event_handler() at the beginning of .remove()
> >> callback. Change arguments passed to the notify callback to match with
> >> what's required by acpi_device_install_event_handler().
> >>
> >> Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
> >> ---
> >>  drivers/platform/x86/dell/dell-rbtn.c | 17 ++++++++++++-----
> >>  1 file changed, 12 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/platform/x86/dell/dell-rbtn.c b/drivers/platform/x86/dell/dell-rbtn.c
> >> index aa0e6c907494..4dcad59eb035 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,
> >>  	},
> >>  	.owner = THIS_MODULE,
> >>  };
> >> @@ -422,7 +421,10 @@ static int rbtn_add(struct acpi_device *device)
> >>  		ret = -EINVAL;
> >>  	}
> >>  
> >> -	return ret;
> >> +	if (ret)
> >> +		return ret;
> >> +
> >> +	return acpi_device_install_event_handler(device, ACPI_DEVICE_NOTIFY, rbtn_notify);
> > What about the other things that are done in rbtn_remove(), should you 
> > rollback more?
> 
> Yeah you're right, but the total lack of rollback in .add() here seems 
> to be an issue on it's own i.e even before this patchset .add() was 
> leaking resources in case of failure.
> I wonder whether to add missing rollback in separate commit ?

Yes, make separate patch out of it and mark it with Fixes tag. You can 
send it separately.

> > I suspect there's a pre-existing lack of rbtn_acquire(device, false); 
> > here to begin with.
> >
> 

-- 
 i.

  reply	other threads:[~2023-06-02 14:01 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 13:17 [PATCH v4 02/35] acpi/ac: Move handler installing logic to driver Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 03/35] acpi/video: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 04/35] acpi/battery: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 05/35] acpi/button: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 06/35] acpi/hed: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 07/35] acpi/nfit: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 08/35] acpi/thermal: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 09/35] acpi/tiny-power-button: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 10/35] hwmon/acpi_power_meter: " Michal Wilczynski
2023-06-01 13:51   ` Guenter Roeck
2023-06-01 13:17 ` [PATCH v4 11/35] iio/acpi-als: " Michal Wilczynski
2023-06-04 10:53   ` Jonathan Cameron
2023-06-01 13:17 ` [PATCH v4 12/35] platform/chromeos_tbmc: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 13/35] platform/wilco_ec: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 14/35] platform/surface/button: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 15/35] platform/x86/acer-wireless: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 16/35] platform/x86/asus-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 17/35] platform/x86/asus-wireless: " Michal Wilczynski
2023-06-02 13:09   ` Ilpo Järvinen
2023-06-02 13:16     ` Wilczynski, Michal
2023-06-01 13:17 ` [PATCH v4 18/35] platform/x86/classmate-laptop: " Michal Wilczynski
2023-06-02 10:29   ` Thadeu Lima de Souza Cascardo
2023-06-02 13:25     ` Wilczynski, Michal
2023-06-01 13:17 ` [PATCH v4 19/35] platform/x86/dell/dell-rbtn: " Michal Wilczynski
2023-06-02 13:20   ` Ilpo Järvinen
2023-06-02 13:41     ` Wilczynski, Michal
2023-06-02 14:01       ` Ilpo Järvinen [this message]
2023-06-01 13:17 ` [PATCH v4 20/35] platform/x86/eeepc-laptop: " Michal Wilczynski
2023-06-02 13:24   ` Ilpo Järvinen
2023-06-01 13:17 ` [PATCH v4 21/35] platform/x86/fujitsu-laptop: " Michal Wilczynski
2023-06-02 13:30   ` Ilpo Järvinen
2023-06-02 13:49     ` Wilczynski, Michal
2023-06-02 13:55       ` Ilpo Järvinen
2023-06-01 13:17 ` [PATCH v4 22/35] platform/x86/lg-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 23/35] platform/x86/panasonic-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 24/35] platform/x86/system76_acpi: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 25/35] platform/x86/topstar-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 26/35] platform/x86/toshiba_acpi: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 27/35] platform/x86/toshiba_bluetooth: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 28/35] platform/x86/toshiba_haps: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 29/35] platform/x86/wireless-hotkey: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 30/35] platform/x86/xo15-ebook: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 31/35] platform/x86/sony-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 32/35] virt/vmgenid: " Michal Wilczynski

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=55b4cc-22c-42c7-ec38-3985d724c84@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=michal.wilczynski@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox