dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 2/7] nouveau: ACPI: Use the ACPI_COMPANION() macro directly
       [not found] <4369779.LvFx2qVVIh@kreacher>
@ 2021-10-12 17:44 ` Rafael J. Wysocki
  2021-10-12 22:04   ` Ben Skeggs
  2021-10-13 16:08   ` [PATCH v2 " Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-10-12 17:44 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Ben Skeggs, dri-devel, nouveau

From: Rafael J. Wysocki <rafael@kernel.org>

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 nouveau_acpi_edid() accordingly (no intentional functional
impact).

Signed-off-by: Rafael J. Wysocki <rafael@kernel.org>
---
 drivers/gpu/drm/nouveau/nouveau_acpi.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Index: linux-pm/drivers/gpu/drm/nouveau/nouveau_acpi.c
===================================================================
--- linux-pm.orig/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ linux-pm/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -364,7 +364,6 @@ void *
 nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector)
 {
 	struct acpi_device *acpidev;
-	acpi_handle handle;
 	int type, ret;
 	void *edid;
 
@@ -377,12 +376,8 @@ nouveau_acpi_edid(struct drm_device *dev
 		return NULL;
 	}
 
-	handle = ACPI_HANDLE(dev->dev);
-	if (!handle)
-		return NULL;
-
-	ret = acpi_bus_get_device(handle, &acpidev);
-	if (ret)
+	acpidev = ACPI_COMPANION(dev->dev);
+	if (!acpidev)
 		return NULL;
 
 	ret = acpi_video_get_edid(acpidev, type, -1, &edid);




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 2/7] nouveau: ACPI: Use the ACPI_COMPANION() macro directly
  2021-10-12 17:44 ` [PATCH v1 2/7] nouveau: ACPI: Use the ACPI_COMPANION() macro directly Rafael J. Wysocki
@ 2021-10-12 22:04   ` Ben Skeggs
  2021-10-13 16:08   ` [PATCH v2 " Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Skeggs @ 2021-10-12 22:04 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML, Ben Skeggs, ML dri-devel, ML nouveau

On Wed, 13 Oct 2021 at 03:58, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> From: Rafael J. Wysocki <rafael@kernel.org>
>
> 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 nouveau_acpi_edid() accordingly (no intentional functional
> impact).
>
> Signed-off-by: Rafael J. Wysocki <rafael@kernel.org>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>

> ---
>  drivers/gpu/drm/nouveau/nouveau_acpi.c |    9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> Index: linux-pm/drivers/gpu/drm/nouveau/nouveau_acpi.c
> ===================================================================
> --- linux-pm.orig/drivers/gpu/drm/nouveau/nouveau_acpi.c
> +++ linux-pm/drivers/gpu/drm/nouveau/nouveau_acpi.c
> @@ -364,7 +364,6 @@ void *
>  nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector)
>  {
>         struct acpi_device *acpidev;
> -       acpi_handle handle;
>         int type, ret;
>         void *edid;
>
> @@ -377,12 +376,8 @@ nouveau_acpi_edid(struct drm_device *dev
>                 return NULL;
>         }
>
> -       handle = ACPI_HANDLE(dev->dev);
> -       if (!handle)
> -               return NULL;
> -
> -       ret = acpi_bus_get_device(handle, &acpidev);
> -       if (ret)
> +       acpidev = ACPI_COMPANION(dev->dev);
> +       if (!acpidev)
>                 return NULL;
>
>         ret = acpi_video_get_edid(acpidev, type, -1, &edid);
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 2/7] nouveau: ACPI: Use the ACPI_COMPANION() macro directly
  2021-10-12 17:44 ` [PATCH v1 2/7] nouveau: ACPI: Use the ACPI_COMPANION() macro directly Rafael J. Wysocki
  2021-10-12 22:04   ` Ben Skeggs
@ 2021-10-13 16:08   ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-10-13 16:08 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Ben Skeggs, dri-devel, nouveau

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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 nouveau_acpi_edid() accordingly (no intentional functional
impact).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
---

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

---
 drivers/gpu/drm/nouveau/nouveau_acpi.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Index: linux-pm/drivers/gpu/drm/nouveau/nouveau_acpi.c
===================================================================
--- linux-pm.orig/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ linux-pm/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -364,7 +364,6 @@ void *
 nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector)
 {
 	struct acpi_device *acpidev;
-	acpi_handle handle;
 	int type, ret;
 	void *edid;
 
@@ -377,12 +376,8 @@ nouveau_acpi_edid(struct drm_device *dev
 		return NULL;
 	}
 
-	handle = ACPI_HANDLE(dev->dev);
-	if (!handle)
-		return NULL;
-
-	ret = acpi_bus_get_device(handle, &acpidev);
-	if (ret)
+	acpidev = ACPI_COMPANION(dev->dev);
+	if (!acpidev)
 		return NULL;
 
 	ret = acpi_video_get_edid(acpidev, type, -1, &edid);




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-13 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4369779.LvFx2qVVIh@kreacher>
2021-10-12 17:44 ` [PATCH v1 2/7] nouveau: ACPI: Use the ACPI_COMPANION() macro directly Rafael J. Wysocki
2021-10-12 22:04   ` Ben Skeggs
2021-10-13 16:08   ` [PATCH v2 " Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox