]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ACPI: video: Rework checking for duplicate video bus devices
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 13 Mar 2026 12:56:19 +0000 (13:56 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 13 Mar 2026 15:47:49 +0000 (16:47 +0100)
commit9dc11faca2456384c8f8c5d83b7fc80dafeb9745
treec7c4be581a20fddb51dc81825e902a5576740678
parent97e6fabee5dcb2d86d4ff45f20606b8a73181f74
ACPI: video: Rework checking for duplicate video bus devices

The current way of checking for duplicate video bus devices in
acpi_video_bus_probe() is based on walking the ACPI namespace which is
not necessary after recent driver conversions.  It is also susceptible
to race conditions (for example, if two video bus devices are probed at
the same time) and ordering issues.

Instead of doing it the old way, inspect the children of the parent of
the device being probed, excluding the latter and the children that are
not auxiliary devices.  For each of the remaining children, check if any
of the entries in the video_bus_head list is equal to its driver data
which can only happen if the given child has been processed by
acpi_video_bus_probe() successfully and so it is a duplicate of the
one being probed.

Moreover, to prevent acpi_video_bus_probe() from processing two devices
concurrently, which might defeat the above check, use a new internal
mutex in it.

Also, print the FW_BUG message only if allow_duplicates is unset which
allows the entire duplicates check to be skipped in that case (doing
it just to print the message about the case that is going to be
ignored anyway is kind of pointless).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/3058492.e9J7NaK4W3@rafael.j.wysocki
drivers/acpi/acpi_video.c