Commit 5c102d0e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hwmon-for-linus-v4.5-rc6' of...

Merge tag 'hwmon-for-linus-v4.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:
 "Two fixes headed for stable:

   - Remove an unnecessary speed_index lookup for thermal hook in the
     gpio-fan driver.  The unnecessary speed lookup can hog the system.

   - Handle negative conversion values correctly in the ads1015 driver"

* tag 'hwmon-for-linus-v4.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (gpio-fan) Remove un-necessary speed_index lookup for thermal hook
  hwmon: (ads1015) Handle negative conversion values correctly
parents a16152c8 000e0949
...@@ -126,7 +126,7 @@ static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel, ...@@ -126,7 +126,7 @@ static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel,
struct ads1015_data *data = i2c_get_clientdata(client); struct ads1015_data *data = i2c_get_clientdata(client);
unsigned int pga = data->channel_data[channel].pga; unsigned int pga = data->channel_data[channel].pga;
int fullscale = fullscale_table[pga]; int fullscale = fullscale_table[pga];
const unsigned mask = data->id == ads1115 ? 0x7fff : 0x7ff0; const int mask = data->id == ads1115 ? 0x7fff : 0x7ff0;
return DIV_ROUND_CLOSEST(reg * fullscale, mask); return DIV_ROUND_CLOSEST(reg * fullscale, mask);
} }
......
...@@ -406,16 +406,11 @@ static int gpio_fan_get_cur_state(struct thermal_cooling_device *cdev, ...@@ -406,16 +406,11 @@ static int gpio_fan_get_cur_state(struct thermal_cooling_device *cdev,
unsigned long *state) unsigned long *state)
{ {
struct gpio_fan_data *fan_data = cdev->devdata; struct gpio_fan_data *fan_data = cdev->devdata;
int r;
if (!fan_data) if (!fan_data)
return -EINVAL; return -EINVAL;
r = get_fan_speed_index(fan_data); *state = fan_data->speed_index;
if (r < 0)
return r;
*state = r;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment