From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: jdelvare@suse.com, linux@roeck-us.net, robh+dt@kernel.org,
mark.rutland@arm.com
Cc: linux-hwmon@vger.kernel.org, corbet@lwn.net,
devicetree@vger.kernel.org, patches@opensource.cirrus.com
Subject: [PATCH 2/3] hwmon: Add convience macro to define simple static sensors
Date: Wed, 20 Mar 2019 14:58:17 +0000 [thread overview]
Message-ID: <20190320145818.30644-2-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20190320145818.30644-1-ckeepax@opensource.cirrus.com>
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>
---
include/linux/hwmon.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 99e0c1b0b5fb3..7a8cc06a0d61d 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -365,6 +365,14 @@ struct hwmon_channel_info {
const u32 *config;
};
+#define HWMON_CHANNEL_INFO(stype, ...) \
+ (&(struct hwmon_channel_info) { \
+ .type = hwmon_##stype, \
+ .config = (u32 []) { \
+ __VA_ARGS__, 0 \
+ } \
+ })
+
/**
* Chip configuration
* @ops: Pointer to hwmon operations.
--
2.11.0
next prev parent reply other threads:[~2019-03-20 14:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-20 14:58 [PATCH 1/3] hwmon: lochnagar: Add device tree binding document Charles Keepax
2019-03-20 14:58 ` Charles Keepax [this message]
2019-03-20 17:38 ` [PATCH 2/3] hwmon: Add convience macro to define simple static sensors Guenter Roeck
2019-03-20 14:58 ` [PATCH 3/3] hwmon: lochnagar: Add Lochnagar 2 hardware monitoring driver Charles Keepax
2019-03-20 16:40 ` Guenter Roeck
2019-03-21 11:59 ` Charles Keepax
2019-03-21 13:14 ` Guenter Roeck
2019-03-21 15:47 ` Charles Keepax
2019-03-21 16:03 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190320145818.30644-2-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mark.rutland@arm.com \
--cc=patches@opensource.cirrus.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).