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