hwmon fixes for v4.20-rc5

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
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJb+zQJAAoJEMsfJm/On5mBm64QAImjnsOKTNb50rZRYz5fwhQC
 2UJiDkVnHFHxfY8akV/7Qgzii/++VbVZww78poIPX4FggPUXP970aWir+UbVR+Av
 1MecoV5IgNOTVzOyLF3nKWD44ikeXEyEZbtcTvCK/4L6XSCO3eNd9D4blLnVwxqI
 +Ku1ak+IgG3GTmZ/O3VIB43i8eXp6jvBbIlZkxBnSAFvTDRm5w46b5hFkJw3ZUwg
 nn2RNq/ICse6w8ByPebhV7deS3ZUK8fevw2mcI03+qXOqCWfMAZlhsBUlXv1IncG
 pL8fuO+gDpzgPSGvih7S6MGvDlajHATuFBcEx5OHoK89D6rQUZfPVV+zAnxQFKiT
 kUbMHAuOIZ94Sjm8tma2OE1yFlKtDOT1v2Yi3AKvWtOKq6R/qWB5xaugZfz9Ve+b
 K1wC/91wBcnnzrD+RqO/98vxemxPsk98AetSLvJfB99sARI2iXrn+Z1rNXXWRceF
 +TCfHg5PPnTTJleOzjE570A+fR1+i1ifdBekzZLtUYkXcRyNfPKj+50pPf7lU+fN
 0d+gBPt4Z+deftGbOKJmDG4/Bh6Bc1SmO8ovuQkeOd8OUHa37Qu8DimNaaSkiLPQ
 E0iLeT5x01Ot4OhSZOj15Lc1GZT02vQg3Z3IKsXaKFq9WOxGYeIeKSPnkLMf6+lg
 u3FGAGSaxDAEW5rCLGOE
 =/T5W
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Torvalds 2018-11-26 09:34:31 -08:00
commit 6f8b52ba44
4 changed files with 5 additions and 11 deletions

View File

@ -274,7 +274,7 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg,
break;
case INA2XX_CURRENT:
/* signed register, result in mA */
val = regval * data->current_lsb_uA;
val = (s16)regval * data->current_lsb_uA;
val = DIV_ROUND_CLOSEST(val, 1000);
break;
case INA2XX_CALIBRATION:
@ -491,7 +491,7 @@ static int ina2xx_probe(struct i2c_client *client,
}
data->groups[group++] = &ina2xx_group;
if (id->driver_data == ina226)
if (chip == ina226)
data->groups[group++] = &ina226_group;
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
@ -500,7 +500,7 @@ static int ina2xx_probe(struct i2c_client *client,
return PTR_ERR(hwmon_dev);
dev_info(dev, "power monitor %s (Rshunt = %li uOhm)\n",
id->name, data->rshunt);
client->name, data->rshunt);
return 0;
}

View File

@ -51,7 +51,7 @@
*/
#define MLXREG_FAN_GET_RPM(rval, d, s) (DIV_ROUND_CLOSEST(15000000 * 100, \
((rval) + (s)) * (d)))
#define MLXREG_FAN_GET_FAULT(val, mask) (!!((val) ^ (mask)))
#define MLXREG_FAN_GET_FAULT(val, mask) (!((val) ^ (mask)))
#define MLXREG_FAN_PWM_DUTY2STATE(duty) (DIV_ROUND_CLOSEST((duty) * \
MLXREG_FAN_MAX_STATE, \
MLXREG_FAN_MAX_DUTY))

View File

@ -115,7 +115,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct rpi_hwmon_data *data;
int ret;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
@ -124,11 +123,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
/* Parent driver assure that firmware is correct */
data->fw = dev_get_drvdata(dev->parent);
/* Init throttled */
ret = rpi_firmware_property(data->fw, RPI_FIRMWARE_GET_THROTTLED,
&data->last_throttled,
sizeof(data->last_throttled));
data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "rpi_volt",
data,
&rpi_chip_info,

View File

@ -1691,7 +1691,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
* somewhere else in the code
*/
#define SENSOR_ATTR_TEMP(index) { \
SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 4 ? S_IWUSR : 0), \
SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 5 ? S_IWUSR : 0), \
show_temp_mode, store_temp_mode, NOT_USED, index - 1), \
SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp, \
NULL, TEMP_READ, index - 1), \