platform/x86: wmi: Fix WMI device naming issue
When multiple WMI devices with the same GUID are present
inside a given system, the WMI driver core might fail to
register all of them.
Consider the following scenario:
WMI devices (<GUID>[-<ID>]):
05901221-D566-11D1-B2F0-
00A0C9062910 (on PNP0C14:00)
05901221-D566-11D1-B2F0-
00A0C9062910-1 (on PNP0C14:01)
If the WMI core driver somehow unbinds from PNP0C14:00, the following
will happen upon rebinding:
1. The WMI driver core counts all registered WMI devices with a GUID
of
05901221-D566-11D1-B2F0-
00A0C9062910 (count: 1).
2. The new WMI device will be named
"
05901221-D566-11D1-B2F0-
00A0C9062910-1" because another device
with the same GUID is already registered (on PNP0C14:01).
3. The new WMI device cannot be registered due to a name conflict.
Use a IDA when building the WMI device name to avoid such name
collisions by ensuring that a given WMI device ID is not reused.
Userspace applications using udev for WMI device detection are not
impacted by this change. Additionally userspace applications that do
fully support the existing naming scheme are also not impacted. Only
userspace applications using hardcoded sysfs paths will break.
Introduce a kconfig option for restoring the old naming scheme to
give developers time to fix any compatibility issues.
Tested on a Asus Prime B650-Plus.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20250610055526.23688-2-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>