From: David Lechner <dlechner@baylibre.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Julien Stephan" <jstephan@baylibre.com>,
"Esteban Blanc" <eblanc@baylibre.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RFC 1/4] iio: introduce struct iio_scan_type
Date: Tue, 7 May 2024 14:02:05 -0500 [thread overview]
Message-ID: <20240507-iio-add-support-for-multiple-scan-types-v1-1-95ac33ee51e9@baylibre.com> (raw)
In-Reply-To: <20240507-iio-add-support-for-multiple-scan-types-v1-0-95ac33ee51e9@baylibre.com>
This gives the channel scan_type a named type so that it can be used
to simplify code in later commits.
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
include/linux/iio/iio.h | 41 ++++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 55e2b22086a1..19de573a944a 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -173,6 +173,27 @@ struct iio_event_spec {
unsigned long mask_shared_by_all;
};
+/**
+ * struct iio_scan_type - specification for channel data format in buffer
+ * @sign: 's' or 'u' to specify signed or unsigned
+ * @realbits: Number of valid bits of data
+ * @storagebits: Realbits + padding
+ * @shift: Shift right by this before masking out realbits.
+ * @repeat: Number of times real/storage bits repeats. When the
+ * repeat element is more than 1, then the type element in
+ * sysfs will show a repeat value. Otherwise, the number
+ * of repetitions is omitted.
+ * @endianness: little or big endian
+ */
+struct iio_scan_type {
+ char sign;
+ u8 realbits;
+ u8 storagebits;
+ u8 shift;
+ u8 repeat;
+ enum iio_endian endianness;
+};
+
/**
* struct iio_chan_spec - specification of a single channel
* @type: What type of measurement is the channel making.
@@ -184,17 +205,6 @@ struct iio_event_spec {
* @scan_index: Monotonic index to give ordering in scans when read
* from a buffer.
* @scan_type: struct describing the scan type
- * @scan_type.sign: 's' or 'u' to specify signed or unsigned
- * @scan_type.realbits: Number of valid bits of data
- * @scan_type.storagebits: Realbits + padding
- * @scan_type.shift: Shift right by this before masking out
- * realbits.
- * @scan_type.repeat: Number of times real/storage bits repeats.
- * When the repeat element is more than 1, then
- * the type element in sysfs will show a repeat
- * value. Otherwise, the number of repetitions
- * is omitted.
- * @scan_type.endianness: little or big endian
* @info_mask_separate: What information is to be exported that is specific to
* this channel.
* @info_mask_separate_available: What availability information is to be
@@ -245,14 +255,7 @@ struct iio_chan_spec {
int channel2;
unsigned long address;
int scan_index;
- struct {
- char sign;
- u8 realbits;
- u8 storagebits;
- u8 shift;
- u8 repeat;
- enum iio_endian endianness;
- } scan_type;
+ struct iio_scan_type scan_type;
long info_mask_separate;
long info_mask_separate_available;
long info_mask_shared_by_type;
--
2.43.2
next prev parent reply other threads:[~2024-05-07 19:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 19:02 [PATCH RFC 0/4] iio: add support for multiple scan types David Lechner
2024-05-07 19:02 ` David Lechner [this message]
2024-05-07 19:02 ` [PATCH RFC 2/4] iio: buffer: use struct iio_scan_type to simplify code David Lechner
2024-05-07 19:02 ` [PATCH RFC 3/4] iio: add support for multiple scan types per channel David Lechner
2024-05-19 19:12 ` Jonathan Cameron
2024-05-20 13:51 ` David Lechner
2024-05-20 16:12 ` Jonathan Cameron
2024-05-24 15:56 ` David Lechner
2024-05-25 16:14 ` Jonathan Cameron
2024-05-25 17:04 ` David Lechner
2024-05-26 12:10 ` Jonathan Cameron
2024-05-26 13:53 ` David Lechner
2024-05-07 19:02 ` [PATCH RFC 4/4] iio: adc: ad7380: add support for multiple scan type David Lechner
2024-05-08 11:40 ` Jonathan Cameron
2024-05-08 17:21 ` David Lechner
2024-05-19 19:20 ` Jonathan Cameron
2024-05-20 13:59 ` David Lechner
2024-05-19 19:16 ` Jonathan Cameron
2024-05-21 9:18 ` [PATCH RFC 0/4] iio: add support for multiple scan types Nuno Sá
2024-05-25 16:19 ` Jonathan Cameron
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=20240507-iio-add-support-for-multiple-scan-types-v1-1-95ac33ee51e9@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Michael.Hennerich@analog.com \
--cc=eblanc@baylibre.com \
--cc=jic23@kernel.org \
--cc=jstephan@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).