Commit cf2cc541 authored by Armin Wolf's avatar Armin Wolf Committed by Hans de Goede

platform/x86: dell-ddv: Add "force" module param

Until now, the dell-wmi-ddv driver needs to be manually
patched and compiled to test compatibility with unknown
DDV WMI interface versions.

Add a module param to allow users to force loading even
when a unknown interface version was detected. Since this
might cause various unwanted side effects, the module param
is marked as unsafe.
Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20230126194021.381092-5-W_Armin@gmx.deReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 8b52501c
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#define DELL_EPPID_LENGTH 20 #define DELL_EPPID_LENGTH 20
#define DELL_EPPID_EXT_LENGTH 23 #define DELL_EPPID_EXT_LENGTH 23
static bool force;
module_param_unsafe(force, bool, 0);
MODULE_PARM_DESC(force, "Force loading without checking for supported WMI interface versions");
enum dell_ddv_method { enum dell_ddv_method {
DELL_DDV_BATTERY_DESIGN_CAPACITY = 0x01, DELL_DDV_BATTERY_DESIGN_CAPACITY = 0x01,
DELL_DDV_BATTERY_FULL_CHARGE_CAPACITY = 0x02, DELL_DDV_BATTERY_FULL_CHARGE_CAPACITY = 0x02,
...@@ -349,8 +353,13 @@ static int dell_wmi_ddv_probe(struct wmi_device *wdev, const void *context) ...@@ -349,8 +353,13 @@ static int dell_wmi_ddv_probe(struct wmi_device *wdev, const void *context)
return ret; return ret;
dev_dbg(&wdev->dev, "WMI interface version: %d\n", version); dev_dbg(&wdev->dev, "WMI interface version: %d\n", version);
if (version < DELL_DDV_SUPPORTED_VERSION_MIN || version > DELL_DDV_SUPPORTED_VERSION_MAX) if (version < DELL_DDV_SUPPORTED_VERSION_MIN || version > DELL_DDV_SUPPORTED_VERSION_MAX) {
return -ENODEV; if (!force)
return -ENODEV;
dev_warn(&wdev->dev, "Loading despite unsupported WMI interface version (%u)\n",
version);
}
data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment