[PATCH v1 3/9] ACPI: video: Consolidate pnp.bus_id workarounds handling

From: Rafael J. Wysocki

Date: Thu Mar 05 2026 - 15:33:24 EST


From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>

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@xxxxxxxxx>
---
drivers/acpi/acpi_video.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 3fa28f1abca3..6337376be196 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -1978,12 +1978,11 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
return 0;
}

-static int instance;
-
static int acpi_video_bus_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct acpi_video_bus *video;
+ static int instance;
bool auto_detect;
int error;
acpi_status status;
@@ -2006,16 +2005,15 @@ static int acpi_video_bus_probe(struct platform_device *pdev)
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++;
}

--
2.51.0