diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-26 12:34:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-26 12:34:31 -0500 |
commit | 6f8b52ba442ce1372a58df4e85f169686ef52a0d (patch) | |
tree | 5dd92d4b683559ecbdbd905352f792f5de9637c2 | |
parent | 2e6e902d185027f8e3cb8b7305238f7e35d6a436 (diff) | |
parent | 09aaf6813cfca4c18034fda7a43e68763f34abb1 (diff) |
Merge tag 'hwmon-for-v4.20-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck:
- fix temp4_type attribute permissions in w83795 driver
- fix tacho fault detection in mlxreg-fan driver
- fix current value calculations in ina2xx driver
- fix initial notification/warning in raspberrypi driver
- fix a NULL pointer access in ina2xx
* tag 'hwmon-for-v4.20-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (w83795) temp4_type has writable permission
hwmon: (mlxreg-fan) Fix macros for tacho fault reading
hwmon: (ina2xx) Fix current value calculation
hwmon: (raspberrypi) Fix initial notify
hwmon (ina2xx) Fix NULL id pointer in probe()
-rw-r--r-- | drivers/hwmon/ina2xx.c | 6 | ||||
-rw-r--r-- | drivers/hwmon/mlxreg-fan.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/raspberrypi-hwmon.c | 6 | ||||
-rw-r--r-- | drivers/hwmon/w83795.c | 2 |
4 files changed, 5 insertions, 11 deletions
diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 71d3445ba869..07ee19573b3f 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c | |||
@@ -274,7 +274,7 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg, | |||
274 | break; | 274 | break; |
275 | case INA2XX_CURRENT: | 275 | case INA2XX_CURRENT: |
276 | /* signed register, result in mA */ | 276 | /* signed register, result in mA */ |
277 | val = regval * data->current_lsb_uA; | 277 | val = (s16)regval * data->current_lsb_uA; |
278 | val = DIV_ROUND_CLOSEST(val, 1000); | 278 | val = DIV_ROUND_CLOSEST(val, 1000); |
279 | break; | 279 | break; |
280 | case INA2XX_CALIBRATION: | 280 | case INA2XX_CALIBRATION: |
@@ -491,7 +491,7 @@ static int ina2xx_probe(struct i2c_client *client, | |||
491 | } | 491 | } |
492 | 492 | ||
493 | data->groups[group++] = &ina2xx_group; | 493 | data->groups[group++] = &ina2xx_group; |
494 | if (id->driver_data == ina226) | 494 | if (chip == ina226) |
495 | data->groups[group++] = &ina226_group; | 495 | data->groups[group++] = &ina226_group; |
496 | 496 | ||
497 | hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, | 497 | hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, |
@@ -500,7 +500,7 @@ static int ina2xx_probe(struct i2c_client *client, | |||
500 | return PTR_ERR(hwmon_dev); | 500 | return PTR_ERR(hwmon_dev); |
501 | 501 | ||
502 | dev_info(dev, "power monitor %s (Rshunt = %li uOhm)\n", | 502 | dev_info(dev, "power monitor %s (Rshunt = %li uOhm)\n", |
503 | id->name, data->rshunt); | 503 | client->name, data->rshunt); |
504 | 504 | ||
505 | return 0; | 505 | return 0; |
506 | } | 506 | } |
diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c index de46577c7d5a..d8fa4bea4bc8 100644 --- a/drivers/hwmon/mlxreg-fan.c +++ b/drivers/hwmon/mlxreg-fan.c | |||
@@ -51,7 +51,7 @@ | |||
51 | */ | 51 | */ |
52 | #define MLXREG_FAN_GET_RPM(rval, d, s) (DIV_ROUND_CLOSEST(15000000 * 100, \ | 52 | #define MLXREG_FAN_GET_RPM(rval, d, s) (DIV_ROUND_CLOSEST(15000000 * 100, \ |
53 | ((rval) + (s)) * (d))) | 53 | ((rval) + (s)) * (d))) |
54 | #define MLXREG_FAN_GET_FAULT(val, mask) (!!((val) ^ (mask))) | 54 | #define MLXREG_FAN_GET_FAULT(val, mask) (!((val) ^ (mask))) |
55 | #define MLXREG_FAN_PWM_DUTY2STATE(duty) (DIV_ROUND_CLOSEST((duty) * \ | 55 | #define MLXREG_FAN_PWM_DUTY2STATE(duty) (DIV_ROUND_CLOSEST((duty) * \ |
56 | MLXREG_FAN_MAX_STATE, \ | 56 | MLXREG_FAN_MAX_STATE, \ |
57 | MLXREG_FAN_MAX_DUTY)) | 57 | MLXREG_FAN_MAX_DUTY)) |
diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c index be5ba4690895..0d0457245e7d 100644 --- a/drivers/hwmon/raspberrypi-hwmon.c +++ b/drivers/hwmon/raspberrypi-hwmon.c | |||
@@ -115,7 +115,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev) | |||
115 | { | 115 | { |
116 | struct device *dev = &pdev->dev; | 116 | struct device *dev = &pdev->dev; |
117 | struct rpi_hwmon_data *data; | 117 | struct rpi_hwmon_data *data; |
118 | int ret; | ||
119 | 118 | ||
120 | data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); | 119 | data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); |
121 | if (!data) | 120 | if (!data) |
@@ -124,11 +123,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev) | |||
124 | /* Parent driver assure that firmware is correct */ | 123 | /* Parent driver assure that firmware is correct */ |
125 | data->fw = dev_get_drvdata(dev->parent); | 124 | data->fw = dev_get_drvdata(dev->parent); |
126 | 125 | ||
127 | /* Init throttled */ | ||
128 | ret = rpi_firmware_property(data->fw, RPI_FIRMWARE_GET_THROTTLED, | ||
129 | &data->last_throttled, | ||
130 | sizeof(data->last_throttled)); | ||
131 | |||
132 | data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "rpi_volt", | 126 | data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "rpi_volt", |
133 | data, | 127 | data, |
134 | &rpi_chip_info, | 128 | &rpi_chip_info, |
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c index 49276bbdac3d..1bb80f992aa8 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c | |||
@@ -1691,7 +1691,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr, | |||
1691 | * somewhere else in the code | 1691 | * somewhere else in the code |
1692 | */ | 1692 | */ |
1693 | #define SENSOR_ATTR_TEMP(index) { \ | 1693 | #define SENSOR_ATTR_TEMP(index) { \ |
1694 | SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 4 ? S_IWUSR : 0), \ | 1694 | SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 5 ? S_IWUSR : 0), \ |
1695 | show_temp_mode, store_temp_mode, NOT_USED, index - 1), \ | 1695 | show_temp_mode, store_temp_mode, NOT_USED, index - 1), \ |
1696 | SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp, \ | 1696 | SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp, \ |
1697 | NULL, TEMP_READ, index - 1), \ | 1697 | NULL, TEMP_READ, index - 1), \ |