(...)
@@ -1477,36 +1332,36 @@ static int lm90_temp_write(struct device *dev, u32 attr, int channel, long val)
switch (attr) {
case hwmon_temp_min:
- if (channel == 0)
- err = lm90_set_temp8(data,
- lm90_temp_min_index[channel],
- val);
- else
- err = lm90_set_temp11(data,
- lm90_temp_min_index[channel],
- val);
+ err = lm90_set_temp(data, lm90_temp_min_index[channel],
+ channel, val);
break;
case hwmon_temp_max:
- if (channel == 0)
- err = lm90_set_temp8(data,
- lm90_temp_max_index[channel],
- val);
- else
- err = lm90_set_temp11(data,
- lm90_temp_max_index[channel],
- val);
+ err = lm90_set_temp(data, lm90_temp_max_index[channel],
+ channel, val);
break;
case hwmon_temp_crit:
- err = lm90_set_temp8(data, lm90_temp_crit_index[channel], val);
+ err = lm90_set_temp(data, lm90_temp_crit_index[channel],
+ channel, val);
break;
case hwmon_temp_crit_hyst:
err = lm90_set_temphyst(data, val);
break;
case hwmon_temp_emergency:
- err = lm90_set_temp8(data, lm90_temp_emerg_index[channel], val);
+ err = lm90_set_temp(data, lm90_temp_emerg_index[channel],
+ channel, val);
break;
case hwmon_temp_offset:
- err = lm90_set_temp11(data, REMOTE_OFFSET, val);
+ val = lm90_temp_to_reg(0, val,
+ lm90_temp_get_resolution(data, REMOTE_OFFSET));
+ data->temp[REMOTE_OFFSET] = val;