Re: [lm-sensors] [PATCH 1/2] hwmon: (f75375s) Shift control mode tothe correct bit position

From: Jean Delvare
Date: Sun Sep 05 2010 - 12:45:45 EST


Hi Guillem,

On Fri, 3 Sep 2010 04:54:59 +0200, Guillem Jover wrote:
> The spec notes that fan0 and fan1 control mode bits are located in bits
> 7-6 and 5-4 respectively, but the FAN_CTRL_MODE macro was making the
> bits shift by 5 instead of by 4.
>
> Signed-off-by: Guillem Jover <guillem@xxxxxxxxxxx>
> ---
> drivers/hwmon/f75375s.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
> index 0f58ecc..e5828c0 100644
> --- a/drivers/hwmon/f75375s.c
> +++ b/drivers/hwmon/f75375s.c
> @@ -79,7 +79,7 @@ enum chips { f75373, f75375 };
> #define F75375_REG_PWM2_DROP_DUTY 0x6C
>
> #define FAN_CTRL_LINEAR(nr) (4 + nr)
> -#define FAN_CTRL_MODE(nr) (5 + ((nr) * 2))
> +#define FAN_CTRL_MODE(nr) (4 + ((nr) * 2))
>
> /*
> * Data structures and manipulation thereof

Good catch, patch applied, thanks.

Note though that it seems that this driver needs some more love in this
area. Struct f75375_data has a member fan_timer to which the contents
of register 0x60 (F75375_REG_FAN_TIMER) is written in
f75375_update_device(), but this value isn't used anywhere. Secondly,
struct member pwm_mode is _not_ initialized anywhere, although
show_pwm_mode() exports it to user-space. And member pwm_enable is
worse, the fans are set to full speed arbitrarily when the driver is
loaded (in function f75375_init()), which is bad practice. So there is
definitely room for cleanups and improvements, if you are interested in
this driver.

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/