Commit 6f216714 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'hwmon-for-v5.8-rc4' of...

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
parents bc2391e7 0d242479
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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:
+6 −6
Original line number Diff line number Diff line
@@ -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;
}
+4 −3
Original line number Diff line number Diff line
@@ -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;

+1 −1
Original line number Diff line number Diff line
@@ -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"
+4 −4
Original line number Diff line number Diff line
@@ -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;