mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] platform/x86: huawei-wmi: Stricter battery thresholds set
@ 2019-10-20 17:00 Ayman Bagabas
  2019-10-20 17:00 ` [PATCH 2/3] platform/x86: huawei-wmi: No need to check for battery name Ayman Bagabas
  2019-10-20 17:00 ` [PATCH 3/3] platform/x86: huawei-wmi: Remove unnecessary battery mutex Ayman Bagabas
  0 siblings, 2 replies; 3+ messages in thread
From: Ayman Bagabas @ 2019-10-20 17:00 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko, Ayman Bagabas, Takashi Iwai,
	Mattias Jacobsson, kbuild test robot, Dan Carpenter,
	platform-driver-x86, linux-kernel

Check if battery thresholds are within 0 and 100.

Fixes: 355a070b09ab ("platform/x86: huawei-wmi: Add battery charging thresholds")
Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
---
 drivers/platform/x86/huawei-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c
index 5837d1b8693d..26041d44286a 100644
--- a/drivers/platform/x86/huawei-wmi.c
+++ b/drivers/platform/x86/huawei-wmi.c
@@ -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
-- 
2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/3] platform/x86: huawei-wmi: No need to check for battery name
  2019-10-20 17:00 [PATCH 1/3] platform/x86: huawei-wmi: Stricter battery thresholds set Ayman Bagabas
@ 2019-10-20 17:00 ` Ayman Bagabas
  2019-10-20 17:00 ` [PATCH 3/3] platform/x86: huawei-wmi: Remove unnecessary battery mutex Ayman Bagabas
  1 sibling, 0 replies; 3+ messages in thread
From: Ayman Bagabas @ 2019-10-20 17:00 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko, Ayman Bagabas, Mattias Jacobsson,
	Takashi Iwai, Dan Carpenter, kbuild test robot,
	platform-driver-x86, linux-kernel

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 <ayman.bagabas@gmail.com>
---
 drivers/platform/x86/huawei-wmi.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c
index 26041d44286a..7373a65a61d3 100644
--- a/drivers/platform/x86/huawei-wmi.c
+++ b/drivers/platform/x86/huawei-wmi.c
@@ -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);
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 3/3] platform/x86: huawei-wmi: Remove unnecessary battery mutex
  2019-10-20 17:00 [PATCH 1/3] platform/x86: huawei-wmi: Stricter battery thresholds set Ayman Bagabas
  2019-10-20 17:00 ` [PATCH 2/3] platform/x86: huawei-wmi: No need to check for battery name Ayman Bagabas
@ 2019-10-20 17:00 ` Ayman Bagabas
  1 sibling, 0 replies; 3+ messages in thread
From: Ayman Bagabas @ 2019-10-20 17:00 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko, Ayman Bagabas, Takashi Iwai,
	Mattias Jacobsson, kbuild test robot, Dan Carpenter,
	platform-driver-x86, linux-kernel

battery_lock mutex is never used and not needed.

Fixes: 355a070b09ab ("platform/x86: huawei-wmi: Add battery charging thresholds")
Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
---
 drivers/platform/x86/huawei-wmi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c
index 7373a65a61d3..a2d846c4a7ee 100644
--- a/drivers/platform/x86/huawei-wmi.c
+++ b/drivers/platform/x86/huawei-wmi.c
@@ -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);
-- 
2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-20 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-20 17:00 [PATCH 1/3] platform/x86: huawei-wmi: Stricter battery thresholds set Ayman Bagabas
2019-10-20 17:00 ` [PATCH 2/3] platform/x86: huawei-wmi: No need to check for battery name Ayman Bagabas
2019-10-20 17:00 ` [PATCH 3/3] platform/x86: huawei-wmi: Remove unnecessary battery mutex Ayman Bagabas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®