[lm-sensors] [PATCH v3] hwmon: (it87) Make temp3 attribute conditional for IT8782F
khali at linux-fr.org
Fri May 11 23:07:59 CEST 2012
On Fri, 11 May 2012 08:49:43 -0700, Guenter Roeck wrote:
> From: Guenter Roeck <linux at roeck-us.net>
> On IT8782F, temp3 is only supported if UART6 is disabled.
> Signed-off-by: Guenter Roeck <linux at roeck-us.net>
> v3: Resolve conflicts with previous patches.
> Only remove temp sysfs attributes if the to-be-removed sensor exists,
> to be in sync with the other attribute removal code.
> v2: Drop condition for IT8783F. On that chip, UART6 may be routed via JP4 to
> a different set of pins, so we can not reliably detect if temp3 and RI6
> overlap or not.
> drivers/hwmon/it87.c | 79 +++++++++++++++++++++++++++++++++++++------------
> 1 files changed, 59 insertions(+), 20 deletions(-)
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index 88771a5..1385320 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
> @@ -2016,6 +2040,11 @@ static int __devinit it87_probe(struct platform_device *pdev)
> data->in_scaled |= (1 << 7); /* in7 is VCCH5V */
> + data->has_temp = 0x07;
> + if (sio_data->skip_temp &&
> + !(it87_read_value(data, IT87_REG_TEMP_EXTRA) & 0x80))
> + data->has_temp &= ~sio_data->skip_temp;
I don't like this. Right now it works because temp3 is the only input
that can be disabled. If there ever is another then it will break and
we may not notice. IMHO it should look more like:
if ((sio_data->skip_temp & (1 << 2)) &&
!(it87_read_value(data, IT87_REG_TEMP_EXTRA) & 0x80))
data->has_temp &= ~(1 << 2);
I would also suggest an additional test on chip type. Right now the
IT8782F is the only one setting sio_data->skip_temp but that might
change in the future.
All the rest looks good. If you agree with the propose changes, you can
Acked-by: Jean Delvare <khali at linux-fr.org>
More information about the lm-sensors