aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--drivers/hwmon/acpi_power_meter.c17
-rw-r--r--drivers/hwmon/dell-smm-hwmon.c8
-rw-r--r--drivers/hwmon/gpio-fan.c6
-rw-r--r--drivers/hwmon/occ/common.c1
4 files changed, 26 insertions, 6 deletions
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index 29ccdc2fb7ff..de408df0c4d7 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -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,7 +963,8 @@ static void acpi_power_meter_remove(struct acpi_device *device)
return;
resource = acpi_driver_data(device);
- hwmon_device_unregister(resource->hwmon_dev);
+ if (!IS_ERR(resource->hwmon_dev))
+ hwmon_device_unregister(resource->hwmon_dev);
remove_domain_devices(resource);
free_capabilities(resource);
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index 6040a8940674..93143cfc157c 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -1640,6 +1640,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 = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index 516c34bb61c9..a8892ced1e54 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -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);
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index b3694a4209b9..89928d38831b 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -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,