Linux ACPI
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Hans de Goede <hansg@kernel.org>
Subject: [PATCH v2 3/8] ACPI: video: Consolidate pnp.bus_id workarounds handling
Date: Fri, 13 Mar 2026 13:57:43 +0100	[thread overview]
Message-ID: <3430879.44csPzL39Z@rafael.j.wysocki> (raw)
In-Reply-To: <6271415.lOV4Wx5bFT@rafael.j.wysocki>

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

Reduce code duplication related to pnp.bus_id workarounds by combining
the two existing cases.

Also move the definition of static variable "instance" into
acpi_video_bus_probe() because it is only used there.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpi_video.c |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -1978,14 +1978,13 @@ static bool acpi_video_bus_dev_is_duplic
 	return device_for_each_child(dev->parent, dev, duplicate_dev_check);
 }
 
-static int instance;
-
 static int acpi_video_bus_probe(struct auxiliary_device *aux_dev,
 				const struct auxiliary_device_id *id_unused)
 {
 	struct acpi_device *device = ACPI_COMPANION(&aux_dev->dev);
 	static DEFINE_MUTEX(probe_lock);
 	struct acpi_video_bus *video;
+	static int instance;
 	bool auto_detect;
 	int error;
 
@@ -2005,16 +2004,15 @@ static int acpi_video_bus_probe(struct a
 	if (!video)
 		return -ENOMEM;
 
-	/* a hack to fix the duplicate name "VID" problem on T61 */
-	if (!strcmp(device->pnp.bus_id, "VID")) {
-		if (instance)
-			device->pnp.bus_id[3] = '0' + instance;
-		instance++;
-	}
-	/* a hack to fix the duplicate name "VGA" problem on Pa 3553 */
-	if (!strcmp(device->pnp.bus_id, "VGA")) {
+	/*
+	 * A hack to fix the duplicate name "VID" problem on T61 and the
+	 * duplicate name "VGA" problem on Pa 3553.
+	 */
+	if (!strcmp(device->pnp.bus_id, "VID") ||
+	    !strcmp(device->pnp.bus_id, "VGA")) {
 		if (instance)
 			device->pnp.bus_id[3] = '0' + instance;
+
 		instance++;
 	}
 




  parent reply	other threads:[~2026-03-13 13:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 12:47 [PATCH v2 0/8] ACPI: driver: Cleanups and fixes, mostly related to acpi_device_name/class() Rafael J. Wysocki
2026-03-13 12:53 ` [PATCH v2 1/8] driver core: auxiliary bus: Introduce dev_is_auxiliary() Rafael J. Wysocki
2026-03-13 14:02   ` Greg Kroah-Hartman
2026-03-13 14:09   ` Danilo Krummrich
2026-03-13 12:56 ` [PATCH v2 2/8] ACPI: video: Rework checking for duplicate video bus devices Rafael J. Wysocki
2026-03-13 14:08   ` Danilo Krummrich
2026-03-13 12:57 ` Rafael J. Wysocki [this message]
2026-03-13 12:58 ` [PATCH v2 4/8] ACPI: driver: Do not set acpi_device_name() unnecessarily Rafael J. Wysocki
2026-03-13 12:59 ` [PATCH v2 5/8] ACPI: event: Redefine acpi_notifier_call_chain() Rafael J. Wysocki
2026-03-13 12:59 ` [PATCH v2 6/8] ACPI: driver: Avoid using pnp.device_class for netlink handling Rafael J. Wysocki
2026-03-13 13:00 ` [PATCH v2 7/8] ACPI: driver: Do not set acpi_device_class() unnecessarily Rafael J. Wysocki
2026-03-13 13:03 ` [PATCH v2 8/8] ACPI: AC: Define ACPI_AC_CLASS in one place 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=3430879.44csPzL39Z@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=hansg@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox