diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-07-12 19:23:32 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-07-16 19:17:04 +0200 |
commit | 42878a9f0fe0b6bef7fb24d98e161c1216a36926 (patch) | |
tree | 8de81a427267b59d2a114673b0f8c01724f3b2bf /drivers/acpi/glue.c | |
parent | Linux 5.14-rc1 (diff) | |
download | linux-42878a9f0fe0b6bef7fb24d98e161c1216a36926.tar.xz linux-42878a9f0fe0b6bef7fb24d98e161c1216a36926.zip |
ACPI: glue: Rearrange acpi_device_notify()
Make the code flow in acpi_device_notify() more straightforward and
make it use dev_dbg() and acpi_handle_debug() for printing debug
messages.
The only expected functional impact of this change is the content of
the debug messages printed by acpi_device_notify().
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/acpi/glue.c')
-rw-r--r-- | drivers/acpi/glue.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index fce3f3bba714..31b6e470c616 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -292,22 +292,21 @@ static int acpi_device_notify(struct device *dev) int ret; ret = acpi_bind_one(dev, NULL); - if (ret && type) { - struct acpi_device *adev; + if (ret) { + if (!type) + goto err; adev = type->find_companion(dev); if (!adev) { - pr_debug("Unable to get handle for %s\n", dev_name(dev)); + dev_dbg(dev, "ACPI companion not found\n"); ret = -ENODEV; - goto out; + goto err; } ret = acpi_bind_one(dev, adev); if (ret) - goto out; + goto err; } adev = ACPI_COMPANION(dev); - if (!adev) - goto out; if (dev_is_platform(dev)) acpi_configure_pmsi_domain(dev); @@ -317,16 +316,13 @@ static int acpi_device_notify(struct device *dev) else if (adev->handler && adev->handler->bind) adev->handler->bind(dev); - out: - if (!ret) { - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n", + dev_name(dev)); - acpi_get_name(ACPI_HANDLE(dev), ACPI_FULL_PATHNAME, &buffer); - pr_debug("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer); - kfree(buffer.pointer); - } else { - pr_debug("Device %s -> No ACPI support\n", dev_name(dev)); - } + return 0; + +err: + dev_dbg(dev, "No ACPI support\n"); return ret; } |