mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Mark Gross" <markgross@kernel.org>
Subject: Re: [PATCH v2 1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_device()
Date: Fri, 6 Oct 2023 17:34:19 +0200	[thread overview]
Message-ID: <ff4e541d-590b-7eef-aeee-dc15ca869691@redhat.com> (raw)
In-Reply-To: <20231006153152.3502912-1-andriy.shevchenko@linux.intel.com>

Hi,

On 10/6/23 17:31, Andy Shevchenko wrote:
> Replace open coded acpi_match_device() in ebook_switch_add().
> 
> Note, while it is a bit longer it is more robust in case
> more IDs will be added.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


p.s.

This driver too really should be converted to not be an acpi_driver
instead it should bind to the instantiated platform_device
for the adev, but that would require someone with actual
hw access to test the conversion ...






> ---
> v2: fixed compilation error
>  drivers/platform/x86/xo15-ebook.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
> index 391f7ea4431e..2ae8a58adcd0 100644
> --- a/drivers/platform/x86/xo15-ebook.c
> +++ b/drivers/platform/x86/xo15-ebook.c
> @@ -81,9 +81,9 @@ static SIMPLE_DEV_PM_OPS(ebook_switch_pm, NULL, ebook_switch_resume);
>  
>  static int ebook_switch_add(struct acpi_device *device)
>  {
> +	const struct acpi_device_id *id;
>  	struct ebook_switch *button;
>  	struct input_dev *input;
> -	const char *hid = acpi_device_hid(device);
>  	char *name, *class;
>  	int error;
>  
> @@ -102,8 +102,9 @@ static int ebook_switch_add(struct acpi_device *device)
>  	name = acpi_device_name(device);
>  	class = acpi_device_class(device);
>  
> -	if (strcmp(hid, XO15_EBOOK_HID)) {
> -		pr_err("Unsupported hid [%s]\n", hid);
> +	id = acpi_match_device(ebook_device_ids, device);
> +	if (!id) {
> +		dev_err(&device->dev, "Unsupported hid\n");
>  		error = -ENODEV;
>  		goto err_free_input;
>  	}
> @@ -111,7 +112,7 @@ static int ebook_switch_add(struct acpi_device *device)
>  	strcpy(name, XO15_EBOOK_DEVICE_NAME);
>  	sprintf(class, "%s/%s", XO15_EBOOK_CLASS, XO15_EBOOK_SUBCLASS);
>  
> -	snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid);
> +	snprintf(button->phys, sizeof(button->phys), "%s/button/input0", id->id);
>  
>  	input->name = name;
>  	input->phys = button->phys;


  reply	other threads:[~2023-10-06 15:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 15:31 Andy Shevchenko
2023-10-06 15:34 ` Hans de Goede [this message]
2023-10-07  7:27   ` Andy Shevchenko
2023-10-06 18:57 ` kernel test robot

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=ff4e541d-590b-7eef-aeee-dc15ca869691@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.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

Powered by JetHome