* [PATCH v4 1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_acpi_device()
@ 2023-10-10 13:39 Andy Shevchenko
2023-10-12 14:12 ` Ilpo Järvinen
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2023-10-10 13:39 UTC (permalink / raw)
To: Hans de Goede, Andy Shevchenko, platform-driver-x86, linux-kernel
Cc: Ilpo Järvinen, Mark Gross
Replace open coded acpi_match_acpi_device() in ebook_switch_add().
Note, while it is a bit longer it is more robust in case
more IDs will be added.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v4: updated subject (Ilpo)
v3: used proper API, added tag (Hans)
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..df2bf1c58523 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_acpi_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;
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v4 1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_acpi_device()
2023-10-10 13:39 [PATCH v4 1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_acpi_device() Andy Shevchenko
@ 2023-10-12 14:12 ` Ilpo Järvinen
0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2023-10-12 14:12 UTC (permalink / raw)
To: Hans de Goede, platform-driver-x86, linux-kernel, Andy Shevchenko
Cc: Mark Gross
On Tue, 10 Oct 2023 16:39:36 +0300, Andy Shevchenko wrote:
> Replace open coded acpi_match_acpi_device() in ebook_switch_add().
>
> Note, while it is a bit longer it is more robust in case
> more IDs will be added.
>
>
Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.
Once I've run some tests on the review-ilpo branch the patches
there will be added to the platform-drivers-x86/for-next branch
and eventually will be included in the pdx86 pull-request to
Linus for the next merge-window.
The list of commits applied:
[1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_acpi_device()
commit: 39789590cff4043d81774d03777dabf7ba263176
--
i.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-12 14:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10 13:39 [PATCH v4 1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_acpi_device() Andy Shevchenko
2023-10-12 14:12 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox