Re: [PATCH v1 02/16] iio: adc: mpc3422: Use get_unaligned_beXX()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 25 Apr 2020 17:14:20 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

> On Tue, 21 Apr 2020 03:31:21 +0300
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> 
> > This makes the driver code slightly easier to read.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>  
> Looks good to me.
> 
> Applied
> 
And doesn't build... 

Needs
#include <asm/unaligned.h>

I've added it.

Jonathan

> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/adc/mcp3422.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c
> > index ea24d7c58b12..b247eb209f10 100644
> > --- a/drivers/iio/adc/mcp3422.c
> > +++ b/drivers/iio/adc/mcp3422.c
> > @@ -117,11 +117,11 @@ static int mcp3422_read(struct mcp3422 *adc, int *value, u8 *config)
> >  
> >  	if (sample_rate == MCP3422_SRATE_3) {
> >  		ret = i2c_master_recv(adc->i2c, buf, 4);
> > -		temp = buf[0] << 16 | buf[1] << 8 | buf[2];
> > +		temp = get_unaligned_be24(&buf[0]);
> >  		*config = buf[3];
> >  	} else {
> >  		ret = i2c_master_recv(adc->i2c, buf, 3);
> > -		temp = buf[0] << 8 | buf[1];
> > +		temp = get_unaligned_be16(&buf[0]);
> >  		*config = buf[2];
> >  	}
> >    
> 




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux