Skip to content

Commit 5c102d0

Browse files
committed
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
2 parents a16152c + 000e094 commit 5c102d0

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

drivers/hwmon/ads1015.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel,
126126
struct ads1015_data *data = i2c_get_clientdata(client);
127127
unsigned int pga = data->channel_data[channel].pga;
128128
int fullscale = fullscale_table[pga];
129-
const unsigned mask = data->id == ads1115 ? 0x7fff : 0x7ff0;
129+
const int mask = data->id == ads1115 ? 0x7fff : 0x7ff0;
130130

131131
return DIV_ROUND_CLOSEST(reg * fullscale, mask);
132132
}

drivers/hwmon/gpio-fan.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,16 +406,11 @@ static int gpio_fan_get_cur_state(struct thermal_cooling_device *cdev,
406406
unsigned long *state)
407407
{
408408
struct gpio_fan_data *fan_data = cdev->devdata;
409-
int r;
410409

411410
if (!fan_data)
412411
return -EINVAL;
413412

414-
r = get_fan_speed_index(fan_data);
415-
if (r < 0)
416-
return r;
417-
418-
*state = r;
413+
*state = fan_data->speed_index;
419414
return 0;
420415
}
421416

0 commit comments

Comments
 (0)