All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ben Skeggs <bskeggs@redhat.com>,
	dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org
Subject: [PATCH v2 2/7] nouveau: ACPI: Use the ACPI_COMPANION() macro directly
Date: Wed, 13 Oct 2021 18:08:06 +0200	[thread overview]
Message-ID: <2240749.ElGaqSPkdT@kreacher> (raw)
In-Reply-To: <21245442.EfDdHjke4D@kreacher>

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




WARNING: multiple messages have this Message-ID (diff)
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ben Skeggs <bskeggs@redhat.com>,
	dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org
Subject: [Nouveau] [PATCH v2 2/7] nouveau: ACPI: Use the ACPI_COMPANION() macro directly
Date: Wed, 13 Oct 2021 18:08:06 +0200	[thread overview]
Message-ID: <2240749.ElGaqSPkdT@kreacher> (raw)
In-Reply-To: <21245442.EfDdHjke4D@kreacher>

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




  parent reply	other threads:[~2021-10-13 16:16 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 17:35 [PATCH v1 0/7] ACPI: Use ACPI_COMPANION() directly to simplify code Rafael J. Wysocki
2021-10-12 17:44 ` [PATCH v1 1/7] gpio-amdpt: ACPI: Use the ACPI_COMPANION() macro directly Rafael J. Wysocki
2021-10-13 14:44   ` Bartosz Golaszewski
2021-10-13 16:06   ` [PATCH v2 " Rafael J. Wysocki
2021-10-12 17:44 ` [PATCH v1 2/7] nouveau: " Rafael J. Wysocki
2021-10-12 17:44   ` [Nouveau] " Rafael J. Wysocki
2021-10-12 22:04   ` Ben Skeggs
2021-10-12 22:04     ` [Nouveau] " Ben Skeggs
2021-10-13 16:08   ` Rafael J. Wysocki [this message]
2021-10-13 16:08     ` [Nouveau] [PATCH v2 " Rafael J. Wysocki
2021-10-12 17:44 ` [PATCH v1 3/7] i2c: i2c-amd-mp2-plat: ACPI: Use ACPI_COMPANION() directly Rafael J. Wysocki
2021-10-12 18:12   ` Shyam Sundar S K
2021-10-13 16:09   ` [PATCH v2 " Rafael J. Wysocki
2021-10-17 14:22     ` Wolfram Sang
2021-10-12 17:44 ` [PATCH v1 4/7] surface: surface3-wmi: " Rafael J. Wysocki
2021-10-12 18:13   ` Maximilian Luz
2021-10-13 16:10   ` [PATCH v2 " Rafael J. Wysocki
2021-10-19 14:56     ` Hans de Goede
2021-10-12 17:46 ` [PATCH v1 5/7] surface: surface3_power: " Rafael J. Wysocki
2021-10-12 18:21   ` Maximilian Luz
2021-10-12 19:11     ` Rafael J. Wysocki
2021-10-12 19:32   ` [PATCH v2 5/7] surface: surface3_power: Drop redundant acpi_bus_get_device() call Rafael J. Wysocki
2021-10-12 19:40     ` Maximilian Luz
2021-10-13 16:12     ` [PATCH v3 " Rafael J. Wysocki
2021-10-19 14:56       ` Hans de Goede
2021-10-12 17:48 ` [PATCH v1 6/7] platform: x86: ideapad-laptop: Use ACPI_COMPANION() directly Rafael J. Wysocki
2021-10-13 16:13   ` [PATCH v2 " Rafael J. Wysocki
2021-10-19 14:57     ` Hans de Goede
2021-10-12 17:50 ` [PATCH v1 7/7] perf: qcom_l2_pmu: ACPI: " Rafael J. Wysocki
2021-10-13 16:15   ` [PATCH v2 " Rafael J. Wysocki
2021-10-26 13:41     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2240749.ElGaqSPkdT@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.