diff mbox series

iio:adc:mcp320x: Tidy up endian types in type cast.

Message ID 20191013090542.1375572-1-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series iio:adc:mcp320x: Tidy up endian types in type cast. | expand

Commit Message

Jonathan Cameron Oct. 13, 2019, 9:05 a.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Fixes the sparse warning:
drivers/iio/adc/mcp320x.c:167:41: warning: incorrect type in argument 1 (different base types)
drivers/iio/adc/mcp320x.c:167:41:    expected restricted __be32 const [usertype] *p
drivers/iio/adc/mcp320x.c:167:41:    got unsigned int [usertype] *<noident>

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lukas Wunner <lukas@wunner.de>
---
 drivers/iio/adc/mcp320x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lukas Wunner Oct. 13, 2019, 10:52 a.m. UTC | #1
On Sun, Oct 13, 2019 at 10:05:42AM +0100, jic23@kernel.org wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Fixes the sparse warning:
> drivers/iio/adc/mcp320x.c:167:41: warning: incorrect type in argument 1 (different base types)
> drivers/iio/adc/mcp320x.c:167:41:    expected restricted __be32 const [usertype] *p
> drivers/iio/adc/mcp320x.c:167:41:    got unsigned int [usertype] *<noident>
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Reviewed-by: Lukas Wunner <lukas@wunner.de>

Thanks,

Lukas


> ---
>  drivers/iio/adc/mcp320x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
> index 38bf10085696..465c7625a55a 100644
> --- a/drivers/iio/adc/mcp320x.c
> +++ b/drivers/iio/adc/mcp320x.c
> @@ -164,7 +164,7 @@ static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel,
>  	case mcp3550_60:
>  	case mcp3551:
>  	case mcp3553: {
> -		u32 raw = be32_to_cpup((u32 *)adc->rx_buf);
> +		u32 raw = be32_to_cpup((__be32 *)adc->rx_buf);
>  
>  		if (!(adc->spi->mode & SPI_CPOL))
>  			raw <<= 1; /* strip Data Ready bit in SPI mode 0,0 */
> -- 
> 2.23.0
Jonathan Cameron Oct. 17, 2019, 9:48 p.m. UTC | #2
On Sun, 13 Oct 2019 12:52:01 +0200
Lukas Wunner <lukas@wunner.de> wrote:

> On Sun, Oct 13, 2019 at 10:05:42AM +0100, jic23@kernel.org wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Fixes the sparse warning:
> > drivers/iio/adc/mcp320x.c:167:41: warning: incorrect type in argument 1 (different base types)
> > drivers/iio/adc/mcp320x.c:167:41:    expected restricted __be32 const [usertype] *p
> > drivers/iio/adc/mcp320x.c:167:41:    got unsigned int [usertype] *<noident>
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>  
> 
> Reviewed-by: Lukas Wunner <lukas@wunner.de>
Applied.

Thanks,

Jonathan

> 
> Thanks,
> 
> Lukas
> 
> 
> > ---
> >  drivers/iio/adc/mcp320x.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
> > index 38bf10085696..465c7625a55a 100644
> > --- a/drivers/iio/adc/mcp320x.c
> > +++ b/drivers/iio/adc/mcp320x.c
> > @@ -164,7 +164,7 @@ static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel,
> >  	case mcp3550_60:
> >  	case mcp3551:
> >  	case mcp3553: {
> > -		u32 raw = be32_to_cpup((u32 *)adc->rx_buf);
> > +		u32 raw = be32_to_cpup((__be32 *)adc->rx_buf);
> >  
> >  		if (!(adc->spi->mode & SPI_CPOL))
> >  			raw <<= 1; /* strip Data Ready bit in SPI mode 0,0 */
> > -- 
> > 2.23.0
diff mbox series

Patch

diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
index 38bf10085696..465c7625a55a 100644
--- a/drivers/iio/adc/mcp320x.c
+++ b/drivers/iio/adc/mcp320x.c
@@ -164,7 +164,7 @@  static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel,
 	case mcp3550_60:
 	case mcp3551:
 	case mcp3553: {
-		u32 raw = be32_to_cpup((u32 *)adc->rx_buf);
+		u32 raw = be32_to_cpup((__be32 *)adc->rx_buf);
 
 		if (!(adc->spi->mode & SPI_CPOL))
 			raw <<= 1; /* strip Data Ready bit in SPI mode 0,0 */