Skip to content

Commit 600655c

Browse files
andy-shevdtor
authored andcommitted
Input: icn8505 - utilize acpi_get_subsystem_id()
Replace open coded variant of recently introduced acpi_get_subsystem_id(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220928110548.43955-1-andriy.shevchenko@linux.intel.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 6770652 commit 600655c

1 file changed

Lines changed: 9 additions & 21 deletions

File tree

drivers/input/touchscreen/chipone_icn8505.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -364,32 +364,20 @@ static irqreturn_t icn8505_irq(int irq, void *dev_id)
364364

365365
static int icn8505_probe_acpi(struct icn8505_data *icn8505, struct device *dev)
366366
{
367-
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
368-
const char *subsys = "unknown";
369-
struct acpi_device *adev;
370-
union acpi_object *obj;
371-
acpi_status status;
372-
373-
adev = ACPI_COMPANION(dev);
374-
if (!adev)
375-
return -ENODEV;
367+
const char *subsys;
368+
int error;
376369

377-
status = acpi_evaluate_object(adev->handle, "_SUB", NULL, &buffer);
378-
if (ACPI_SUCCESS(status)) {
379-
obj = buffer.pointer;
380-
if (obj->type == ACPI_TYPE_STRING)
381-
subsys = obj->string.pointer;
382-
else
383-
dev_warn(dev, "Warning ACPI _SUB did not return a string\n");
384-
} else {
385-
dev_warn(dev, "Warning ACPI _SUB failed: %#x\n", status);
386-
buffer.pointer = NULL;
387-
}
370+
subsys = acpi_get_subsystem_id(ACPI_HANDLE(dev));
371+
error = PTR_ERR_OR_ZERO(subsys);
372+
if (error == -ENODATA)
373+
subsys = "unknown";
374+
else if (error)
375+
return error;
388376

389377
snprintf(icn8505->firmware_name, sizeof(icn8505->firmware_name),
390378
"chipone/icn8505-%s.fw", subsys);
391379

392-
kfree(buffer.pointer);
380+
kfree_const(subsys);
393381
return 0;
394382
}
395383

0 commit comments

Comments
 (0)