diff mbox series

[1/7] hwmon: (hp-wmi-sensors) Use the WMI bus API when accessing sensors

Message ID 20250203182322.384883-2-W_Armin@gmx.de (mailing list archive)
State New
Headers show
Series platform/x86: wmi: Rework WMI device enabling | expand

Commit Message

Armin Wolf Feb. 3, 2025, 6:23 p.m. UTC
Since the driver already binds to HP_WMI_NUMERIC_SENSOR_GUID, using
wmidev_block_query() allows for faster sensor access.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/hwmon/hp-wmi-sensors.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.39.5

Comments

James Seo Feb. 4, 2025, 12:41 a.m. UTC | #1
On Mon, Feb 03, 2025 at 07:23:16PM +0100, Armin Wolf wrote:
> Since the driver already binds to HP_WMI_NUMERIC_SENSOR_GUID, using
> wmidev_block_query() allows for faster sensor access.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> ---
>  drivers/hwmon/hp-wmi-sensors.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
> index d6bdad26feb1..03c684ba83bd 100644
> --- a/drivers/hwmon/hp-wmi-sensors.c
> +++ b/drivers/hwmon/hp-wmi-sensors.c
> @@ -1197,7 +1197,7 @@ static int hp_wmi_update_info(struct hp_wmi_sensors *state,
>  	if (time_after(jiffies, info->last_updated + HZ)) {
>  		mutex_lock(&state->lock);
> 
> -		wobj = hp_wmi_get_wobj(HP_WMI_NUMERIC_SENSOR_GUID, instance);
> +		wobj = wmidev_block_query(state->wdev, instance);
>  		if (!wobj) {
>  			ret = -EIO;
>  			goto out_unlock;
> @@ -1745,7 +1745,7 @@ static int init_numeric_sensors(struct hp_wmi_sensors *state,
>  		return -ENOMEM;
> 
>  	for (i = 0, info = info_arr; i < icount; i++, info++) {
> -		wobj = hp_wmi_get_wobj(HP_WMI_NUMERIC_SENSOR_GUID, i);
> +		wobj = wmidev_block_query(state->wdev, i);
>  		if (!wobj)
>  			return -EIO;
> 
> --
> 2.39.5
>
Works on a HP Z420.

Reviewed-by: James Seo <james@equiv.tech>
Guenter Roeck Feb. 4, 2025, 1:18 a.m. UTC | #2
On 2/3/25 10:23, Armin Wolf wrote:
> Since the driver already binds to HP_WMI_NUMERIC_SENSOR_GUID, using
> wmidev_block_query() allows for faster sensor access.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Acked-by: Guenter Roeck <linux@roeck-us.net>

... assuming the series will be applied together. Please let me know
if this patch should be applied through hwmon.

Guenter
Armin Wolf Feb. 4, 2025, 9:41 a.m. UTC | #3
Am 04.02.25 um 02:18 schrieb Guenter Roeck:

> On 2/3/25 10:23, Armin Wolf wrote:
>> Since the driver already binds to HP_WMI_NUMERIC_SENSOR_GUID, using
>> wmidev_block_query() allows for faster sensor access.
>>
>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>
> Acked-by: Guenter Roeck <linux@roeck-us.net>
>
> ... assuming the series will be applied together. Please let me know
> if this patch should be applied through hwmon.
>
> Guenter

Hi,

i would like to have this patch merged through the pdx86 tree.

Thanks,
Armin Wolf
diff mbox series

Patch

diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
index d6bdad26feb1..03c684ba83bd 100644
--- a/drivers/hwmon/hp-wmi-sensors.c
+++ b/drivers/hwmon/hp-wmi-sensors.c
@@ -1197,7 +1197,7 @@  static int hp_wmi_update_info(struct hp_wmi_sensors *state,
 	if (time_after(jiffies, info->last_updated + HZ)) {
 		mutex_lock(&state->lock);

-		wobj = hp_wmi_get_wobj(HP_WMI_NUMERIC_SENSOR_GUID, instance);
+		wobj = wmidev_block_query(state->wdev, instance);
 		if (!wobj) {
 			ret = -EIO;
 			goto out_unlock;
@@ -1745,7 +1745,7 @@  static int init_numeric_sensors(struct hp_wmi_sensors *state,
 		return -ENOMEM;

 	for (i = 0, info = info_arr; i < icount; i++, info++) {
-		wobj = hp_wmi_get_wobj(HP_WMI_NUMERIC_SENSOR_GUID, i);
+		wobj = wmidev_block_query(state->wdev, i);
 		if (!wobj)
 			return -EIO;