diff options
author | Guenter Roeck <linux@roeck-us.net> | 2019-03-31 19:22:24 +0200 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-04-16 02:19:53 +0200 |
commit | 6bf2db4621fc1ac7a00bb7b770462211a5b7fdf9 (patch) | |
tree | 0f31dd0e0aa0332163716bfb95f9702eee2ca411 /Documentation/hwmon | |
parent | hwmon: (nct7904) Use new HWMON_CHANNEL_INFO() macro (diff) | |
download | linux-6bf2db4621fc1ac7a00bb7b770462211a5b7fdf9.tar.xz linux-6bf2db4621fc1ac7a00bb7b770462211a5b7fdf9.zip |
hwmon: Documentation: Add usage example for HWMON_CHANNEL_INFO
The new HWMON_CHANNEL_INFO macro simplifies the code, reduces the
likelihood of errors, and makes the code easier to read. Add a usage
example to help driver writers to actually use it.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'Documentation/hwmon')
-rw-r--r-- | Documentation/hwmon/hwmon-kernel-api.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Documentation/hwmon/hwmon-kernel-api.txt b/Documentation/hwmon/hwmon-kernel-api.txt index 8bdefb41be30..f8e2ab5c21b9 100644 --- a/Documentation/hwmon/hwmon-kernel-api.txt +++ b/Documentation/hwmon/hwmon-kernel-api.txt @@ -207,6 +207,19 @@ static const struct hwmon_channel_info *lm75_info[] = { NULL }; +The HWMON_CHANNEL_INFO() macro can and should be used when possible. +With this macro, the above example can be simplified to + +static const struct hwmon_channel_info *lm75_info[] = { + HWMON_CHANNEL_INFO(chip, + HWMON_C_REGISTER_TZ | HWMON_C_UPDATE_INTERVAL), + HWMON_CHANNEL_INFO(temp, + HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST), + NULL +}; + +The remaining declarations are as follows. + static const struct hwmon_ops lm75_hwmon_ops = { .is_visible = lm75_is_visible, .read = lm75_read, |