Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform: x86: ideapad-laptop: Use ACPI_COMPANION() directly

The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
macro and the ACPI handle produced by the former comes from the
ACPI device object produced by the latter, so it is way more
straightforward to evaluate the latter directly instead of passing
the handle produced by the former to acpi_bus_get_device().

Modify ideapad_acpi_add() accordingly (no intentional functional
impact).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/8000884.T7Z3S40VBb@kreacher
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Rafael J. Wysocki and committed by
Hans de Goede
043449e7 7c7ba5de

+2 -6
+2 -6
drivers/platform/x86/ideapad-laptop.c
··· 1555 1555 1556 1556 static int ideapad_acpi_add(struct platform_device *pdev) 1557 1557 { 1558 + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); 1558 1559 struct ideapad_private *priv; 1559 - struct acpi_device *adev; 1560 1560 acpi_status status; 1561 1561 unsigned long cfg; 1562 1562 int err, i; 1563 1563 1564 - err = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev); 1565 - if (err) 1566 - return -ENODEV; 1567 - 1568 - if (eval_int(adev->handle, "_CFG", &cfg)) 1564 + if (!adev || eval_int(adev->handle, "_CFG", &cfg)) 1569 1565 return -ENODEV; 1570 1566 1571 1567 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);