* [PATCH v2 1/1] Input: icn8505 - Utilize acpi_get_subsystem_id()
@ 2022-09-28 11:05 Andy Shevchenko
2022-09-28 16:02 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2022-09-28 11:05 UTC (permalink / raw)
To: Andy Shevchenko, linux-input, linux-kernel; +Cc: Hans de Goede, Dmitry Torokhov
Replace open coded variant of recently introduced acpi_get_subsystem_id().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: used PTR_ERR_OR_ZERO() amd twek the code accordingly (Dmitry)
drivers/input/touchscreen/chipone_icn8505.c | 30 +++++++--------------
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/drivers/input/touchscreen/chipone_icn8505.c b/drivers/input/touchscreen/chipone_icn8505.c
index f9ca5502ac8c..c421f4be2700 100644
--- a/drivers/input/touchscreen/chipone_icn8505.c
+++ b/drivers/input/touchscreen/chipone_icn8505.c
@@ -364,32 +364,20 @@ static irqreturn_t icn8505_irq(int irq, void *dev_id)
static int icn8505_probe_acpi(struct icn8505_data *icn8505, struct device *dev)
{
- struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
- const char *subsys = "unknown";
- struct acpi_device *adev;
- union acpi_object *obj;
- acpi_status status;
-
- adev = ACPI_COMPANION(dev);
- if (!adev)
- return -ENODEV;
+ const char *subsys;
+ int error;
- status = acpi_evaluate_object(adev->handle, "_SUB", NULL, &buffer);
- if (ACPI_SUCCESS(status)) {
- obj = buffer.pointer;
- if (obj->type == ACPI_TYPE_STRING)
- subsys = obj->string.pointer;
- else
- dev_warn(dev, "Warning ACPI _SUB did not return a string\n");
- } else {
- dev_warn(dev, "Warning ACPI _SUB failed: %#x\n", status);
- buffer.pointer = NULL;
- }
+ subsys = acpi_get_subsystem_id(ACPI_HANDLE(dev));
+ error = PTR_ERR_OR_ZERO(subsys);
+ if (error == -ENODATA)
+ subsys = "unknown";
+ else if (error)
+ return error;
snprintf(icn8505->firmware_name, sizeof(icn8505->firmware_name),
"chipone/icn8505-%s.fw", subsys);
- kfree(buffer.pointer);
+ kfree_const(subsys);
return 0;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] Input: icn8505 - Utilize acpi_get_subsystem_id()
2022-09-28 11:05 [PATCH v2 1/1] Input: icn8505 - Utilize acpi_get_subsystem_id() Andy Shevchenko
@ 2022-09-28 16:02 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2022-09-28 16:02 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-input, linux-kernel, Hans de Goede
On Wed, Sep 28, 2022 at 02:05:48PM +0300, Andy Shevchenko wrote:
> Replace open coded variant of recently introduced acpi_get_subsystem_id().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-28 16:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-28 11:05 [PATCH v2 1/1] Input: icn8505 - Utilize acpi_get_subsystem_id() Andy Shevchenko
2022-09-28 16:02 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).