linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] hwmon: hp-wmi-sensors: Minor fixes
@ 2023-07-22 17:25 James Seo
  2023-07-22 17:25 ` [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core James Seo
  2023-07-22 17:25 ` [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title James Seo
  0 siblings, 2 replies; 6+ messages in thread
From: James Seo @ 2023-07-22 17:25 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck
  Cc: James Seo, linux-hwmon, platform-driver-x86, Jonathan Corbet,
	linux-doc, linux-kernel

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
-- 
2.39.2


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

* [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core
  2023-07-22 17:25 [PATCH 0/2] hwmon: hp-wmi-sensors: Minor fixes James Seo
@ 2023-07-22 17:25 ` James Seo
  2023-07-22 18:23   ` Guenter Roeck
  2023-07-22 17:25 ` [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title James Seo
  1 sibling, 1 reply; 6+ messages in thread
From: James Seo @ 2023-07-22 17:25 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck
  Cc: James Seo, linux-hwmon, platform-driver-x86, Jonathan Corbet,
	linux-doc, linux-kernel

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

Signed-off-by: James Seo <james@equiv.tech>
---
 drivers/hwmon/hp-wmi-sensors.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
index ebe2fb513480..3a99cc5f44b2 100644
--- a/drivers/hwmon/hp-wmi-sensors.c
+++ b/drivers/hwmon/hp-wmi-sensors.c
@@ -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,
-- 
2.39.2


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

* [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title
  2023-07-22 17:25 [PATCH 0/2] hwmon: hp-wmi-sensors: Minor fixes James Seo
  2023-07-22 17:25 ` [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core James Seo
@ 2023-07-22 17:25 ` James Seo
  2023-07-22 18:24   ` Guenter Roeck
  1 sibling, 1 reply; 6+ messages in thread
From: James Seo @ 2023-07-22 17:25 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck
  Cc: James Seo, linux-hwmon, platform-driver-x86, Jonathan Corbet,
	linux-doc, linux-kernel

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(-)

diff --git a/Documentation/hwmon/hp-wmi-sensors.rst b/Documentation/hwmon/hp-wmi-sensors.rst
index a6bca9aecdde..a611c6263074 100644
--- a/Documentation/hwmon/hp-wmi-sensors.rst
+++ b/Documentation/hwmon/hp-wmi-sensors.rst
@@ -2,9 +2,9 @@
 
 .. include:: <isonum.txt>
 
-===========================
-Linux HP WMI Sensors Driver
-===========================
+============================
+Kernel driver hp-wmi-sensors
+============================
 
 :Copyright: |copy| 2023 James Seo <james@equiv.tech>
 
-- 
2.39.2


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

* Re: [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core
  2023-07-22 17:25 ` [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core James Seo
@ 2023-07-22 18:23   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2023-07-22 18:23 UTC (permalink / raw)
  To: James Seo
  Cc: Jean Delvare, linux-hwmon, platform-driver-x86, Jonathan Corbet,
	linux-doc, linux-kernel

On Sat, Jul 22, 2023 at 10:25:13AM -0700, James Seo wrote:
> 2a2b13ae50cf ("platform/x86: wmi: Allow retrieving the number of WMI
> object instances") means we no longer need to find this ourselves.
> 
> Signed-off-by: James Seo <james@equiv.tech>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/hp-wmi-sensors.c | 20 +++-----------------
>  1 file changed, 3 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
> index ebe2fb513480..3a99cc5f44b2 100644
> --- a/drivers/hwmon/hp-wmi-sensors.c
> +++ b/drivers/hwmon/hp-wmi-sensors.c
> @@ -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,
> -- 
> 2.39.2
> 

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

* Re: [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title
  2023-07-22 17:25 ` [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title James Seo
@ 2023-07-22 18:24   ` Guenter Roeck
  2023-07-22 19:12     ` James Seo
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2023-07-22 18:24 UTC (permalink / raw)
  To: James Seo
  Cc: Jean Delvare, linux-hwmon, platform-driver-x86, Jonathan Corbet,
	linux-doc, linux-kernel

On Sat, Jul 22, 2023 at 10:25:14AM -0700, James Seo wrote:
> 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

> ---
>  Documentation/hwmon/hp-wmi-sensors.rst | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/hwmon/hp-wmi-sensors.rst b/Documentation/hwmon/hp-wmi-sensors.rst
> index a6bca9aecdde..a611c6263074 100644
> --- a/Documentation/hwmon/hp-wmi-sensors.rst
> +++ b/Documentation/hwmon/hp-wmi-sensors.rst
> @@ -2,9 +2,9 @@
>  
>  .. include:: <isonum.txt>
>  
> -===========================
> -Linux HP WMI Sensors Driver
> -===========================
> +============================
> +Kernel driver hp-wmi-sensors
> +============================
>  
>  :Copyright: |copy| 2023 James Seo <james@equiv.tech>
>  
> -- 
> 2.39.2
> 

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

* Re: [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title
  2023-07-22 18:24   ` Guenter Roeck
@ 2023-07-22 19:12     ` James Seo
  0 siblings, 0 replies; 6+ messages in thread
From: James Seo @ 2023-07-22 19:12 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Jean Delvare, linux-hwmon, platform-driver-x86, Jonathan Corbet,
	linux-doc, linux-kernel

On Sat, Jul 22, 2023 at 11:24:18AM -0700, Guenter Roeck wrote:
> On Sat, Jul 22, 2023 at 10:25:14AM -0700, James Seo wrote:
>> 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


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

end of thread, other threads:[~2023-07-22 19:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-22 17:25 [PATCH 0/2] hwmon: hp-wmi-sensors: Minor fixes James Seo
2023-07-22 17:25 ` [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core James Seo
2023-07-22 18:23   ` Guenter Roeck
2023-07-22 17:25 ` [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title James Seo
2023-07-22 18:24   ` Guenter Roeck
2023-07-22 19:12     ` James Seo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).