platform/x86: huawei-wmi: Stricter battery thresholds set
PATCH 1/2 platform/x86: huawei-wmi: Stricter battery thresholds set
Check if battery thresholds are within 0 and 100.
--- 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: fd13c8622a5ad4f7317b64de4f6aa2de1962220e
Signature · 1 line
2.21.0
PATCH 2/2 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.
--- 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
Re: [PATCH 2/2] platform/x86: huawei-wmi: No need to check for battery name
Quoted 3 lines · Ayman Bagabas
No need to check for battery name, we already check if the WMI function is
available inhuawei_wmi_battery_setup.
Thank you,
Ayman
Quoted 23 lines
--- drivers/platform/x86/huawei-wmi.c | 4 ---- 1 file changed, 4 deletions(-)drivers/platform/x86/huawei-wmi.c +0
-4@@ -471,10 +471,6 @@ staticDEVICE_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);
Quoted 2 lines · Ayman Bagabas
Check if battery thresholds are within 0 and 100.
---
Thanks!
Don't forget to add your Signed-off-by: though.
regards,
dan carpenter
Quoted 7 lines · Dan Carpenter
Quoted 2 lines · Ayman Bagabas
Check if battery thresholds are within 0 and 100.
---Thanks!
Don't forget to add your Signed-off-by: though.
Thank you,
Ayman
Quoted 4 lines
regards,
dan carpenter
Quoted 5 lines · On Sun, Oct 20, 2019 at 3:33 AM <[email protected]> wrote:
Quoted 4 lines · Dan Carpenter
Quoted 1 line · Ayman Bagabas
Check if battery thresholds are within 0 and 100.
Don't forget to add your Signed-off-by: though.
Please, resend all three with properly tagged with Sob, Fixes, etc.
Signature · 2 lines
With Best Regards, Andy Shevchenko