* [PATCH] iio: adc: mt6360-adc: Converted to use get_unaligned_be16()
@ 2024-09-28 16:11 Abhash Jha
2024-09-29 16:48 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Abhash Jha @ 2024-09-28 16:11 UTC (permalink / raw)
To: linux-iio
Cc: angelogioacchino.delregno, matthias.bgg, jic23, lars,
linux-kernel, linux-arm-kernel, linux-mediatek, Abhash Jha
Changed the manual shifting and adding of bytes to use
get_unaligned_be16() api instead.
Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
---
drivers/iio/adc/mt6360-adc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/mt6360-adc.c b/drivers/iio/adc/mt6360-adc.c
index 3710473e5..91befe2cd 100644
--- a/drivers/iio/adc/mt6360-adc.c
+++ b/drivers/iio/adc/mt6360-adc.c
@@ -124,7 +124,7 @@ static int mt6360_adc_read_channel(struct mt6360_adc_data *mad, int channel, int
usleep_range(ADC_LOOP_TIME_US / 2, ADC_LOOP_TIME_US);
}
- *val = rpt[1] << 8 | rpt[2];
+ *val = get_unaligned_be16(&rpt[1]);
ret = IIO_VAL_INT;
out_adc_conv:
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: adc: mt6360-adc: Converted to use get_unaligned_be16()
2024-09-28 16:11 [PATCH] iio: adc: mt6360-adc: Converted to use get_unaligned_be16() Abhash Jha
@ 2024-09-29 16:48 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2024-09-29 16:48 UTC (permalink / raw)
To: Abhash Jha
Cc: linux-iio, angelogioacchino.delregno, matthias.bgg, lars,
linux-kernel, linux-arm-kernel, linux-mediatek, Gene Chen
On Sat, 28 Sep 2024 21:41:08 +0530
Abhash Jha <abhashkumarjha123@gmail.com> wrote:
> Changed the manual shifting and adding of bytes to use
> get_unaligned_be16() api instead.
>
> Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Looks simple so I've applied it, but plenty of time for
additional reviews to come in.
Jonathan
> ---
> drivers/iio/adc/mt6360-adc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/mt6360-adc.c b/drivers/iio/adc/mt6360-adc.c
> index 3710473e5..91befe2cd 100644
> --- a/drivers/iio/adc/mt6360-adc.c
> +++ b/drivers/iio/adc/mt6360-adc.c
> @@ -124,7 +124,7 @@ static int mt6360_adc_read_channel(struct mt6360_adc_data *mad, int channel, int
> usleep_range(ADC_LOOP_TIME_US / 2, ADC_LOOP_TIME_US);
> }
>
> - *val = rpt[1] << 8 | rpt[2];
> + *val = get_unaligned_be16(&rpt[1]);
> ret = IIO_VAL_INT;
>
> out_adc_conv:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-29 16:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-28 16:11 [PATCH] iio: adc: mt6360-adc: Converted to use get_unaligned_be16() Abhash Jha
2024-09-29 16:48 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox