]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: adc: mt6360-adc: Converted to use get_unaligned_be16()
authorAbhash Jha <abhashkumarjha123@gmail.com>
Sat, 28 Sep 2024 16:11:08 +0000 (21:41 +0530)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 5 Oct 2024 11:09:15 +0000 (12:09 +0100)
Changed the manual shifting and adding of bytes to use
get_unaligned_be16() api instead.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240928161108.163647-1-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/mt6360-adc.c

index e2ec805e834fe96fff6156bdb2e38a1a331926f2..d09724414d07b9927577168b6246b4429645f13f 100644 (file)
@@ -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: