Commit b7ff7151 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'hwmon-for-v6.19-final' of...

Merge tag 'hwmon-for-v6.19-final' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - occ: Mark occ_init_attribute() as __printf to avoid build failure due
   to '-Werror=suggest-attribute=format'

 - gpio-fan: Allow to stop fans when CONFIG_PM is disabled, and fix
   set_rpm() return value

 - acpi_power_meter: Fix deadlocks related to acpi_power_meter_notify()

 - dell-smm: Add Dell G15 5510 to fan control whitelist

* tag 'hwmon-for-v6.19-final' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (occ) Mark occ_init_attribute() as __printf
  hwmon: (gpio-fan) Allow to stop FANs when CONFIG_PM is disabled
  hwmon: (gpio-fan) Fix set_rpm() return value
  hwmon: (acpi_power_meter) Fix deadlocks related to acpi_power_meter_notify()
  hwmon: (dell-smm) Add Dell G15 5510 to fan control whitelist
parents 8185461e 831a2b27
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@
static int cap_in_hardware;
static bool force_cap_on;

static DEFINE_MUTEX(acpi_notify_lock);

static int can_cap_in_hardware(void)
{
	return force_cap_on || cap_in_hardware;
@@ -823,18 +825,26 @@ static void acpi_power_meter_notify(struct acpi_device *device, u32 event)

	resource = acpi_driver_data(device);

	guard(mutex)(&acpi_notify_lock);

	switch (event) {
	case METER_NOTIFY_CONFIG:
		if (!IS_ERR(resource->hwmon_dev))
			hwmon_device_unregister(resource->hwmon_dev);

		mutex_lock(&resource->lock);

		free_capabilities(resource);
		remove_domain_devices(resource);
		hwmon_device_unregister(resource->hwmon_dev);
		res = read_capabilities(resource);
		if (res)
			dev_err_once(&device->dev, "read capabilities failed.\n");
		res = read_domain_devices(resource);
		if (res && res != -ENODEV)
			dev_err_once(&device->dev, "read domain devices failed.\n");

		mutex_unlock(&resource->lock);

		resource->hwmon_dev =
			hwmon_device_register_with_info(&device->dev,
							ACPI_POWER_METER_NAME,
@@ -843,7 +853,7 @@ static void acpi_power_meter_notify(struct acpi_device *device, u32 event)
							power_extra_groups);
		if (IS_ERR(resource->hwmon_dev))
			dev_err_once(&device->dev, "register hwmon device failed.\n");
		mutex_unlock(&resource->lock);

		break;
	case METER_NOTIFY_TRIP:
		sysfs_notify(&device->dev.kobj, NULL, POWER_AVERAGE_NAME);
@@ -953,6 +963,7 @@ static void acpi_power_meter_remove(struct acpi_device *device)
		return;

	resource = acpi_driver_data(device);
	if (!IS_ERR(resource->hwmon_dev))
		hwmon_device_unregister(resource->hwmon_dev);

	remove_domain_devices(resource);
+8 −0
Original line number Diff line number Diff line
@@ -1639,6 +1639,14 @@ static const struct dmi_system_id i8k_whitelist_fan_control[] __initconst = {
		},
		.driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3],
	},
	{
		.ident = "Dell G15 5510",
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Dell G15 5510"),
		},
		.driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3],
	},
	{
		.ident = "Dell G15 5511",
		.matches = {
+3 −3
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ static int set_fan_speed(struct gpio_fan_data *fan_data, int speed_index)
		int ret;

		ret = pm_runtime_put_sync(fan_data->dev);
		if (ret < 0)
		if (ret < 0 && ret != -ENOSYS)
			return ret;
	}

@@ -291,7 +291,7 @@ static ssize_t set_rpm(struct device *dev, struct device_attribute *attr,
{
	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
	unsigned long rpm;
	int ret = count;
	int ret;

	if (kstrtoul(buf, 10, &rpm))
		return -EINVAL;
@@ -308,7 +308,7 @@ static ssize_t set_rpm(struct device *dev, struct device_attribute *attr,
exit_unlock:
	mutex_unlock(&fan_data->lock);

	return ret;
	return ret ? ret : count;
}

static DEVICE_ATTR_RW(pwm1);
+1 −0
Original line number Diff line number Diff line
@@ -749,6 +749,7 @@ static ssize_t occ_show_extended(struct device *dev,
 * are dynamically allocated, we cannot use the existing kernel macros which
 * stringify the name argument.
 */
__printf(7, 8)
static void occ_init_attribute(struct occ_attribute *attr, int mode,
	ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf),
	ssize_t (*store)(struct device *dev, struct device_attribute *attr,