Skip to content

Commit 7f78ad3

Browse files
dlechjonathanns
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>
1 parent 0b3d96f commit 7f78ad3

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
@@ -172,6 +172,27 @@ struct iio_event_spec {
172172
unsigned long mask_shared_by_all;
173173
};
174174

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

0 commit comments

Comments
 (0)