diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2019-03-20 10:58:17 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-04-15 20:19:53 -0400 |
commit | c43a113ca2c807c3e66a5de0ec57d69803b8bc10 (patch) | |
tree | 50c0115ea1f1177c373ff2c3f8f32529fba851f8 | |
parent | b429ebc86f2e389ba9388fdfac64dc30c70d21a6 (diff) |
hwmon: Add convience macro to define simple static sensors
It takes a fair amount of boiler plate code to add new sensors, add a
macro that can be used to specify simple static sensors.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | include/linux/hwmon.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 99e0c1b0b5fb..7a8cc06a0d61 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h | |||
@@ -365,6 +365,14 @@ struct hwmon_channel_info { | |||
365 | const u32 *config; | 365 | const u32 *config; |
366 | }; | 366 | }; |
367 | 367 | ||
368 | #define HWMON_CHANNEL_INFO(stype, ...) \ | ||
369 | (&(struct hwmon_channel_info) { \ | ||
370 | .type = hwmon_##stype, \ | ||
371 | .config = (u32 []) { \ | ||
372 | __VA_ARGS__, 0 \ | ||
373 | } \ | ||
374 | }) | ||
375 | |||
368 | /** | 376 | /** |
369 | * Chip configuration | 377 | * Chip configuration |
370 | * @ops: Pointer to hwmon operations. | 378 | * @ops: Pointer to hwmon operations. |