linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (nct6775) mask out bank number in nct6775_wmi_read_value()
@ 2021-11-11  2:53 Zev Weiss
  2021-11-11  9:14 ` Andy Shevchenko
  2021-11-14 16:53 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Zev Weiss @ 2021-11-11  2:53 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Zev Weiss, Guenter Roeck, Jean Delvare, Denis Pauk,
	Bernhard Seibold, Andy Shevchenko, Oleksandr Natalenko,
	linux-kernel

The first call to nct6775_asuswmi_read() in nct6775_wmi_read_value()
had been passing the full bank+register number instead of just the
lower 8 bits.  It didn't end up actually causing problems because the
second argument of that function is a u8 anyway, but it seems
preferable to be explicit about it at the call site (and consistent
with the rest of the code).

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Fixes: 3fbbfc27f955 ("hwmon: (nct6775) Support access via Asus WMI")
---
 drivers/hwmon/nct6775.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 93dca471972e..57ce8633a725 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -1527,7 +1527,7 @@ static u16 nct6775_wmi_read_value(struct nct6775_data *data, u16 reg)
 
 	nct6775_wmi_set_bank(data, reg);
 
-	err = nct6775_asuswmi_read(data->bank, reg, &tmp);
+	err = nct6775_asuswmi_read(data->bank, reg & 0xff, &tmp);
 	if (err)
 		return 0;
 
-- 
2.33.1


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

* Re: [PATCH] hwmon: (nct6775) mask out bank number in nct6775_wmi_read_value()
  2021-11-11  2:53 [PATCH] hwmon: (nct6775) mask out bank number in nct6775_wmi_read_value() Zev Weiss
@ 2021-11-11  9:14 ` Andy Shevchenko
  2021-11-14 16:53 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-11-11  9:14 UTC (permalink / raw)
  To: Zev Weiss
  Cc: linux-hwmon, Guenter Roeck, Jean Delvare, Denis Pauk,
	Bernhard Seibold, Oleksandr Natalenko, Linux Kernel Mailing List

On Thu, Nov 11, 2021 at 4:53 AM Zev Weiss <zev@bewilderbeest.net> wrote:
>
> The first call to nct6775_asuswmi_read() in nct6775_wmi_read_value()
> had been passing the full bank+register number instead of just the
> lower 8 bits.

>  It didn't end up actually causing problems because the
> second argument of that function is a u8 anyway,

It contradicts the existence of the Fixes tag below. What do you fix then?

> but it seems
> preferable to be explicit about it at the call site (and consistent
> with the rest of the code).

Yeah, in the current state it makes sense.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Later one may refactor this to drop that tons of ' & 0xff':s.

> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> Fixes: 3fbbfc27f955 ("hwmon: (nct6775) Support access via Asus WMI")
> ---
>  drivers/hwmon/nct6775.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
> index 93dca471972e..57ce8633a725 100644
> --- a/drivers/hwmon/nct6775.c
> +++ b/drivers/hwmon/nct6775.c
> @@ -1527,7 +1527,7 @@ static u16 nct6775_wmi_read_value(struct nct6775_data *data, u16 reg)
>
>         nct6775_wmi_set_bank(data, reg);
>
> -       err = nct6775_asuswmi_read(data->bank, reg, &tmp);
> +       err = nct6775_asuswmi_read(data->bank, reg & 0xff, &tmp);
>         if (err)
>                 return 0;

> 2.33.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] hwmon: (nct6775) mask out bank number in nct6775_wmi_read_value()
  2021-11-11  2:53 [PATCH] hwmon: (nct6775) mask out bank number in nct6775_wmi_read_value() Zev Weiss
  2021-11-11  9:14 ` Andy Shevchenko
@ 2021-11-14 16:53 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-11-14 16:53 UTC (permalink / raw)
  To: Zev Weiss
  Cc: linux-hwmon, Jean Delvare, Denis Pauk, Bernhard Seibold,
	Andy Shevchenko, Oleksandr Natalenko, linux-kernel

On Wed, Nov 10, 2021 at 06:53:38PM -0800, Zev Weiss wrote:
> The first call to nct6775_asuswmi_read() in nct6775_wmi_read_value()
> had been passing the full bank+register number instead of just the
> lower 8 bits.  It didn't end up actually causing problems because the
> second argument of that function is a u8 anyway, but it seems
> preferable to be explicit about it at the call site (and consistent
> with the rest of the code).
> 
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> Fixes: 3fbbfc27f955 ("hwmon: (nct6775) Support access via Asus WMI")
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/nct6775.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
> index 93dca471972e..57ce8633a725 100644
> --- a/drivers/hwmon/nct6775.c
> +++ b/drivers/hwmon/nct6775.c
> @@ -1527,7 +1527,7 @@ static u16 nct6775_wmi_read_value(struct nct6775_data *data, u16 reg)
>  
>  	nct6775_wmi_set_bank(data, reg);
>  
> -	err = nct6775_asuswmi_read(data->bank, reg, &tmp);
> +	err = nct6775_asuswmi_read(data->bank, reg & 0xff, &tmp);
>  	if (err)
>  		return 0;
>  

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

end of thread, other threads:[~2021-11-14 16:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11  2:53 [PATCH] hwmon: (nct6775) mask out bank number in nct6775_wmi_read_value() Zev Weiss
2021-11-11  9:14 ` Andy Shevchenko
2021-11-14 16:53 ` Guenter Roeck

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