Skip to contentSkip to conversation

hwmon: hp-wmi-sensors: Minor fixes

PATCH Applied James Seo 2 participants 6 messages Jul 22, 2023

Subsystems (4)
lore
Share & tools
lore

James Seo

author maintainer
#0 lore raw

cover hwmon: hp-wmi-sensors: Minor fixes

Make driver init slightly more efficient and the appearance of generated documentation more consistent.

James Seo (2):
hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core
docs: hwmon: hp-wmi-sensors: Change document title

 Documentation/hwmon/hp-wmi-sensors.rst |  6 +++---
 drivers/hwmon/hp-wmi-sensors.c         | 20 +++-----------------
 2 files changed, 6 insertions(+), 20 deletions(-)

base-commit: c4be22597a36e3487474aee9b4177cc8cf780124

Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 1/2 hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core

2a2b13ae50cf ("platform/x86: wmi: Allow retrieving the number of WMI object instances") means we no longer need to find this ourselves.

---
 drivers/hwmon/hp-wmi-sensors.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/hwmon/hp-wmi-sensors.c +3 -17
index ebe2fb513480..3a99cc5f44b2 100644
@@ -435,25 +435,11 @@ static union acpi_object *hp_wmi_get_wobj(const char *guid, u8 instance)
 /* hp_wmi_wobj_instance_count - find count of WMI object instances */
 static u8 hp_wmi_wobj_instance_count(const char *guid)
 {
-	u8 hi = HP_WMI_MAX_INSTANCES;
-	union acpi_object *wobj;
-	u8 lo = 0;
-	u8 mid;
-
-	while (lo < hi) {
-		mid = (lo + hi) / 2;
-
-		wobj = hp_wmi_get_wobj(guid, mid);
-		if (!wobj) {
-			hi = mid;
-			continue;
-		}
+	int count;
 
-		lo = mid + 1;
-		kfree(wobj);
-	}
+	count = wmi_instance_count(guid);
 
-	return lo;
+	return clamp(count, 0, (int)HP_WMI_MAX_INSTANCES);
 }
 
 static int check_wobj(const union acpi_object *wobj,
Signature · 1 line
2.39.2
maintainer Applied
#2 lore raw

Re: [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core

Quoted 4 lines · James Seo

2a2b13ae50cf ("platform/x86: wmi: Allow retrieving the number of WMI object instances") means we no longer need to find this ourselves.

Applied to hwmon-next.

Thanks,
Guenter

Quoted 40 lines
---
 drivers/hwmon/hp-wmi-sensors.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/hwmon/hp-wmi-sensors.c +3 -17
index ebe2fb513480..3a99cc5f44b2 100644
@@ -435,25 +435,11 @@ static union acpi_object *hp_wmi_get_wobj(const char *guid, u8 instance)
 /* hp_wmi_wobj_instance_count - find count of WMI object instances */
 static u8 hp_wmi_wobj_instance_count(const char *guid)
 {
-	u8 hi = HP_WMI_MAX_INSTANCES;
-	union acpi_object *wobj;
-	u8 lo = 0;
-	u8 mid;
-
-	while (lo < hi) {
-		mid = (lo + hi) / 2;
-
-		wobj = hp_wmi_get_wobj(guid, mid);
-		if (!wobj) {
-			hi = mid;
-			continue;
-		}
+	int count;
 
-		lo = mid + 1;
-		kfree(wobj);
-	}
+	count = wmi_instance_count(guid);
 
-	return lo;
+	return clamp(count, 0, (int)HP_WMI_MAX_INSTANCES);
 }
 
 static int check_wobj(const union acpi_object *wobj,
Signature · 1 line
2.39.2
author maintainer
#3 lore raw

PATCH 2/2 docs: hwmon: hp-wmi-sensors: Change document title

In reply to James Seo

Change title to "Kernel driver hp-wmi-sensors" for consistency with most of the rest of Documentation/hwmon.

---
 Documentation/hwmon/hp-wmi-sensors.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/hwmon/hp-wmi-sensors.rst +3 -3
index a6bca9aecdde..a611c6263074 100644
@@ -2,9 +2,9 @@
 
 .. include:: <isonum.txt>
 
-===========================
-Linux HP WMI Sensors Driver
-===========================
+============================
+Kernel driver hp-wmi-sensors
+============================
 
 :Copyright: |copy| 2023 James Seo <[email protected]>
 
Signature · 1 line
2.39.2
maintainer
#4 lore raw

Re: [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title

Quoted 2 lines · James Seo

Change title to "Kernel driver hp-wmi-sensors" for consistency with most of the rest of Documentation/hwmon.

Not sure if it is worth it, but either case: Signed-off-by: missing.

Guenter

Quoted 24 lines
---
 Documentation/hwmon/hp-wmi-sensors.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/hwmon/hp-wmi-sensors.rst +3 -3
index a6bca9aecdde..a611c6263074 100644
@@ -2,9 +2,9 @@
 
 .. include:: <isonum.txt>
 
-===========================
-Linux HP WMI Sensors Driver
-===========================
+============================
+Kernel driver hp-wmi-sensors
+============================
 
 :Copyright: |copy| 2023 James Seo <[email protected]>
 
Signature · 1 line
2.39.2
author maintainer
#5 lore raw

Re: [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title

Quoted 7 lines · Guenter Roeck
Quoted 2 lines · James Seo

Change title to "Kernel driver hp-wmi-sensors" for consistency with most of the rest of Documentation/hwmon.

Not sure if it is worth it, but either case: Signed-off-by: missing.

Guenter

Oops. Forget it for now, then. I'll resubmit if/when there are more changes.

Thanks.

James