Skip to content

Commit 42878a9

Browse files
committed
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
1 parent e73f0f0 commit 42878a9

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

drivers/acpi/glue.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -292,22 +292,21 @@ static int acpi_device_notify(struct device *dev)
292292
int ret;
293293

294294
ret = acpi_bind_one(dev, NULL);
295-
if (ret && type) {
296-
struct acpi_device *adev;
295+
if (ret) {
296+
if (!type)
297+
goto err;
297298

298299
adev = type->find_companion(dev);
299300
if (!adev) {
300-
pr_debug("Unable to get handle for %s\n", dev_name(dev));
301+
dev_dbg(dev, "ACPI companion not found\n");
301302
ret = -ENODEV;
302-
goto out;
303+
goto err;
303304
}
304305
ret = acpi_bind_one(dev, adev);
305306
if (ret)
306-
goto out;
307+
goto err;
307308
}
308309
adev = ACPI_COMPANION(dev);
309-
if (!adev)
310-
goto out;
311310

312311
if (dev_is_platform(dev))
313312
acpi_configure_pmsi_domain(dev);
@@ -317,16 +316,13 @@ static int acpi_device_notify(struct device *dev)
317316
else if (adev->handler && adev->handler->bind)
318317
adev->handler->bind(dev);
319318

320-
out:
321-
if (!ret) {
322-
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
319+
acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
320+
dev_name(dev));
323321

324-
acpi_get_name(ACPI_HANDLE(dev), ACPI_FULL_PATHNAME, &buffer);
325-
pr_debug("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer);
326-
kfree(buffer.pointer);
327-
} else {
328-
pr_debug("Device %s -> No ACPI support\n", dev_name(dev));
329-
}
322+
return 0;
323+
324+
err:
325+
dev_dbg(dev, "No ACPI support\n");
330326

331327
return ret;
332328
}

0 commit comments

Comments
 (0)