hwmon fixes for v5.8-rc4

Accumulated hwmon patches:
 - Fix typo in Kconfig SENSORS_IR35221 option
 - Fix potential memory leak in acpi_power_meter_add()
 - Make sure the OVERT mask is set correctly in max6697 driver
 - In PMBus core, fix page vs. register when accessing fans
 - Mark is_visible functions static in bt1-pvt driver
 - Define Temp- and Volt-to-N poly as maybe-unused in bt1-pvt driver
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAl7/quEACgkQyx8mb86f
 mYGSeg/7BaJI66dvQ+r+nRqlyEwJxK7j2a7EvOPwNUNcbBYp5uooXpK+xXcSShYn
 bwPJVREWz6jY5F+pi7vehpXPhRLwdNRZulElYi6GEgd6BvzVQwVcQHAhajqAjvDN
 2ILd+22IAmrWdCfHT0dNvt4+p0HOHsHKva7Jo9HsnLgQVDENg/0iUjKhGSCc3J5Q
 542cdLlO0ExZSW/K1cWL5IazQiVSMeH+VE+53NKOMurj2vMdK0wIoy0NDMSj1sMO
 8/SzvibKZuFUqKgzu3p6IsUSWH2a+v9GsrxvymcfQ7TnsYH7HsdpjA/ggZ1PL9vQ
 bhUkVPRsZwLYbo9YAyH2d64JLLOl2GIRpdfr8yn1wQLsbwpByu1i/uXtdZM0v5Qo
 A8gaqP+ptxVAxtxErDiaw8S4grHIKdsJQuRoh3rwszmPcJ2kKB4V/jPVtrD7v/ag
 eBn9yGx61WSr81I4jY7l+Keg6RTkOXD5KXGinzazWUb6vc/aaN0vLz/Rn4f4Ha8q
 HIFrCciMDaSaecXkT7K6ZVt3Oha4++xWo1ztTJGUC9Lhj5d9AQn0hrO2FiPI6UAs
 qwVNiEwtNDcbVaZTbAsgepEYS9d3ABcz/Nu9tSjCUxqOKt95+/ngh+bBX45fd68q
 fEajLN6Ehy5Lzfrkq30ViUCjE+gxim6zWZpubV91iZCqO7g5EL0=
 =3guP
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-v5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - Fix typo in Kconfig SENSORS_IR35221 option

 - Fix potential memory leak in acpi_power_meter_add()

 - Make sure the OVERT mask is set correctly in max6697 driver

 - In PMBus core, fix page vs. register when accessing fans

 - Mark is_visible functions static in bt1-pvt driver

 - Define Temp- and Volt-to-N poly as maybe-unused in bt1-pvt driver

* tag 'hwmon-for-v5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (pmbus) fix a typo in Kconfig SENSORS_IR35221 option
  hwmon: (acpi_power_meter) Fix potential memory leak in acpi_power_meter_add()
  hwmon: (max6697) Make sure the OVERT mask is set correctly
  hwmon: (pmbus) Fix page vs. register when accessing fans
  hwmon: (bt1-pvt) Mark is_visible functions static
  hwmon: (bt1-pvt) Define Temp- and Volt-to-N poly as maybe-unused
This commit is contained in:
Linus Torvalds 2020-07-03 17:28:16 -07:00
commit 6f216714a6
5 changed files with 18 additions and 15 deletions

View file

@ -883,7 +883,7 @@ static int acpi_power_meter_add(struct acpi_device *device)
res = setup_attrs(resource);
if (res)
goto exit_free;
goto exit_free_capability;
resource->hwmon_dev = hwmon_device_register(&device->dev);
if (IS_ERR(resource->hwmon_dev)) {
@ -896,6 +896,8 @@ static int acpi_power_meter_add(struct acpi_device *device)
exit_remove:
remove_attrs(resource);
exit_free_capability:
free_capabilities(resource);
exit_free:
kfree(resource);
exit:

View file

@ -64,7 +64,7 @@ static const struct pvt_sensor_info pvt_info[] = {
* 48380,
* where T = [-48380, 147438] mC and N = [0, 1023].
*/
static const struct pvt_poly poly_temp_to_N = {
static const struct pvt_poly __maybe_unused poly_temp_to_N = {
.total_divider = 10000,
.terms = {
{4, 18322, 10000, 10000},
@ -96,7 +96,7 @@ static const struct pvt_poly poly_N_to_temp = {
* N = (18658e-3*V - 11572) / 10,
* V = N * 10^5 / 18658 + 11572 * 10^4 / 18658.
*/
static const struct pvt_poly poly_volt_to_N = {
static const struct pvt_poly __maybe_unused poly_volt_to_N = {
.total_divider = 10,
.terms = {
{1, 18658, 1000, 1},
@ -300,12 +300,12 @@ static irqreturn_t pvt_soft_isr(int irq, void *data)
return IRQ_HANDLED;
}
inline umode_t pvt_limit_is_visible(enum pvt_sensor_type type)
static inline umode_t pvt_limit_is_visible(enum pvt_sensor_type type)
{
return 0644;
}
inline umode_t pvt_alarm_is_visible(enum pvt_sensor_type type)
static inline umode_t pvt_alarm_is_visible(enum pvt_sensor_type type)
{
return 0444;
}
@ -462,12 +462,12 @@ static irqreturn_t pvt_hard_isr(int irq, void *data)
#define pvt_soft_isr NULL
inline umode_t pvt_limit_is_visible(enum pvt_sensor_type type)
static inline umode_t pvt_limit_is_visible(enum pvt_sensor_type type)
{
return 0;
}
inline umode_t pvt_alarm_is_visible(enum pvt_sensor_type type)
static inline umode_t pvt_alarm_is_visible(enum pvt_sensor_type type)
{
return 0;
}

View file

@ -38,8 +38,9 @@ static const u8 MAX6697_REG_CRIT[] = {
* Map device tree / platform data register bit map to chip bit map.
* Applies to alert register and over-temperature register.
*/
#define MAX6697_MAP_BITS(reg) ((((reg) & 0x7e) >> 1) | \
#define MAX6697_ALERT_MAP_BITS(reg) ((((reg) & 0x7e) >> 1) | \
(((reg) & 0x01) << 6) | ((reg) & 0x80))
#define MAX6697_OVERT_MAP_BITS(reg) (((reg) >> 1) | (((reg) & 0x01) << 7))
#define MAX6697_REG_STAT(n) (0x44 + (n))
@ -562,12 +563,12 @@ static int max6697_init_chip(struct max6697_data *data,
return ret;
ret = i2c_smbus_write_byte_data(client, MAX6697_REG_ALERT_MASK,
MAX6697_MAP_BITS(pdata->alert_mask));
MAX6697_ALERT_MAP_BITS(pdata->alert_mask));
if (ret < 0)
return ret;
ret = i2c_smbus_write_byte_data(client, MAX6697_REG_OVERT_MASK,
MAX6697_MAP_BITS(pdata->over_temperature_mask));
MAX6697_OVERT_MAP_BITS(pdata->over_temperature_mask));
if (ret < 0)
return ret;

View file

@ -71,7 +71,7 @@ config SENSORS_IR35221
Infineon IR35221 controller.
This driver can also be built as a module. If so, the module will
be called ir35521.
be called ir35221.
config SENSORS_IR38064
tristate "Infineon IR38064"

View file

@ -1869,7 +1869,7 @@ static int pmbus_add_fan_ctrl(struct i2c_client *client,
struct pmbus_sensor *sensor;
sensor = pmbus_add_sensor(data, "fan", "target", index, page,
PMBUS_VIRT_FAN_TARGET_1 + id, 0xff, PSC_FAN,
0xff, PMBUS_VIRT_FAN_TARGET_1 + id, PSC_FAN,
false, false, true);
if (!sensor)
@ -1880,14 +1880,14 @@ static int pmbus_add_fan_ctrl(struct i2c_client *client,
return 0;
sensor = pmbus_add_sensor(data, "pwm", NULL, index, page,
PMBUS_VIRT_PWM_1 + id, 0xff, PSC_PWM,
0xff, PMBUS_VIRT_PWM_1 + id, PSC_PWM,
false, false, true);
if (!sensor)
return -ENOMEM;
sensor = pmbus_add_sensor(data, "pwm", "enable", index, page,
PMBUS_VIRT_PWM_ENABLE_1 + id, 0xff, PSC_PWM,
0xff, PMBUS_VIRT_PWM_ENABLE_1 + id, PSC_PWM,
true, false, false);
if (!sensor)
@ -1929,7 +1929,7 @@ static int pmbus_add_fan_attributes(struct i2c_client *client,
continue;
if (pmbus_add_sensor(data, "fan", "input", index,
page, pmbus_fan_registers[f], 0xff,
page, 0xff, pmbus_fan_registers[f],
PSC_FAN, true, true, true) == NULL)
return -ENOMEM;