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

+26 -6
+14 -3
drivers/hwmon/acpi_power_meter.c
··· 47 static int cap_in_hardware; 48 static bool force_cap_on; 49 50 static int can_cap_in_hardware(void) 51 { 52 return force_cap_on || cap_in_hardware; ··· 825 826 resource = acpi_driver_data(device); 827 828 switch (event) { 829 case METER_NOTIFY_CONFIG: 830 mutex_lock(&resource->lock); 831 free_capabilities(resource); 832 remove_domain_devices(resource); 833 - hwmon_device_unregister(resource->hwmon_dev); 834 res = read_capabilities(resource); 835 if (res) 836 dev_err_once(&device->dev, "read capabilities failed.\n"); 837 res = read_domain_devices(resource); 838 if (res && res != -ENODEV) 839 dev_err_once(&device->dev, "read domain devices failed.\n"); 840 resource->hwmon_dev = 841 hwmon_device_register_with_info(&device->dev, 842 ACPI_POWER_METER_NAME, ··· 853 power_extra_groups); 854 if (IS_ERR(resource->hwmon_dev)) 855 dev_err_once(&device->dev, "register hwmon device failed.\n"); 856 - mutex_unlock(&resource->lock); 857 break; 858 case METER_NOTIFY_TRIP: 859 sysfs_notify(&device->dev.kobj, NULL, POWER_AVERAGE_NAME); ··· 963 return; 964 965 resource = acpi_driver_data(device); 966 - hwmon_device_unregister(resource->hwmon_dev); 967 968 remove_domain_devices(resource); 969 free_capabilities(resource);
··· 47 static int cap_in_hardware; 48 static bool force_cap_on; 49 50 + static DEFINE_MUTEX(acpi_notify_lock); 51 + 52 static int can_cap_in_hardware(void) 53 { 54 return force_cap_on || cap_in_hardware; ··· 823 824 resource = acpi_driver_data(device); 825 826 + guard(mutex)(&acpi_notify_lock); 827 + 828 switch (event) { 829 case METER_NOTIFY_CONFIG: 830 + if (!IS_ERR(resource->hwmon_dev)) 831 + hwmon_device_unregister(resource->hwmon_dev); 832 + 833 mutex_lock(&resource->lock); 834 + 835 free_capabilities(resource); 836 remove_domain_devices(resource); 837 res = read_capabilities(resource); 838 if (res) 839 dev_err_once(&device->dev, "read capabilities failed.\n"); 840 res = read_domain_devices(resource); 841 if (res && res != -ENODEV) 842 dev_err_once(&device->dev, "read domain devices failed.\n"); 843 + 844 + mutex_unlock(&resource->lock); 845 + 846 resource->hwmon_dev = 847 hwmon_device_register_with_info(&device->dev, 848 ACPI_POWER_METER_NAME, ··· 843 power_extra_groups); 844 if (IS_ERR(resource->hwmon_dev)) 845 dev_err_once(&device->dev, "register hwmon device failed.\n"); 846 + 847 break; 848 case METER_NOTIFY_TRIP: 849 sysfs_notify(&device->dev.kobj, NULL, POWER_AVERAGE_NAME); ··· 953 return; 954 955 resource = acpi_driver_data(device); 956 + if (!IS_ERR(resource->hwmon_dev)) 957 + hwmon_device_unregister(resource->hwmon_dev); 958 959 remove_domain_devices(resource); 960 free_capabilities(resource);
+8
drivers/hwmon/dell-smm-hwmon.c
··· 1640 .driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3], 1641 }, 1642 { 1643 .ident = "Dell G15 5511", 1644 .matches = { 1645 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
··· 1640 .driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3], 1641 }, 1642 { 1643 + .ident = "Dell G15 5510", 1644 + .matches = { 1645 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1646 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Dell G15 5510"), 1647 + }, 1648 + .driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3], 1649 + }, 1650 + { 1651 .ident = "Dell G15 5511", 1652 .matches = { 1653 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+3 -3
drivers/hwmon/gpio-fan.c
··· 148 int ret; 149 150 ret = pm_runtime_put_sync(fan_data->dev); 151 - if (ret < 0) 152 return ret; 153 } 154 ··· 291 { 292 struct gpio_fan_data *fan_data = dev_get_drvdata(dev); 293 unsigned long rpm; 294 - int ret = count; 295 296 if (kstrtoul(buf, 10, &rpm)) 297 return -EINVAL; ··· 308 exit_unlock: 309 mutex_unlock(&fan_data->lock); 310 311 - return ret; 312 } 313 314 static DEVICE_ATTR_RW(pwm1);
··· 148 int ret; 149 150 ret = pm_runtime_put_sync(fan_data->dev); 151 + if (ret < 0 && ret != -ENOSYS) 152 return ret; 153 } 154 ··· 291 { 292 struct gpio_fan_data *fan_data = dev_get_drvdata(dev); 293 unsigned long rpm; 294 + int ret; 295 296 if (kstrtoul(buf, 10, &rpm)) 297 return -EINVAL; ··· 308 exit_unlock: 309 mutex_unlock(&fan_data->lock); 310 311 + return ret ? ret : count; 312 } 313 314 static DEVICE_ATTR_RW(pwm1);
+1
drivers/hwmon/occ/common.c
··· 749 * are dynamically allocated, we cannot use the existing kernel macros which 750 * stringify the name argument. 751 */ 752 static void occ_init_attribute(struct occ_attribute *attr, int mode, 753 ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf), 754 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
··· 749 * are dynamically allocated, we cannot use the existing kernel macros which 750 * stringify the name argument. 751 */ 752 + __printf(7, 8) 753 static void occ_init_attribute(struct occ_attribute *attr, int mode, 754 ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf), 755 ssize_t (*store)(struct device *dev, struct device_attribute *attr,