Skip to content

Commit 50861d4

Browse files
committed
ACPI: LPSS: Use ACPI_COMPANION() directly
The ACPI_HANDLE() macro returns the ACPI handle of the ACPI device object returned by the ACPI_COMPANION() macro, so it is more straightforward to call the latter directly instead of passing the handle produced by the former to acpi_bus_get_device(). Modify the code accordingly (no intentional functional impact). Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Mika Westerberg <[email protected]>
1 parent 64570fb commit 50861d4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -712,14 +712,13 @@ static void __lpss_reg_write(u32 val, struct lpss_private_data *pdata,
712712

713713
static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
714714
{
715-
struct acpi_device *adev;
715+
struct acpi_device *adev = ACPI_COMPANION(dev);
716716
struct lpss_private_data *pdata;
717717
unsigned long flags;
718718
int ret;
719719

720-
ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev);
721-
if (WARN_ON(ret))
722-
return ret;
720+
if (WARN_ON(!adev))
721+
return -ENODEV;
723722

724723
spin_lock_irqsave(&dev->power.lock, flags);
725724
if (pm_runtime_suspended(dev)) {
@@ -732,6 +731,7 @@ static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
732731
goto out;
733732
}
734733
*val = __lpss_reg_read(pdata, reg);
734+
ret = 0;
735735

736736
out:
737737
spin_unlock_irqrestore(&dev->power.lock, flags);
@@ -1266,7 +1266,8 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb,
12661266
if (!id || !id->driver_data)
12671267
return 0;
12681268

1269-
if (acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev))
1269+
adev = ACPI_COMPANION(&pdev->dev);
1270+
if (!adev)
12701271
return 0;
12711272

12721273
pdata = acpi_driver_data(adev);

0 commit comments

Comments
 (0)