2021-10-12 17:53:50

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 6/7] platform: x86: ideapad-laptop: Use ACPI_COMPANION() directly

From: Rafael J. Wysocki <[email protected]>

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 <[email protected]>
---
drivers/platform/x86/ideapad-laptop.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/platform/x86/ideapad-laptop.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/ideapad-laptop.c
+++ linux-pm/drivers/platform/x86/ideapad-laptop.c
@@ -1534,17 +1534,13 @@ static void ideapad_check_features(struc

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);




2021-10-13 16:18:49

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v2 6/7] platform: x86: ideapad-laptop: Use ACPI_COMPANION() directly

From: Rafael J. Wysocki <[email protected]>

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 <[email protected]>
---

v1 -> v2:
* Resend with a different From and S-o-b address. No other changes.

---
drivers/platform/x86/ideapad-laptop.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/platform/x86/ideapad-laptop.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/ideapad-laptop.c
+++ linux-pm/drivers/platform/x86/ideapad-laptop.c
@@ -1534,17 +1534,13 @@ static void ideapad_check_features(struc

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);



2021-10-19 15:00:26

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH v2 6/7] platform: x86: ideapad-laptop: Use ACPI_COMPANION() directly

Hi,

On 10/13/21 18:13, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <[email protected]>
>
> 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 <[email protected]>

Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>
> v1 -> v2:
> * Resend with a different From and S-o-b address. No other changes.
>
> ---
> drivers/platform/x86/ideapad-laptop.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> Index: linux-pm/drivers/platform/x86/ideapad-laptop.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/x86/ideapad-laptop.c
> +++ linux-pm/drivers/platform/x86/ideapad-laptop.c
> @@ -1534,17 +1534,13 @@ static void ideapad_check_features(struc
>
> 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);
>
>
>