hwmon: Constify str parameter of hwmon_ops->read_string
authorJean Delvare <jdelvare@suse.de>
Tue, 7 Mar 2017 14:15:15 +0000 (06:15 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 2 Apr 2017 14:01:53 +0000 (07:01 -0700)
The read_string callback is supposed to retrieve a pointer to a
constant string.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/hwmon.c
include/linux/hwmon.h

index 28375d5..dd6e17c 100644 (file)
@@ -186,7 +186,7 @@ static ssize_t hwmon_attr_show_string(struct device *dev,
                                      char *buf)
 {
        struct hwmon_device_attribute *hattr = to_hwmon_attr(devattr);
-       char *s;
+       const char *s;
        int ret;
 
        ret = hattr->ops->read_string(dev, hattr->type, hattr->attr,
index 88b6737..ceb7519 100644 (file)
@@ -337,7 +337,7 @@ struct hwmon_ops {
        int (*read)(struct device *dev, enum hwmon_sensor_types type,
                    u32 attr, int channel, long *val);
        int (*read_string)(struct device *dev, enum hwmon_sensor_types type,
-                   u32 attr, int channel, char **str);
+                   u32 attr, int channel, const char **str);
        int (*write)(struct device *dev, enum hwmon_sensor_types type,
                     u32 attr, int channel, long val);
 };