Skip to content

Commit

Permalink
Merge tag 'hwmon-for-v5.8-rc4' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Linus Torvalds committed Jul 4, 2020
2 parents bc2391e + 0d24247 commit 6f21671
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
4 changes: 3 additions & 1 deletion drivers/hwmon/acpi_power_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions drivers/hwmon/bt1-pvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 4 additions & 3 deletions drivers/hwmon/max6697.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/pmbus/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions drivers/hwmon/pmbus/pmbus_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 6f21671

Please sign in to comment.