Skip to content

Commit 6a8e793

Browse files
committed
ACPI: video: Consolidate pnp.bus_id workarounds handling
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> Link: https://patch.msgid.link/3430879.44csPzL39Z@rafael.j.wysocki
1 parent 9dc11fa commit 6a8e793

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

drivers/acpi/acpi_video.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,14 +1978,13 @@ static bool acpi_video_bus_dev_is_duplicate(struct device *dev)
19781978
return device_for_each_child(dev->parent, dev, duplicate_dev_check);
19791979
}
19801980

1981-
static int instance;
1982-
19831981
static int acpi_video_bus_probe(struct auxiliary_device *aux_dev,
19841982
const struct auxiliary_device_id *id_unused)
19851983
{
19861984
struct acpi_device *device = ACPI_COMPANION(&aux_dev->dev);
19871985
static DEFINE_MUTEX(probe_lock);
19881986
struct acpi_video_bus *video;
1987+
static int instance;
19891988
bool auto_detect;
19901989
int error;
19911990

@@ -2005,16 +2004,15 @@ static int acpi_video_bus_probe(struct auxiliary_device *aux_dev,
20052004
if (!video)
20062005
return -ENOMEM;
20072006

2008-
/* a hack to fix the duplicate name "VID" problem on T61 */
2009-
if (!strcmp(device->pnp.bus_id, "VID")) {
2010-
if (instance)
2011-
device->pnp.bus_id[3] = '0' + instance;
2012-
instance++;
2013-
}
2014-
/* a hack to fix the duplicate name "VGA" problem on Pa 3553 */
2015-
if (!strcmp(device->pnp.bus_id, "VGA")) {
2007+
/*
2008+
* A hack to fix the duplicate name "VID" problem on T61 and the
2009+
* duplicate name "VGA" problem on Pa 3553.
2010+
*/
2011+
if (!strcmp(device->pnp.bus_id, "VID") ||
2012+
!strcmp(device->pnp.bus_id, "VGA")) {
20162013
if (instance)
20172014
device->pnp.bus_id[3] = '0' + instance;
2015+
20182016
instance++;
20192017
}
20202018

0 commit comments

Comments
 (0)