platform/x86: huawei-wmi: Stricter battery thresholds set
PATCH 1/3 platform/x86: huawei-wmi: Stricter battery thresholds set
Check if battery thresholds are within 0 and 100.
Fixes 355a070b09ab ("platform/x86: huawei-wmi: Add battery charging thresholds")
Signed-off-by Ayman Bagabas <[email protected]>
--- drivers/platform/x86/huawei-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/huawei-wmi.c +1 -1
@@ -345,7 +345,7 @@ static int huawei_wmi_battery_set(int start, int end)union hwmi_arg arg;int err; -if (start <0 || end >100 ) +if (start <0 || end <0 || start >100 || end >100 )return -EINVAL ; arg.cmd =BATTERY_THRESH_SET ;
base-commit: c4b9850b3676869ac0def5885d781d17f64b3a86
Signature · 1 line
2.21.0
PATCH 2/3 platform/x86: huawei-wmi: No need to check for battery name
No need to check for battery name, we already check if the WMI function is available in huawei_wmi_battery_setup.
Fixes 355a070b09ab ("platform/x86: huawei-wmi: Add battery charging thresholds")
Signed-off-by Ayman Bagabas <[email protected]>
--- drivers/platform/x86/huawei-wmi.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/platform/x86/huawei-wmi.c +0 -4
@@ -471,10 +471,6 @@ static DEVICE_ATTR_RW(charge_control_thresholds);static int huawei_wmi_battery_add (struct power_supply *battery) { -/* Huawei laptops come with one battery only */ -if (strcmp (battery->desc->name,"BAT" ) !=1 ) -return -ENODEV ; -device_create_file (&battery->dev, &dev_attr_charge_control_start_threshold);device_create_file (&battery->dev, &dev_attr_charge_control_end_threshold);
Signature · 1 line
2.21.0
PATCH 3/3 platform/x86: huawei-wmi: Remove unnecessary battery mutex
In reply to Ayman Bagabasbattery_lock mutex is never used and not needed.
Fixes 355a070b09ab ("platform/x86: huawei-wmi: Add battery charging thresholds")
Signed-off-by Ayman Bagabas <[email protected]>
--- drivers/platform/x86/huawei-wmi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/platform/x86/huawei-wmi.c +0 -2
@@ -67,7 +67,6 @@ struct huawei_wmi {struct led_classdev cdev;struct device *dev; -struct mutex battery_lock;struct mutex wmi_lock; };
@@ -807,7 +806,6 @@ static int huawei_wmi_probe(struct platform_device *pdev)if (wmi_has_guid (HWMI_METHOD_GUID )) {mutex_init (&huawei_wmi->wmi_lock); -mutex_init (&huawei_wmi->battery_lock);huawei_wmi_leds_setup (&pdev->dev);huawei_wmi_fn_lock_setup (&pdev->dev);
Signature · 1 line
2.21.0