From 043449e7516106826346d9923a81da0310a387de Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Wed, 13 Oct 2021 18:13:51 +0200 Subject: [PATCH] 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 Link: https://lore.kernel.org/r/8000884.T7Z3S40VBb@kreacher Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede --- drivers/platform/x86/ideapad-laptop.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 2771a05ea5e2..3ccb7b71dfb1 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1555,17 +1555,13 @@ static void ideapad_check_features(struct ideapad_private *priv) static int ideapad_acpi_add(struct platform_device *pdev) { + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); struct ideapad_private *priv; - struct acpi_device *adev; acpi_status status; unsigned long cfg; int err, i; - err = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev); - if (err) - return -ENODEV; - - if (eval_int(adev->handle, "_CFG", &cfg)) + if (!adev || eval_int(adev->handle, "_CFG", &cfg)) return -ENODEV; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);