Skip to content

Commit c43a113

Browse files
charleskeepaxgroeck
authored andcommitted
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>
1 parent b429ebc commit c43a113

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/linux/hwmon.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,14 @@ struct hwmon_channel_info {
365365
const u32 *config;
366366
};
367367

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+
368376
/**
369377
* Chip configuration
370378
* @ops: Pointer to hwmon operations.

0 commit comments

Comments
 (0)