mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of missuse of the IIO_ST macro.
This driver sets the shift value equal to IIO_BE (or 1) rather than setting that to 0 and specificying the endianness. This means the channel type is missreported as [be|le]:u16/16>>1 where the be|le is dependent on the cpu native endianness, rather than be:u16/16>>0 resulting in any userspace code using this information, miss converting the channel and generating thoroughly trashed data. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Cc: stable@vger.kernel.org
This commit is contained in:
parent
128d6637cc
commit
c5fe7a41ad
1 changed files with 6 additions and 1 deletions
|
@ -451,7 +451,12 @@ static irqreturn_t hmc5843_trigger_handler(int irq, void *p)
|
||||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
|
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
|
||||||
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
|
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
|
||||||
.scan_index = idx, \
|
.scan_index = idx, \
|
||||||
.scan_type = IIO_ST('s', 16, 16, IIO_BE), \
|
.scan_type = { \
|
||||||
|
.sign = 's', \
|
||||||
|
.realbits = 16, \
|
||||||
|
.storagebits = 16, \
|
||||||
|
.endianness = IIO_BE, \
|
||||||
|
}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct iio_chan_spec hmc5843_channels[] = {
|
static const struct iio_chan_spec hmc5843_channels[] = {
|
||||||
|
|
Loading…
Reference in a new issue