diff options
author | Armin Wolf <W_Armin@gmx.de> | 2024-02-26 20:35:56 +0100 |
---|---|---|
committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2024-03-12 12:47:35 +0200 |
commit | a66ccfc2535418b536b1203b65f87c4f501f6bdd (patch) | |
tree | 6f6e2c0f2ff5de5e7fd26ef3763ea9fd9ea5d989 /drivers/platform/x86/wmi.c | |
parent | 928439582b3133a5e845ec15ee6eb6838651024f (diff) | |
download | linux-a66ccfc2535418b536b1203b65f87c4f501f6bdd.tar.gz linux-a66ccfc2535418b536b1203b65f87c4f501f6bdd.tar.bz2 linux-a66ccfc2535418b536b1203b65f87c4f501f6bdd.zip |
platform/x86: wmi: Do not instantiate older WMI drivers multiple times
Many older WMI drivers cannot be instantiated multiple times for
two reasons:
- they are using the legacy GUID-based WMI API
- they are singletons (with global state)
Prevent such WMI drivers from binding to WMI devices with a duplicated
GUID, as this would mean that the WMI driver will be instantiated at
least two times (one for the original GUID and one for the duplicated
GUID).
WMI drivers which can be instantiated multiple times can signal this
by setting a flag inside struct wmi_driver.
Tested on a ASUS Prime B650-Plus.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20240226193557.2888-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>
Diffstat (limited to 'drivers/platform/x86/wmi.c')
-rw-r--r-- | drivers/platform/x86/wmi.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 29dfe52eb802..349deced87e8 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -883,6 +883,18 @@ static int wmi_dev_probe(struct device *dev) struct wmi_driver *wdriver = drv_to_wdrv(dev->driver); int ret = 0; + /* Some older WMI drivers will break if instantiated multiple times, + * so they are blocked from probing WMI devices with a duplicated GUID. + * + * New WMI drivers should support being instantiated multiple times. + */ + if (test_bit(WMI_GUID_DUPLICATED, &wblock->flags) && !wdriver->no_singleton) { + dev_warn(dev, "Legacy driver %s cannot be instantiated multiple times\n", + dev->driver->name); + + return -ENODEV; + } + if (wdriver->notify) { if (test_bit(WMI_NO_EVENT_DATA, &wblock->flags) && !wdriver->no_notify_data) return -ENODEV; |