[3/3] iio: light: bu27008: Fix intensity data type

Message ID 240a7ca5fc1b76da20d81f930d00f31a54b1fdf8.1686648422.git.mazziesaccount@gmail.com
State New
Headers
Series ROHM BUxxx light sensor fixes |

Commit Message

Matti Vaittinen June 13, 2023, 9:35 a.m. UTC
  The intensity data from bu27008 is unsigned. The type of the scan data
was incorrectly marked as signed resulting large intensity values to be
interpreted as negative ones.

Fix the scan data type.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>

---
Fixes tag not added because AFACS the bu27008 is not yet in any releases.
---
 drivers/iio/light/rohm-bu27008.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jonathan Cameron June 17, 2023, 7:35 p.m. UTC | #1
On Tue, 13 Jun 2023 12:35:12 +0300
Matti Vaittinen <mazziesaccount@gmail.com> wrote:

> The intensity data from bu27008 is unsigned. The type of the scan data
> was incorrectly marked as signed resulting large intensity values to be
> interpreted as negative ones.
> 
> Fix the scan data type.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Applied series to the fixes-togreg branch of iio.git (which now includes
this as it's upstream in char-misc-next)  Added fixes tags where needed given
the ids are now stable

Thanks,
Jonathan

> 
> ---
> Fixes tag not added because AFACS the bu27008 is not yet in any releases.
> ---
>  drivers/iio/light/rohm-bu27008.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/rohm-bu27008.c b/drivers/iio/light/rohm-bu27008.c
> index 80eb14ea8193..b50bf8973d9a 100644
> --- a/drivers/iio/light/rohm-bu27008.c
> +++ b/drivers/iio/light/rohm-bu27008.c
> @@ -190,7 +190,7 @@ static const struct iio_itime_sel_mul bu27008_itimes[] = {
>  	.address = BU27008_REG_##data##_LO,					\
>  	.scan_index = BU27008_##color,						\
>  	.scan_type = {								\
> -		.sign = 's',							\
> +		.sign = 'u',							\
>  		.realbits = 16,							\
>  		.storagebits = 16,						\
>  		.endianness = IIO_LE,						\
  

Patch

diff --git a/drivers/iio/light/rohm-bu27008.c b/drivers/iio/light/rohm-bu27008.c
index 80eb14ea8193..b50bf8973d9a 100644
--- a/drivers/iio/light/rohm-bu27008.c
+++ b/drivers/iio/light/rohm-bu27008.c
@@ -190,7 +190,7 @@  static const struct iio_itime_sel_mul bu27008_itimes[] = {
 	.address = BU27008_REG_##data##_LO,					\
 	.scan_index = BU27008_##color,						\
 	.scan_type = {								\
-		.sign = 's',							\
+		.sign = 'u',							\
 		.realbits = 16,							\
 		.storagebits = 16,						\
 		.endianness = IIO_LE,						\