Skip to content

Commit b96f552

Browse files
dlechnunojsa
authored andcommitted
iio: introduce struct iio_scan_type
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> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240530-iio-add-support-for-multiple-scan-types-v3-1-cbc4acea2cfa@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 21046fd commit b96f552

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

include/linux/iio/iio.h

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,27 @@ struct iio_event_spec {
173173
unsigned long mask_shared_by_all;
174174
};
175175

176+
/**
177+
* struct iio_scan_type - specification for channel data format in buffer
178+
* @sign: 's' or 'u' to specify signed or unsigned
179+
* @realbits: Number of valid bits of data
180+
* @storagebits: Realbits + padding
181+
* @shift: Shift right by this before masking out realbits.
182+
* @repeat: Number of times real/storage bits repeats. When the
183+
* repeat element is more than 1, then the type element in
184+
* sysfs will show a repeat value. Otherwise, the number
185+
* of repetitions is omitted.
186+
* @endianness: little or big endian
187+
*/
188+
struct iio_scan_type {
189+
char sign;
190+
u8 realbits;
191+
u8 storagebits;
192+
u8 shift;
193+
u8 repeat;
194+
enum iio_endian endianness;
195+
};
196+
176197
/**
177198
* struct iio_chan_spec - specification of a single channel
178199
* @type: What type of measurement is the channel making.
@@ -184,17 +205,6 @@ struct iio_event_spec {
184205
* @scan_index: Monotonic index to give ordering in scans when read
185206
* from a buffer.
186207
* @scan_type: struct describing the scan type
187-
* @scan_type.sign: 's' or 'u' to specify signed or unsigned
188-
* @scan_type.realbits: Number of valid bits of data
189-
* @scan_type.storagebits: Realbits + padding
190-
* @scan_type.shift: Shift right by this before masking out
191-
* realbits.
192-
* @scan_type.repeat: Number of times real/storage bits repeats.
193-
* When the repeat element is more than 1, then
194-
* the type element in sysfs will show a repeat
195-
* value. Otherwise, the number of repetitions
196-
* is omitted.
197-
* @scan_type.endianness: little or big endian
198208
* @info_mask_separate: What information is to be exported that is specific to
199209
* this channel.
200210
* @info_mask_separate_available: What availability information is to be
@@ -242,14 +252,7 @@ struct iio_chan_spec {
242252
int channel2;
243253
unsigned long address;
244254
int scan_index;
245-
struct {
246-
char sign;
247-
u8 realbits;
248-
u8 storagebits;
249-
u8 shift;
250-
u8 repeat;
251-
enum iio_endian endianness;
252-
} scan_type;
255+
struct iio_scan_type scan_type;
253256
long info_mask_separate;
254257
long info_mask_separate_available;
255258
long info_mask_shared_by_type;

0 commit comments

Comments
 (0)