Commit 50861d43 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 64570fbc
...@@ -712,14 +712,13 @@ static void __lpss_reg_write(u32 val, struct lpss_private_data *pdata, ...@@ -712,14 +712,13 @@ static void __lpss_reg_write(u32 val, struct lpss_private_data *pdata,
static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
{ {
struct acpi_device *adev; struct acpi_device *adev = ACPI_COMPANION(dev);
struct lpss_private_data *pdata; struct lpss_private_data *pdata;
unsigned long flags; unsigned long flags;
int ret; int ret;
ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev); if (WARN_ON(!adev))
if (WARN_ON(ret)) return -ENODEV;
return ret;
spin_lock_irqsave(&dev->power.lock, flags); spin_lock_irqsave(&dev->power.lock, flags);
if (pm_runtime_suspended(dev)) { if (pm_runtime_suspended(dev)) {
...@@ -732,6 +731,7 @@ static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) ...@@ -732,6 +731,7 @@ static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
goto out; goto out;
} }
*val = __lpss_reg_read(pdata, reg); *val = __lpss_reg_read(pdata, reg);
ret = 0;
out: out:
spin_unlock_irqrestore(&dev->power.lock, flags); spin_unlock_irqrestore(&dev->power.lock, flags);
...@@ -1266,7 +1266,8 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, ...@@ -1266,7 +1266,8 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb,
if (!id || !id->driver_data) if (!id || !id->driver_data)
return 0; return 0;
if (acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev)) adev = ACPI_COMPANION(&pdev->dev);
if (!adev)
return 0; return 0;
pdata = acpi_driver_data(adev); pdata = acpi_driver_data(adev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment