Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268164
b: refs/heads/master
c: 8310b86
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Sep 6, 2011
1 parent f4e6136 commit 568fc9a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a37b549ec61d892aa99744750e97d994bc779cb6
refs/heads/master: 8310b86c3cd2f813bb9ed330447bcb2877b8328a
8 changes: 8 additions & 0 deletions trunk/drivers/staging/iio/iio.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ enum iio_chan_info_enum {
IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE,
};

enum iio_endian {
IIO_CPU,
IIO_BE,
IIO_LE,
};

/**
* struct iio_chan_spec - specification of a single channel
* @type: What type of measurement is the channel making.
Expand All @@ -95,6 +101,7 @@ enum iio_chan_info_enum {
* storage_bits: Realbits + padding
* shift: Shift right by this before masking out
* realbits.
* endianness: little or big endian
* @info_mask: What information is to be exported about this channel.
* This includes calibbias, scale etc.
* @event_mask: What events can this channel produce.
Expand Down Expand Up @@ -123,6 +130,7 @@ struct iio_chan_spec {
u8 realbits;
u8 storagebits;
u8 shift;
enum iio_endian endianness;
} scan_type;
long info_mask;
long event_mask;
Expand Down
15 changes: 14 additions & 1 deletion trunk/drivers/staging/iio/industrialio-ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "sysfs.h"
#include "ring_generic.h"

static const char * const iio_endian_prefix[] = {
[IIO_BE] = "be",
[IIO_LE] = "le",
};

/**
* iio_ring_read_first_n_outer() - chrdev read for ring buffer access
Expand Down Expand Up @@ -96,7 +100,16 @@ static ssize_t iio_show_fixed_type(struct device *dev,
char *buf)
{
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
return sprintf(buf, "%c%d/%d>>%u\n",
u8 type = this_attr->c->scan_type.endianness;

if (type == IIO_CPU) {
if (__LITTLE_ENDIAN)
type = IIO_LE;
else
type = IIO_BE;
}
return sprintf(buf, "%s:%c%d/%d>>%u\n",
iio_endian_prefix[type],
this_attr->c->scan_type.sign,
this_attr->c->scan_type.realbits,
this_attr->c->scan_type.storagebits,
Expand Down

0 comments on commit 568fc9a

Please sign in to comment.