patch "iio: at91-sama5d2: Fix incorrect sign extension" added to char-misc-linus
Subsystems (4)
This is a note to let you know that I've just added the patch titled
iio: at91-sama5d2: Fix incorrect sign extension
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 652e7df485c6884d552085ae2c73efa6cfea3547 Mon Sep 17 00:00:00 2001
From: Gwendal Grignou <[email protected]>
Date: Thu, 4 Nov 2021 01:24:08 -0700
Subject: iio: at91-sama5d2: Fix incorrect sign extension
Use scan_type when processing raw data which also fixes that the sign extension was from the wrong bit.
Use channel definition as root of trust and replace constant when reading elements directly using the raw sysfs attributes.
--- drivers/iio/adc/at91-sama5d2_adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/at91-sama5d2_adc.c +2 -1
@@ -1586,7 +1586,8 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = st->conversion_value; ret =at91_adc_adjust_val_osr (st, val);if (chan->scan_type.sign =='s' ) - *val =sign_extend32 (*val,11 ); + *val =sign_extend32 (*val, + chan->scan_type.realbits -1 ); st->conversion_done = false; }
Signature · 1 line
2.34.1