aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/hwmon.h
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2016-08-07 20:51:25 -0700
committerGuenter Roeck <linux@roeck-us.net>2016-12-09 21:54:16 -0800
commite159ab5cb1afb519601a961405933c61cdd5a56a (patch)
tree91cd9bcdfd7910257d29023341a7fdf2fd0007a1 /include/linux/hwmon.h
parenthwmon: (core) Clarify when read and write callbacks are mandatory (diff)
downloadwireguard-linux-e159ab5cb1afb519601a961405933c61cdd5a56a.tar.xz
wireguard-linux-e159ab5cb1afb519601a961405933c61cdd5a56a.zip
hwmon: (core) Add support for string attributes to new API
The new API is so far only suited for data attributes and does not work well for string attributes, specifically for the 'label' attributes. Provide a separate callback function for those. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'include/linux/hwmon.h')
-rw-r--r--include/linux/hwmon.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index b6a86aa4a9e2..e68334aede4c 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -298,7 +298,8 @@ enum hwmon_pwm_attributes {
* Channel number
* The function returns the file permissions.
* If the return value is 0, no attribute will be created.
- * @read: Read callback. Mandatory if readable attributes are present.
+ * @read: Read callback for data attributes. Mandatory if readable
+ * data attributes are present.
* Parameters are:
* @dev: Pointer to hardware monitoring device
* @type: Sensor type
@@ -307,7 +308,19 @@ enum hwmon_pwm_attributes {
* Channel number
* @val: Pointer to returned value
* The function returns 0 on success or a negative error number.
- * @write: Write callback. Mandatory if writeable attributes are present.
+ * @read_string:
+ * Read callback for string attributes. Mandatory if string
+ * attributes are present.
+ * Parameters are:
+ * @dev: Pointer to hardware monitoring device
+ * @type: Sensor type
+ * @attr: Sensor attribute
+ * @channel:
+ * Channel number
+ * @str: Pointer to returned string
+ * The function returns 0 on success or a negative error number.
+ * @write: Write callback for data attributes. Mandatory if writeable
+ * data attributes are present.
* Parameters are:
* @dev: Pointer to hardware monitoring device
* @type: Sensor type
@@ -322,6 +335,8 @@ struct hwmon_ops {
u32 attr, int channel);
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);
int (*write)(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val);
};