iio:ad5504: Mark transfer buffers as __be16
Subsystems (4)
PATCH 1/15 iio:ad5504: Mark transfer buffers as __be16
Fixes the following warnings from sparse:
drivers/iio/dac/ad5504.c:71:19: warning: incorrect type in initializer (different base types) drivers/iio/dac/ad5504.c:71:19: expected unsigned short [unsigned] [usertype] tmp drivers/iio/dac/ad5504.c:71:19: got restricted __be16 [usertype] <noident> drivers/iio/dac/ad5504.c:80:19: warning: incorrect type in initializer (different base types) drivers/iio/dac/ad5504.c:80:19: expected unsigned short [unsigned] [usertype] tmp drivers/iio/dac/ad5504.c:80:19: got restricted __be16 [usertype] <noident> drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16 drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16 drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16 drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16
--- drivers/iio/dac/ad5504.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/dac/ad5504.c +3 -3
@@ -68,7 +68,7 @@ enum ad5504_supported_device_ids {static int ad5504_spi_write (struct spi_device *spi,u8 addr,u16 val) { -u16 tmp =cpu_to_be16 (AD5504_CMD_WRITE | +__be16 tmp =cpu_to_be16 (AD5504_CMD_WRITE |AD5504_ADDR (addr) | (val &AD5504_RES_MASK ));
@@ -77,8 +77,8 @@ static int ad5504_spi_write(struct spi_device *spi, u8 addr, u16 val)static int ad5504_spi_read (struct spi_device *spi,u8 addr) { -u16 tmp =cpu_to_be16 (AD5504_CMD_READ |AD5504_ADDR (addr)); -u16 val; +__be16 tmp =cpu_to_be16 (AD5504_CMD_READ |AD5504_ADDR (addr)); +__be16 val;int ret;struct spi_transfer t = { .tx_buf = &tmp,
Signature · 1 line
1.8.0
PATCH 2/15 iio:ad5504: Do not store transfer buffers on the stack
Some SPI controllers may not be able to handle transfer buffers that are placed on the stack.
--- drivers/iio/dac/ad5504.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/iio/dac/ad5504.c +20 -20
@@ -47,14 +47,16 @@* @vref_mv: actual reference voltage used * @pwr_down_mask power down mask * @pwr_down_mode current power down mode +* @data: transfer buffer */ -struct ad5504_state {struct spi_device *spi;struct regulator *reg;unsigned short vref_mv;unsigned pwr_down_mask;unsigned pwr_down_mode; + +__be16 data[2 ]____cacheline_aligned ; };/**
@@ -66,31 +68,29 @@ enum ad5504_supported_device_ids { ID_AD5501, }; -static int ad5504_spi_write (struct spi_device *spi,u8 addr,u16 val) +static int ad5504_spi_write (struct ad5504_state *st,u8 addr,u16 val) { -__be16 tmp =cpu_to_be16 (AD5504_CMD_WRITE | -AD5504_ADDR (addr) | + st->data[0 ] =cpu_to_be16 (AD5504_CMD_WRITE |AD5504_ADDR (addr) | (val &AD5504_RES_MASK )); -return spi_write (spi, (u8 *)&tmp,2 ); +return spi_write (st->spi, &st->data[0 ],2 ); } -static int ad5504_spi_read (struct spi_device *spi,u8 addr) +static int ad5504_spi_read (struct ad5504_state *st,u8 addr) { -__be16 tmp =cpu_to_be16 (AD5504_CMD_READ |AD5504_ADDR (addr)); -__be16 val;int ret; -struct spi_transfer t = { - .tx_buf = &tmp, - .rx_buf = &val, - .len =2 , - }; - ret =spi_sync_transfer (spi, &t,1 ); - +struct spi_transfer t = { + .tx_buf = &st->data[0 ], + .rx_buf = &st->data[1 ], + .len =2 , + }; + + st->data[0 ] =cpu_to_be16 (AD5504_CMD_READ |AD5504_ADDR (addr)); + ret =spi_sync_transfer (st->spi, &t,1 );if (ret <0 )return ret; -return be16_to_cpu (val) &AD5504_RES_MASK ; +return be16_to_cpu (st->data[1 ]) &AD5504_RES_MASK ; } static int ad5504_read_raw(struct iio_dev *indio_dev,
@@ -104,7 +104,7 @@ static int ad5504_read_raw(struct iio_dev *indio_dev,switch (m) {case IIO_CHAN_INFO_RAW : - ret =ad5504_spi_read (st->spi, chan->address); + ret =ad5504_spi_read (st, chan->address);if (ret <0 )return ret;
@@ -133,7 +133,7 @@ static int ad5504_write_raw(struct iio_dev *indio_dev,if (val >= (1 << chan->scan_type.realbits) || val <0 )return -EINVAL ; -return ad5504_spi_write (st->spi, chan->address, val); +return ad5504_spi_write (st, chan->address, val);default : ret = -EINVAL ; }
@@ -197,12 +197,12 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,else st->pwr_down_mask &= ~(1 << chan->channel); - ret =ad5504_spi_write (st->spi,AD5504_ADDR_CTRL , + ret =ad5504_spi_write (st,AD5504_ADDR_CTRL ,AD5504_DAC_PWRDWN_MODE (st->pwr_down_mode) |AD5504_DAC_PWR (st->pwr_down_mask));/* writes to the CTRL register must be followed by a NOOP */ -ad5504_spi_write (st->spi,AD5504_ADDR_NOOP ,0 ); +ad5504_spi_write (st,AD5504_ADDR_NOOP ,0 );return ret ? ret : len; }
Signature · 1 line
1.8.0
Re: [PATCH 02/15] iio:ad5504: Do not store transfer buffers on the stack
Quoted 4 lines · Lars-Peter Clausen
Some SPI controllers may not be able to handle transfer buffers that are placed on the stack.
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks
Quoted 105 lines
--- drivers/iio/dac/ad5504.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)drivers/iio/dac/ad5504.c +20
-20@@ -47,14 +47,16 @@* @vref_mv: actual reference voltage used * @pwr_down_mask power down mask * @pwr_down_mode current power down mode +* @data: transfer buffer */ -struct ad5504_state {struct spi_device *spi;struct regulator *reg;unsigned short vref_mv;unsigned pwr_down_mask;unsigned pwr_down_mode; + +__be16 data[2 ]____cacheline_aligned ; };/** @@ -66,31 +68,29 @@ enum ad5504_supported_device_ids { ID_AD5501, }; -static int ad5504_spi_write (struct spi_device *spi,u8 addr,u16 val) +static int ad5504_spi_write (struct ad5504_state *st,u8 addr,u16 val) { -__be16 tmp =cpu_to_be16 (AD5504_CMD_WRITE | -AD5504_ADDR (addr) | + st->data[0 ] =cpu_to_be16 (AD5504_CMD_WRITE |AD5504_ADDR (addr) | (val &AD5504_RES_MASK )); -return spi_write (spi, (u8 *)&tmp,2 ); +return spi_write (st->spi, &st->data[0 ],2 ); } -static int ad5504_spi_read (struct spi_device *spi,u8 addr) +static int ad5504_spi_read (struct ad5504_state *st,u8 addr) { -__be16 tmp =cpu_to_be16 (AD5504_CMD_READ |AD5504_ADDR (addr)); -__be16 val;int ret; -struct spi_transfer t = { - .tx_buf = &tmp, - .rx_buf = &val, - .len =2 , - }; - ret =spi_sync_transfer (spi, &t,1 ); - +struct spi_transfer t = { + .tx_buf = &st->data[0 ], + .rx_buf = &st->data[1 ], + .len =2 , + }; + + st->data[0 ] =cpu_to_be16 (AD5504_CMD_READ |AD5504_ADDR (addr)); + ret =spi_sync_transfer (st->spi, &t,1 );if (ret <0 )return ret; -return be16_to_cpu (val) &AD5504_RES_MASK ; +return be16_to_cpu (st->data[1 ]) &AD5504_RES_MASK ; } static int ad5504_read_raw(struct iio_dev *indio_dev,@@ -104,7 +104,7 @@ static int ad5504_read_raw(struct iio_dev *indio_dev,switch (m) {case IIO_CHAN_INFO_RAW : - ret =ad5504_spi_read (st->spi, chan->address); + ret =ad5504_spi_read (st, chan->address);if (ret <0 )return ret;@@ -133,7 +133,7 @@ static int ad5504_write_raw(struct iio_dev *indio_dev,if (val >= (1 << chan->scan_type.realbits) || val <0 )return -EINVAL ; -return ad5504_spi_write (st->spi, chan->address, val); +return ad5504_spi_write (st, chan->address, val);default : ret = -EINVAL ; }@@ -197,12 +197,12 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,else st->pwr_down_mask &= ~(1 << chan->channel); - ret =ad5504_spi_write (st->spi,AD5504_ADDR_CTRL , + ret =ad5504_spi_write (st,AD5504_ADDR_CTRL ,AD5504_DAC_PWRDWN_MODE (st->pwr_down_mode) |AD5504_DAC_PWR (st->pwr_down_mask));/* writes to the CTRL register must be followed by a NOOP */ -ad5504_spi_write (st->spi,AD5504_ADDR_NOOP ,0 ); +ad5504_spi_write (st,AD5504_ADDR_NOOP ,0 );return ret ? ret : len; }
PATCH 3/15 iio:ad5421: Mark transfer buffer as __be32
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/iio/dac/ad5421.c:134:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5421.c:134:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5421.c:134:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5421.c:168:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5421.c:168:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5421.c:168:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32
--- drivers/iio/dac/ad5421.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5421.c +1 -1
@@ -75,7 +75,7 @@ struct ad5421_state {* transfer buffers to live in their own cache lines. */ union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data[2 ]____cacheline_aligned ; };
Signature · 1 line
1.8.0
Re: [PATCH 03/15] iio:ad5421: Mark transfer buffer as __be32
Quoted 14 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/iio/dac/ad5421.c:134:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5421.c:134:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5421.c:134:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5421.c:168:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5421.c:168:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5421.c:168:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32 drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
thanks
Quoted 18 lines
--- drivers/iio/dac/ad5421.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/dac/ad5421.c +1
-1@@ -75,7 +75,7 @@ struct ad5421_state {* transfer buffers to live in their own cache lines. */ union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data[2 ]____cacheline_aligned ; };
PATCH 4/15 iio:ad5686: Mark transfer buffer as __be32
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/iio/dac/ad5686.c:100:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5686.c:100:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5686.c:100:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5686.c:122:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5686.c:122:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5686.c:122:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5686.c:124:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5686.c:124:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5686.c:124:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32
--- drivers/iio/dac/ad5686.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5686.c +1 -1
@@ -78,7 +78,7 @@ struct ad5686_state {*/ union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data[3 ]____cacheline_aligned ; };
Signature · 1 line
1.8.0
Re: [PATCH 04/15] iio:ad5686: Mark transfer buffer as __be32
Quoted 17 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/iio/dac/ad5686.c:100:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5686.c:100:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5686.c:100:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5686.c:122:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5686.c:122:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5686.c:122:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5686.c:124:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5686.c:124:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5686.c:124:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32 drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks,
Quoted 18 lines
--- drivers/iio/dac/ad5686.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/dac/ad5686.c +1
-1@@ -78,7 +78,7 @@ struct ad5686_state {*/ union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data[3 ]____cacheline_aligned ; };
PATCH 5/15 iio:ad5755: Mark transfer buffer as __be32
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/iio/dac/ad5755.c:117:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5755.c:117:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5755.c:117:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5755.c:171:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5755.c:171:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5755.c:171:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5755.c:172:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5755.c:172:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5755.c:172:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32
--- drivers/iio/dac/ad5755.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5755.c +1 -1
@@ -97,7 +97,7 @@ struct ad5755_state {*/ union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data[2 ]____cacheline_aligned ; };
Signature · 1 line
1.8.0
Re: [PATCH 05/15] iio:ad5755: Mark transfer buffer as __be32
Quoted 17 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/iio/dac/ad5755.c:117:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5755.c:117:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5755.c:117:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5755.c:171:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5755.c:171:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5755.c:171:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5755.c:172:25: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5755.c:172:25: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5755.c:172:25: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32 drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks,
Quoted 18 lines
--- drivers/iio/dac/ad5755.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/dac/ad5755.c +1
-1@@ -97,7 +97,7 @@ struct ad5755_state {*/ union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data[2 ]____cacheline_aligned ; };
PATCH 6/15 iio:ad5791: Mark transfer buffers as __be32
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/iio/dac/ad5791.c:114:18: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5791.c:114:18: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5791.c:114:18: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5791.c:142:21: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5791.c:142:21: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5791.c:142:21: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5791.c:144:21: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5791.c:144:21: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5791.c:144:21: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32
--- drivers/iio/dac/ad5791.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5791.c +2 -2
@@ -107,7 +107,7 @@ enum ad5791_supported_device_ids {static int ad5791_spi_write (struct spi_device *spi,u8 addr,u32 val) {union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data;
@@ -121,7 +121,7 @@ static int ad5791_spi_write(struct spi_device *spi, u8 addr, u32 val)static int ad5791_spi_read (struct spi_device *spi,u8 addr,u32 *val) {union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data[3 ];int ret;
Signature · 1 line
1.8.0
Re: [PATCH 06/15] iio:ad5791: Mark transfer buffers as __be32
Quoted 17 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/iio/dac/ad5791.c:114:18: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5791.c:114:18: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5791.c:114:18: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5791.c:142:21: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5791.c:142:21: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5791.c:142:21: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5791.c:144:21: warning: incorrect type in assignment (different base types) drivers/iio/dac/ad5791.c:144:21: expected unsigned int [unsigned] [usertype] d32 drivers/iio/dac/ad5791.c:144:21: got restricted __be32 [usertype] <noident> drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32 drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks
Quoted 27 lines
--- drivers/iio/dac/ad5791.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/dac/ad5791.c +2
-2@@ -107,7 +107,7 @@ enum ad5791_supported_device_ids {static int ad5791_spi_write (struct spi_device *spi,u8 addr,u32 val) {union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data;@@ -121,7 +121,7 @@ static int ad5791_spi_write(struct spi_device *spi, u8 addr, u32 val)static int ad5791_spi_read (struct spi_device *spi,u8 addr,u32 *val) {union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data[3 ];int ret;
PATCH 7/15 iio:ad5791: Do not store transfer buffers on the stack
In reply to Lars-Peter ClausenSome SPI controllers may not be able to handle transfer buffers that are placed on the stack.
--- drivers/iio/dac/ad5791.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-)
drivers/iio/dac/ad5791.c +21 -25
@@ -91,6 +91,11 @@ struct ad5791_state {unsigned ctrl;unsigned pwr_down_mode;bool pwr_down; + +union { +__be32 d32; +u8 d8[4 ]; + } data[3 ]____cacheline_aligned ; };/**
@@ -104,48 +109,39 @@ enum ad5791_supported_device_ids { ID_AD5791, }; -static int ad5791_spi_write (struct spi_device *spi,u8 addr,u32 val) +static int ad5791_spi_write (struct ad5791_state *st,u8 addr,u32 val) { -union { -__be32 d32; -u8 d8[4 ]; - } data; - - data.d32 =cpu_to_be32 (AD5791_CMD_WRITE | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_WRITE |AD5791_ADDR (addr) | (val &AD5791_DAC_MASK )); -return spi_write (spi, &data.d8[1 ],3 ); +return spi_write (st->spi, &st->data[0 ].d8[1 ],3 ); } -static int ad5791_spi_read (struct spi_device *spi,u8 addr,u32 *val) +static int ad5791_spi_read (struct ad5791_state *st,u8 addr,u32 *val) { -union { -__be32 d32; -u8 d8[4 ]; - } data[3 ];int ret;struct spi_transfer xfers[] = { { - .tx_buf = &data[0 ].d8[1 ], + .tx_buf = &st->data[0 ].d8[1 ], .bits_per_word =8 , .len =3 , .cs_change =1 , }, { - .tx_buf = &data[1 ].d8[1 ], - .rx_buf = &data[2 ].d8[1 ], + .tx_buf = &st->data[1 ].d8[1 ], + .rx_buf = &st->data[2 ].d8[1 ], .bits_per_word =8 , .len =3 , }, }; - data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ |AD5791_ADDR (addr)); - data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); + st->data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); - ret =spi_sync_transfer (spi, xfers,ARRAY_SIZE (xfers)); + ret =spi_sync_transfer (st->spi, xfers,ARRAY_SIZE (xfers)); - *val =be32_to_cpu (data[2 ].d32); + *val =be32_to_cpu (st->data[2 ].d32);return ret; }
@@ -210,7 +206,7 @@ static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, } st->pwr_down = pwr_down; - ret =ad5791_spi_write (st->spi,AD5791_ADDR_CTRL , st->ctrl); + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl);return ret ? ret : len; }
@@ -263,7 +259,7 @@ static int ad5791_read_raw(struct iio_dev *indio_dev,switch (m) {case IIO_CHAN_INFO_RAW : - ret =ad5791_spi_read (st->spi, chan->address, val); + ret =ad5791_spi_read (st, chan->address, val);if (ret)return ret; *val &=AD5791_DAC_MASK ;
@@ -330,7 +326,7 @@ static int ad5791_write_raw(struct iio_dev *indio_dev, val &=AD5791_RES_MASK (chan->scan_type.realbits); val <<= chan->scan_type.shift; -return ad5791_spi_write (st->spi, chan->address, val); +return ad5791_spi_write (st, chan->address, val);default :return -EINVAL ;
@@ -393,7 +389,7 @@ static int ad5791_probe(struct spi_device *spi)dev_warn (&spi->dev,"reference voltage unspecified\n" ); } - ret =ad5791_spi_write (spi,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET ); + ret =ad5791_spi_write (st,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET );if (ret) goto error_disable_reg_neg;
@@ -405,7 +401,7 @@ static int ad5791_probe(struct spi_device *spi) | ((pdata && pdata->use_rbuf_gain2) ? 0 : AD5791_CTRL_RBUF) |AD5791_CTRL_BIN2SC ; - ret =ad5791_spi_write (spi,AD5791_ADDR_CTRL , st->ctrl | + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl |AD5791_CTRL_OPGND |AD5791_CTRL_DACTRI );if (ret) goto error_disable_reg_neg;
Signature · 1 line
1.8.0
Re: [PATCH 07/15] iio:ad5791: Do not store transfer buffers on the stack
Quoted 4 lines · Lars-Peter Clausen
Some SPI controllers may not be able to handle transfer buffers that are placed on the stack.
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks
Quoted 126 lines
--- drivers/iio/dac/ad5791.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-)drivers/iio/dac/ad5791.c +21
-25@@ -91,6 +91,11 @@ struct ad5791_state {unsigned ctrl;unsigned pwr_down_mode;bool pwr_down; + +union { +__be32 d32; +u8 d8[4 ]; + } data[3 ]____cacheline_aligned ; };/** @@ -104,48 +109,39 @@ enum ad5791_supported_device_ids { ID_AD5791, }; -static int ad5791_spi_write (struct spi_device *spi,u8 addr,u32 val) +static int ad5791_spi_write (struct ad5791_state *st,u8 addr,u32 val) { -union { -__be32 d32; -u8 d8[4 ]; - } data; - - data.d32 =cpu_to_be32 (AD5791_CMD_WRITE | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_WRITE |AD5791_ADDR (addr) | (val &AD5791_DAC_MASK )); -return spi_write (spi, &data.d8[1 ],3 ); +return spi_write (st->spi, &st->data[0 ].d8[1 ],3 ); } -static int ad5791_spi_read (struct spi_device *spi,u8 addr,u32 *val) +static int ad5791_spi_read (struct ad5791_state *st,u8 addr,u32 *val) { -union { -__be32 d32; -u8 d8[4 ]; - } data[3 ];int ret;struct spi_transfer xfers[] = { { - .tx_buf = &data[0 ].d8[1 ], + .tx_buf = &st->data[0 ].d8[1 ], .bits_per_word =8 , .len =3 , .cs_change =1 , }, { - .tx_buf = &data[1 ].d8[1 ], - .rx_buf = &data[2 ].d8[1 ], + .tx_buf = &st->data[1 ].d8[1 ], + .rx_buf = &st->data[2 ].d8[1 ], .bits_per_word =8 , .len =3 , }, }; - data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ |AD5791_ADDR (addr)); - data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); + st->data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); - ret =spi_sync_transfer (spi, xfers,ARRAY_SIZE (xfers)); + ret =spi_sync_transfer (st->spi, xfers,ARRAY_SIZE (xfers)); - *val =be32_to_cpu (data[2 ].d32); + *val =be32_to_cpu (st->data[2 ].d32);return ret; }@@ -210,7 +206,7 @@ static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, } st->pwr_down = pwr_down; - ret =ad5791_spi_write (st->spi,AD5791_ADDR_CTRL , st->ctrl); + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl);return ret ? ret : len; }@@ -263,7 +259,7 @@ static int ad5791_read_raw(struct iio_dev *indio_dev,switch (m) {case IIO_CHAN_INFO_RAW : - ret =ad5791_spi_read (st->spi, chan->address, val); + ret =ad5791_spi_read (st, chan->address, val);if (ret)return ret; *val &=AD5791_DAC_MASK ;@@ -330,7 +326,7 @@ static int ad5791_write_raw(struct iio_dev *indio_dev, val &=AD5791_RES_MASK (chan->scan_type.realbits); val <<= chan->scan_type.shift; -return ad5791_spi_write (st->spi, chan->address, val); +return ad5791_spi_write (st, chan->address, val);default :return -EINVAL ;@@ -393,7 +389,7 @@ static int ad5791_probe(struct spi_device *spi)dev_warn (&spi->dev,"reference voltage unspecified\n" ); } - ret =ad5791_spi_write (spi,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET ); + ret =ad5791_spi_write (st,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET );if (ret) goto error_disable_reg_neg;@@ -405,7 +401,7 @@ static int ad5791_probe(struct spi_device *spi) | ((pdata && pdata->use_rbuf_gain2) ? 0 : AD5791_CTRL_RBUF) |AD5791_CTRL_BIN2SC ; - ret =ad5791_spi_write (spi,AD5791_ADDR_CTRL , st->ctrl | + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl |AD5791_CTRL_OPGND |AD5791_CTRL_DACTRI );if (ret) goto error_disable_reg_neg;
Jonathan Cameron
maintainerRe: [PATCH 07/15] iio:ad5791: Do not store transfer buffers on the stack
Quoted 8 lines · Jonathan Cameron
Quoted 4 lines · Lars-Peter Clausen
Some SPI controllers may not be able to handle transfer buffers that are placed on the stack.
Signed-off-by Lars-Peter Clausen <[email protected]>Applied to the togreg branch of iio.git
Thanks
I really didn't review this series well enough. This should probably have gone in as a fix rather that through the togreg branch as should the other sp driver. Bit late now though given the size of the patch.
Sorry it has taken me so long to do a pull request to Greg. I always get a bit lazy on the stuff for next as can always do it tomorrow!
Slipped rather long this time though!
Jonathan
Quoted 131 lines
Quoted 118 lines
--- drivers/iio/dac/ad5791.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-)drivers/iio/dac/ad5791.c +20
-24@@ -91,6 +91,11 @@ struct ad5791_state {unsigned ctrl;unsigned pwr_down_mode;bool pwr_down; + +union { +__be32 d32; +u8 d8[4 ]; + } data[3 ]____cacheline_aligned ; };/** @@ -104,48 +109,39 @@ enum ad5791_supported_device_ids { ID_AD5791, }; -static int ad5791_spi_write (struct spi_device *spi,u8 addr,u32 val) +static int ad5791_spi_write (struct ad5791_state *st,u8 addr,u32 val) { -union { -__be32 d32; -u8 d8[4 ]; - } data; - - data.d32 =cpu_to_be32 (AD5791_CMD_WRITE | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_WRITE |AD5791_ADDR (addr) | (val &AD5791_DAC_MASK )); -return spi_write (spi, &data.d8[1 ],3 ); +return spi_write (st->spi, &st->data[0 ].d8[1 ],3 ); } -static int ad5791_spi_read (struct spi_device *spi,u8 addr,u32 *val) +static int ad5791_spi_read (struct ad5791_state *st,u8 addr,u32 *val) { -union { -__be32 d32; -u8 d8[4 ]; - } data[3 ];int ret;struct spi_transfer xfers[] = { { - .tx_buf = &data[0 ].d8[1 ], + .tx_buf = &st->data[0 ].d8[1 ], .bits_per_word =8 , .len =3 , .cs_change =1 , }, { - .tx_buf = &data[1 ].d8[1 ], - .rx_buf = &data[2 ].d8[1 ], + .tx_buf = &st->data[1 ].d8[1 ], + .rx_buf = &st->data[2 ].d8[1 ], .bits_per_word =8 , .len =3 , }, }; - data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ |AD5791_ADDR (addr)); - data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); + st->data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); - ret =spi_sync_transfer (spi, xfers,ARRAY_SIZE (xfers)); + ret =spi_sync_transfer (st->spi, xfers,ARRAY_SIZE (xfers)); - *val =be32_to_cpu (data[2 ].d32); + *val =be32_to_cpu (st->data[2 ].d32);return ret; }@@ -210,7 +206,7 @@ static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, } st->pwr_down = pwr_down; - ret =ad5791_spi_write (st->spi,AD5791_ADDR_CTRL , st->ctrl); + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl);return ret ? ret : len; }@@ -263,7 +259,7 @@ static int ad5791_read_raw(struct iio_dev *indio_dev,switch (m) {case IIO_CHAN_INFO_RAW : - ret =ad5791_spi_read (st->spi, chan->address, val); + ret =ad5791_spi_read (st, chan->address, val);if (ret)return ret; *val &=AD5791_DAC_MASK ;@@ -330,7 +326,7 @@ static int ad5791_write_raw(struct iio_dev *indio_dev, val &=AD5791_RES_MASK (chan->scan_type.realbits); val <<= chan->scan_type.shift; -return ad5791_spi_write (st->spi, chan->address, val); +return ad5791_spi_write (st, chan->address, val);default :return -EINVAL ;@@ -393,7 +389,7 @@ static int ad5791_probe(struct spi_device *spi)dev_warn (&spi->dev,"reference voltage unspecified\n" ); } - ret =ad5791_spi_write (spi,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET ); + ret =ad5791_spi_write (st,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET );if (ret) goto error_disable_reg_neg;drivers/iio/dac/ad5791.c static int ad5791_probe(struct spi_device *spi) · line 407
Quoted 8 lines
drivers/iio/dac/ad5791.c +1
-1@@ -405,7 +401,7 @@ static int ad5791_probe(struct spi_device *spi) | ((pdata && pdata->use_rbuf_gain2) ? 0 : AD5791_CTRL_RBUF) |AD5791_CTRL_BIN2SC ; - ret =ad5791_spi_write (spi,AD5791_ADDR_CTRL , st->ctrl | + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl |AD5791_CTRL_OPGND |AD5791_CTRL_DACTRI );if (ret) goto error_disable_reg_neg;--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/15] iio:ad5791: Do not store transfer buffers on the stack
Quoted 10 lines · Jonathan Cameron
Quoted 8 lines · Jonathan Cameron
Quoted 4 lines · Lars-Peter Clausen
Some SPI controllers may not be able to handle transfer buffers that are placed on the stack.
Signed-off-by Lars-Peter Clausen <[email protected]>Applied to the togreg branch of iio.git
Thanks
Quoted 8 lines
I really didn't review this series well enough. This should probably have gone in as a fix rather that through the togreg branch as should the other sp driver. Bit late now though given the size of the patch.
Sorry it has taken me so long to do a pull request to Greg. I always get a bit lazy on the stuff for next as can always do it tomorrow!
Slipped rather long this time though!
I think most SPI driver simply don't care as they don't do any DMA. So as long as there is a board with a DMA SPI controller + this chip combination that is in active use I don't think the patch needs to go into fixes.
Quoted 139 lines
Jonathan
Quoted 120 lines
Quoted 120 lines
--- drivers/iio/dac/ad5791.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-)drivers/iio/dac/ad5791.c +20
-24@@ -91,6 +91,11 @@ struct ad5791_state {unsigned ctrl;unsigned pwr_down_mode;bool pwr_down; + +union { +__be32 d32; +u8 d8[4 ]; + } data[3 ]____cacheline_aligned ; };/** @@ -104,48 +109,39 @@ enum ad5791_supported_device_ids { ID_AD5791, }; -static int ad5791_spi_write (struct spi_device *spi,u8 addr,u32 val) +static int ad5791_spi_write (struct ad5791_state *st,u8 addr,u32 val) { -union { -__be32 d32; -u8 d8[4 ]; - } data; - - data.d32 =cpu_to_be32 (AD5791_CMD_WRITE | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_WRITE |AD5791_ADDR (addr) | (val &AD5791_DAC_MASK )); -return spi_write (spi, &data.d8[1 ],3 ); +return spi_write (st->spi, &st->data[0 ].d8[1 ],3 ); } -static int ad5791_spi_read (struct spi_device *spi,u8 addr,u32 *val) +static int ad5791_spi_read (struct ad5791_state *st,u8 addr,u32 *val) { -union { -__be32 d32; -u8 d8[4 ]; - } data[3 ];int ret;struct spi_transfer xfers[] = { { - .tx_buf = &data[0 ].d8[1 ], + .tx_buf = &st->data[0 ].d8[1 ], .bits_per_word =8 , .len =3 , .cs_change =1 , }, { - .tx_buf = &data[1 ].d8[1 ], - .rx_buf = &data[2 ].d8[1 ], + .tx_buf = &st->data[1 ].d8[1 ], + .rx_buf = &st->data[2 ].d8[1 ], .bits_per_word =8 , .len =3 , }, }; - data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ |AD5791_ADDR (addr)); - data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); + st->data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); - ret =spi_sync_transfer (spi, xfers,ARRAY_SIZE (xfers)); + ret =spi_sync_transfer (st->spi, xfers,ARRAY_SIZE (xfers)); - *val =be32_to_cpu (data[2 ].d32); + *val =be32_to_cpu (st->data[2 ].d32);return ret; }@@ -210,7 +206,7 @@ static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, } st->pwr_down = pwr_down; - ret =ad5791_spi_write (st->spi,AD5791_ADDR_CTRL , st->ctrl); + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl);return ret ? ret : len; }@@ -263,7 +259,7 @@ static int ad5791_read_raw(struct iio_dev *indio_dev,switch (m) {case IIO_CHAN_INFO_RAW : - ret =ad5791_spi_read (st->spi, chan->address, val); + ret =ad5791_spi_read (st, chan->address, val);if (ret)return ret; *val &=AD5791_DAC_MASK ;@@ -330,7 +326,7 @@ static int ad5791_write_raw(struct iio_dev *indio_dev, val &=AD5791_RES_MASK (chan->scan_type.realbits); val <<= chan->scan_type.shift; -return ad5791_spi_write (st->spi, chan->address, val); +return ad5791_spi_write (st, chan->address, val);default :return -EINVAL ;@@ -393,7 +389,7 @@ static int ad5791_probe(struct spi_device *spi)dev_warn (&spi->dev,"reference voltage unspecified\n" ); } - ret =ad5791_spi_write (spi,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET ); + ret =ad5791_spi_write (st,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET );if (ret) goto error_disable_reg_neg;@@ -405,7 +401,7 @@ static int ad5791_probe(struct spi_device *spi) | ((pdata && pdata->use_rbuf_gain2) ? 0 : AD5791_CTRL_RBUF) |AD5791_CTRL_BIN2SC ;Quoted 11 lines
drivers/iio/dac/ad5791.c static int ad5791_probe(struct spi_device *spi) · line 407
Quoted 6 lines
drivers/iio/dac/ad5791.c +1
-1- ret =ad5791_spi_write (spi,AD5791_ADDR_CTRL , st->ctrl | + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl |AD5791_CTRL_OPGND |AD5791_CTRL_DACTRI );if (ret) goto error_disable_reg_neg;--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Jonathan Cameron
maintainerRe: [PATCH 07/15] iio:ad5791: Do not store transfer buffers on the stack
Quoted 15 lines · Lars-Peter Clausen
Quoted 14 lines · Jonathan Cameron
Quoted 8 lines · Jonathan Cameron
Quoted 4 lines · Lars-Peter Clausen
Some SPI controllers may not be able to handle transfer buffers that are placed on the stack.
Signed-off-by Lars-Peter Clausen <[email protected]>Applied to the togreg branch of iio.git
Thanks
I really didn't review this series well enough. This should probably have gone in as a fix rather that through the togreg branch as should the other sp driver. Bit late now though given the size of the patch.
Quoted 7 lines
Quoted 4 lines
Sorry it has taken me so long to do a pull request to Greg. I always get a bit lazy on the stuff for next as can always do it tomorrow!
Slipped rather long this time though!
I think most SPI driver simply don't care as they don't do any DMA. So as long as there is a board with a DMA SPI controller + this chip combination that is in active use I don't think the patch needs to go into fixes.
Not vital, but generally I'd got for fixes for this sort of thing, because it's entirely plausible someone will base there tree off an old mainline with patches adding dma support to their driver.
Never mind though ;)
Quoted 145 lines
Quoted 140 lines
Jonathan
Quoted 131 lines
Quoted 126 lines
--- drivers/iio/dac/ad5791.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-)drivers/iio/dac/ad5791.c +21
-25@@ -91,6 +91,11 @@ struct ad5791_state {unsigned ctrl;unsigned pwr_down_mode;bool pwr_down; + +union { +__be32 d32; +u8 d8[4 ]; + } data[3 ]____cacheline_aligned ; };/** @@ -104,48 +109,39 @@ enum ad5791_supported_device_ids { ID_AD5791, }; -static int ad5791_spi_write (struct spi_device *spi,u8 addr,u32 val) +static int ad5791_spi_write (struct ad5791_state *st,u8 addr,u32 val) { -union { -__be32 d32; -u8 d8[4 ]; - } data; - - data.d32 =cpu_to_be32 (AD5791_CMD_WRITE | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_WRITE |AD5791_ADDR (addr) | (val &AD5791_DAC_MASK )); -return spi_write (spi, &data.d8[1 ],3 ); +return spi_write (st->spi, &st->data[0 ].d8[1 ],3 ); } -static int ad5791_spi_read (struct spi_device *spi,u8 addr,u32 *val) +static int ad5791_spi_read (struct ad5791_state *st,u8 addr,u32 *val) { -union { -__be32 d32; -u8 d8[4 ]; - } data[3 ];int ret;struct spi_transfer xfers[] = { { - .tx_buf = &data[0 ].d8[1 ], + .tx_buf = &st->data[0 ].d8[1 ], .bits_per_word =8 , .len =3 , .cs_change =1 , }, { - .tx_buf = &data[1 ].d8[1 ], - .rx_buf = &data[2 ].d8[1 ], + .tx_buf = &st->data[1 ].d8[1 ], + .rx_buf = &st->data[2 ].d8[1 ], .bits_per_word =8 , .len =3 , }, }; - data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ | + st->data[0 ].d32 =cpu_to_be32 (AD5791_CMD_READ |AD5791_ADDR (addr)); - data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); + st->data[1 ].d32 =cpu_to_be32 (AD5791_ADDR (AD5791_ADDR_NOOP )); - ret =spi_sync_transfer (spi, xfers,ARRAY_SIZE (xfers)); + ret =spi_sync_transfer (st->spi, xfers,ARRAY_SIZE (xfers)); - *val =be32_to_cpu (data[2 ].d32); + *val =be32_to_cpu (st->data[2 ].d32);return ret; }@@ -210,7 +206,7 @@ static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev, } st->pwr_down = pwr_down; - ret =ad5791_spi_write (st->spi,AD5791_ADDR_CTRL , st->ctrl); + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl);return ret ? ret : len; }@@ -263,7 +259,7 @@ static int ad5791_read_raw(struct iio_dev *indio_dev,switch (m) {case IIO_CHAN_INFO_RAW : - ret =ad5791_spi_read (st->spi, chan->address, val); + ret =ad5791_spi_read (st, chan->address, val);if (ret)return ret; *val &=AD5791_DAC_MASK ;@@ -330,7 +326,7 @@ static int ad5791_write_raw(struct iio_dev *indio_dev, val &=AD5791_RES_MASK (chan->scan_type.realbits); val <<= chan->scan_type.shift; -return ad5791_spi_write (st->spi, chan->address, val); +return ad5791_spi_write (st, chan->address, val);default :return -EINVAL ;@@ -393,7 +389,7 @@ static int ad5791_probe(struct spi_device *spi)dev_warn (&spi->dev,"reference voltage unspecified\n" ); } - ret =ad5791_spi_write (spi,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET ); + ret =ad5791_spi_write (st,AD5791_ADDR_SW_CTRL ,AD5791_SWCTRL_RESET );if (ret) goto error_disable_reg_neg;@@ -405,7 +401,7 @@ static int ad5791_probe(struct spi_device *spi) | ((pdata && pdata->use_rbuf_gain2) ? 0 : AD5791_CTRL_RBUF) |AD5791_CTRL_BIN2SC ; - ret =ad5791_spi_write (spi,AD5791_ADDR_CTRL , st->ctrl | + ret =ad5791_spi_write (st,AD5791_ADDR_CTRL , st->ctrl |AD5791_CTRL_OPGND |AD5791_CTRL_DACTRI );if (ret) goto error_disable_reg_neg;Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/15 iio:ad7266: Mark transfer buffer as __be16
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16 drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16 drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16 drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
--- drivers/iio/adc/ad7266.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/iio/adc/ad7266.c +12 -9
@@ -43,19 +43,22 @@ struct ad7266_state {* The buffer needs to be large enough to hold two samples (4 bytes) and * the naturally aligned timestamp (8 bytes). */ -uint8_t data[ALIGN (4 ,sizeof (s64)) +sizeof (s64)]____cacheline_aligned ; +struct { +__be16 sample[2 ]; +s64 timestamp; + } data____cacheline_aligned ; };static int ad7266_wakeup (struct ad7266_state *st) {/* Any read with >= 2 bytes will wake the device */ -return spi_read (st->spi, st->data,2 ); +return spi_read (st->spi, &st->data.sample[0 ],2 ); }static int ad7266_powerdown (struct ad7266_state *st) {/* Any read with < 2 bytes will powerdown the device */ -return spi_read (st->spi, st->data,1 ); +return spi_read (st->spi, &st->data.sample[0 ],1 ); }static int ad7266_preenable (struct iio_dev *indio_dev)
@@ -84,9 +87,9 @@ static irqreturn_t ad7266_trigger_handler(int irq, void *p)struct ad7266_state *st =iio_priv (indio_dev);int ret; - ret =spi_read (st->spi, st->data,4 ); + ret =spi_read (st->spi, st->data.sample,4 );if (ret ==0 ) { -iio_push_to_buffers_with_timestamp (indio_dev, st->data, +iio_push_to_buffers_with_timestamp (indio_dev, &st->data, pf->timestamp); }
@@ -137,7 +140,7 @@ static int ad7266_read_single(struct ad7266_state *st, int *val,ad7266_select_input (st, address); ret =spi_sync (st->spi, &st->single_msg); - *val =be16_to_cpu (st->data[address %2 ]); + *val =be16_to_cpu (st->data.sample[address %2 ]);return ret; }
@@ -442,15 +445,15 @@ static int ad7266_probe(struct spi_device *spi)ad7266_init_channels (indio_dev);/* wakeup */ - st->single_xfer[0 ].rx_buf = &st->data; + st->single_xfer[0 ].rx_buf = &st->data.sample[0 ]; st->single_xfer[0 ].len =2 ; st->single_xfer[0 ].cs_change =1 ;/* conversion */ - st->single_xfer[1 ].rx_buf = &st->data; + st->single_xfer[1 ].rx_buf = st->data.sample; st->single_xfer[1 ].len =4 ; st->single_xfer[1 ].cs_change =1 ;/* powerdown */ - st->single_xfer[2 ].tx_buf = &st->data; + st->single_xfer[2 ].tx_buf = &st->data.sample[0 ]; st->single_xfer[2 ].len =1 ;spi_message_init (&st->single_msg);
Signature · 1 line
1.8.0
Re: [PATCH 08/15] iio:ad7266: Mark transfer buffer as __be16
Quoted 5 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16 drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16 drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16 drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
Technically this does a fair bit of other refactoring, but that's all good anyway.
Quoted 2 lines
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks.
Quoted 75 lines
--- drivers/iio/adc/ad7266.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)drivers/iio/adc/ad7266.c +12
-9@@ -43,19 +43,22 @@ struct ad7266_state {* The buffer needs to be large enough to hold two samples (4 bytes) and * the naturally aligned timestamp (8 bytes). */ -uint8_t data[ALIGN (4 ,sizeof (s64)) +sizeof (s64)]____cacheline_aligned ; +struct { +__be16 sample[2 ]; +s64 timestamp; + } data____cacheline_aligned ; };static int ad7266_wakeup (struct ad7266_state *st) {/* Any read with >= 2 bytes will wake the device */ -return spi_read (st->spi, st->data,2 ); +return spi_read (st->spi, &st->data.sample[0 ],2 ); }static int ad7266_powerdown (struct ad7266_state *st) {/* Any read with < 2 bytes will powerdown the device */ -return spi_read (st->spi, st->data,1 ); +return spi_read (st->spi, &st->data.sample[0 ],1 ); }static int ad7266_preenable (struct iio_dev *indio_dev)@@ -84,9 +87,9 @@ static irqreturn_t ad7266_trigger_handler(int irq, void *p)struct ad7266_state *st =iio_priv (indio_dev);int ret; - ret =spi_read (st->spi, st->data,4 ); + ret =spi_read (st->spi, st->data.sample,4 );if (ret ==0 ) { -iio_push_to_buffers_with_timestamp (indio_dev, st->data, +iio_push_to_buffers_with_timestamp (indio_dev, &st->data, pf->timestamp); }@@ -137,7 +140,7 @@ static int ad7266_read_single(struct ad7266_state *st, int *val,ad7266_select_input (st, address); ret =spi_sync (st->spi, &st->single_msg); - *val =be16_to_cpu (st->data[address %2 ]); + *val =be16_to_cpu (st->data.sample[address %2 ]);return ret; }@@ -442,15 +445,15 @@ static int ad7266_probe(struct spi_device *spi)ad7266_init_channels (indio_dev);/* wakeup */ - st->single_xfer[0 ].rx_buf = &st->data; + st->single_xfer[0 ].rx_buf = &st->data.sample[0 ]; st->single_xfer[0 ].len =2 ; st->single_xfer[0 ].cs_change =1 ;/* conversion */ - st->single_xfer[1 ].rx_buf = &st->data; + st->single_xfer[1 ].rx_buf = st->data.sample; st->single_xfer[1 ].len =4 ; st->single_xfer[1 ].cs_change =1 ;/* powerdown */ - st->single_xfer[2 ].tx_buf = &st->data; + st->single_xfer[2 ].tx_buf = &st->data.sample[0 ]; st->single_xfer[2 ].len =1 ;spi_message_init (&st->single_msg);
PATCH 9/15 iio:vcnl4000: Mark transfer buffer as __be16
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16 drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16 drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16 drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16
--- drivers/iio/light/vcnl4000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/vcnl4000.c +1 -1
@@ -56,7 +56,7 @@ static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, u8 rdy_mask, u8 data_reg, int *val) { int tries = 20; -u16 buf; +__be16 buf;int ret; ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND,
Signature · 1 line
1.8.0
Re: [PATCH 09/15] iio:vcnl4000: Mark transfer buffer as __be16
Quoted 8 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16 drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16 drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16 drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16Signed-off-by Lars-Peter Clausen <[email protected]>Cc Peter Meerwald <[email protected]>
Applied to the togreg branch of iio.git
Thanks
Quoted 18 lines
--- drivers/iio/light/vcnl4000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/vcnl4000.c +1
-1@@ -56,7 +56,7 @@ static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, u8 rdy_mask, u8 data_reg, int *val) { int tries = 20; -u16 buf; +__be16 buf;int ret; ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND,
PATCH 10/15 staging:iio:ad7280a: Mark transfer buffer as __be32
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/staging/iio/adc/ad7280a.c:194:35: warning: incorrect type in initializer (different base types) drivers/staging/iio/adc/ad7280a.c:194:35: expected unsigned int [unsigned] tx_buf drivers/staging/iio/adc/ad7280a.c:194:35: got restricted __be32 [usertype] <noident> drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:219:13: warning: incorrect type in assignment (different base types) drivers/staging/iio/adc/ad7280a.c:219:13: expected unsigned int [unsigned] [assigned] reg drivers/staging/iio/adc/ad7280a.c:219:13: got restricted __be32 [usertype] <noident>
--- drivers/staging/iio/adc/ad7280a.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/ad7280a.c +4 -3
@@ -191,7 +191,7 @@ static void ad7280_delay(struct ad7280_state *st)static int __ad7280_read32 (struct spi_device *spi,unsigned *val) { -unsigned rx_buf, tx_buf =cpu_to_be32 (AD7280A_READ_TXVAL ); +__be32 rx_buf, tx_buf =cpu_to_be32 (AD7280A_READ_TXVAL );int ret;struct spi_transfer t = {
@@ -214,11 +214,12 @@ static int ad7280_write(struct ad7280_state *st, unsigned devaddr, {unsigned reg = (devaddr <<27 | addr <<21 | (val &0xFF ) <<13 | all <<12 ); +__be32 tx_buf; reg |=ad7280_calc_crc8 (st->crc_tab, reg >>11 ) <<3 |0x2 ; - reg =cpu_to_be32 (reg); + tx_buf =cpu_to_be32 (reg); -return spi_write (st->spi, ®,4 ); +return spi_write (st->spi, &tx_buf,4 ); } static int ad7280_read(struct ad7280_state *st, unsigned devaddr,
Signature · 1 line
1.8.0
Re: [PATCH 10/15] staging:iio:ad7280a: Mark transfer buffer as __be32
Quoted 14 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/staging/iio/adc/ad7280a.c:194:35: warning: incorrect type in initializer (different base types) drivers/staging/iio/adc/ad7280a.c:194:35: expected unsigned int [unsigned] tx_buf drivers/staging/iio/adc/ad7280a.c:194:35: got restricted __be32 [usertype] <noident> drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:207:16: warning: cast to restricted __be32 drivers/staging/iio/adc/ad7280a.c:219:13: warning: incorrect type in assignment (different base types) drivers/staging/iio/adc/ad7280a.c:219:13: expected unsigned int [unsigned] [assigned] reg drivers/staging/iio/adc/ad7280a.c:219:13: got restricted __be32 [usertype] <noident>
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
thanks
Quoted 33 lines
--- drivers/staging/iio/adc/ad7280a.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/staging/iio/adc/ad7280a.c +4
-3@@ -191,7 +191,7 @@ static void ad7280_delay(struct ad7280_state *st)static int __ad7280_read32 (struct spi_device *spi,unsigned *val) { -unsigned rx_buf, tx_buf =cpu_to_be32 (AD7280A_READ_TXVAL ); +__be32 rx_buf, tx_buf =cpu_to_be32 (AD7280A_READ_TXVAL );int ret;struct spi_transfer t = {@@ -214,11 +214,12 @@ static int ad7280_write(struct ad7280_state *st, unsigned devaddr, {unsigned reg = (devaddr <<27 | addr <<21 | (val &0xFF ) <<13 | all <<12 ); +__be32 tx_buf; reg |=ad7280_calc_crc8 (st->crc_tab, reg >>11 ) <<3 |0x2 ; - reg =cpu_to_be32 (reg); + tx_buf =cpu_to_be32 (reg); -return spi_write (st->spi, ®,4 ); +return spi_write (st->spi, &tx_buf,4 ); } static int ad7280_read(struct ad7280_state *st, unsigned devaddr,
PATCH 11/15 staging:iio:ad7280a: Do not store transfer buffer on the stack
In reply to Lars-Peter ClausenSome I2C controllers may not be able to handle transfer buffers that are placed on the stack.
--- drivers/staging/iio/adc/ad7280a.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/staging/iio/adc/ad7280a.c +15 -14
@@ -134,6 +134,8 @@ struct ad7280_state {unsigned char aux_threshhigh;unsigned char aux_threshlow;unsigned char cb_mask[AD7280A_MAX_CHAIN ]; + +__be32 buf[2 ]____cacheline_aligned ; };static void ad7280_crc8_build_table (unsigned char *crc_tab)
@@ -189,22 +191,22 @@ static void ad7280_delay(struct ad7280_state *st)msleep (1 ); } -static int __ad7280_read32 (struct spi_device *spi,unsigned *val) +static int __ad7280_read32 (struct ad7280_state *st,unsigned *val) { -__be32 rx_buf, tx_buf =cpu_to_be32 (AD7280A_READ_TXVAL );int ret; -struct spi_transfer t = { - .tx_buf = &tx_buf, - .rx_buf = &rx_buf, + .tx_buf = &st->buf[0 ], + .rx_buf = &st->buf[1 ], .len =4 , }; - ret =spi_sync_transfer (spi, &t,1 ); + st->buf[0 ] =cpu_to_be32 (AD7280A_READ_TXVAL ); + + ret =spi_sync_transfer (st->spi, &t,1 );if (ret)return ret; - *val =be32_to_cpu (rx_buf); + *val =be32_to_cpu (st->buf[1 ]);return 0 ; }
@@ -214,12 +216,11 @@ static int ad7280_write(struct ad7280_state *st, unsigned devaddr, {unsigned reg = (devaddr <<27 | addr <<21 | (val &0xFF ) <<13 | all <<12 ); -__be32 tx_buf; reg |=ad7280_calc_crc8 (st->crc_tab, reg >>11 ) <<3 |0x2 ; - tx_buf =cpu_to_be32 (reg); + st->buf[0 ] =cpu_to_be32 (reg); -return spi_write (st->spi, &tx_buf,4 ); +return spi_write (st->spi, &st->buf[0 ],4 ); } static int ad7280_read(struct ad7280_state *st, unsigned devaddr,
@@ -249,7 +250,7 @@ static int ad7280_read(struct ad7280_state *st, unsigned devaddr,if (ret)return ret; -__ad7280_read32 (st->spi, &tmp); +__ad7280_read32 (st, &tmp);if (ad7280_check_crc (st, tmp))return -EIO ;
@@ -287,7 +288,7 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned devaddr,ad7280_delay (st); -__ad7280_read32 (st->spi, &tmp); +__ad7280_read32 (st, &tmp);if (ad7280_check_crc (st, tmp))return -EIO ;
@@ -320,7 +321,7 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned cnt,ad7280_delay (st);for (i =0 ; i < cnt; i++) { -__ad7280_read32 (st->spi, &tmp); +__ad7280_read32 (st, &tmp);if (ad7280_check_crc (st, tmp))return -EIO ;
@@ -363,7 +364,7 @@ static int ad7280_chain_setup(struct ad7280_state *st)return ret;for (n =0 ; n <=AD7280A_MAX_CHAIN ; n++) { -__ad7280_read32 (st->spi, &val); +__ad7280_read32 (st, &val);if (val ==0 )return n -1 ;
Signature · 1 line
1.8.0
Re: [PATCH 11/15] staging:iio:ad7280a: Do not store transfer buffer on the stack
Quoted 4 lines · Lars-Peter Clausen
Some I2C controllers may not be able to handle transfer buffers that are placed on the stack.
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Quoted 99 lines
--- drivers/staging/iio/adc/ad7280a.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)drivers/staging/iio/adc/ad7280a.c +15
-14@@ -134,6 +134,8 @@ struct ad7280_state {unsigned char aux_threshhigh;unsigned char aux_threshlow;unsigned char cb_mask[AD7280A_MAX_CHAIN ]; + +__be32 buf[2 ]____cacheline_aligned ; };static void ad7280_crc8_build_table (unsigned char *crc_tab)@@ -189,22 +191,22 @@ static void ad7280_delay(struct ad7280_state *st)msleep (1 ); } -static int __ad7280_read32 (struct spi_device *spi,unsigned *val) +static int __ad7280_read32 (struct ad7280_state *st,unsigned *val) { -__be32 rx_buf, tx_buf =cpu_to_be32 (AD7280A_READ_TXVAL );int ret; -struct spi_transfer t = { - .tx_buf = &tx_buf, - .rx_buf = &rx_buf, + .tx_buf = &st->buf[0 ], + .rx_buf = &st->buf[1 ], .len =4 , }; - ret =spi_sync_transfer (spi, &t,1 ); + st->buf[0 ] =cpu_to_be32 (AD7280A_READ_TXVAL ); + + ret =spi_sync_transfer (st->spi, &t,1 );if (ret)return ret; - *val =be32_to_cpu (rx_buf); + *val =be32_to_cpu (st->buf[1 ]);return 0 ; }@@ -214,12 +216,11 @@ static int ad7280_write(struct ad7280_state *st, unsigned devaddr, {unsigned reg = (devaddr <<27 | addr <<21 | (val &0xFF ) <<13 | all <<12 ); -__be32 tx_buf; reg |=ad7280_calc_crc8 (st->crc_tab, reg >>11 ) <<3 |0x2 ; - tx_buf =cpu_to_be32 (reg); + st->buf[0 ] =cpu_to_be32 (reg); -return spi_write (st->spi, &tx_buf,4 ); +return spi_write (st->spi, &st->buf[0 ],4 ); } static int ad7280_read(struct ad7280_state *st, unsigned devaddr,@@ -249,7 +250,7 @@ static int ad7280_read(struct ad7280_state *st, unsigned devaddr,if (ret)return ret; -__ad7280_read32 (st->spi, &tmp); +__ad7280_read32 (st, &tmp);if (ad7280_check_crc (st, tmp))return -EIO ;@@ -287,7 +288,7 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned devaddr,ad7280_delay (st); -__ad7280_read32 (st->spi, &tmp); +__ad7280_read32 (st, &tmp);if (ad7280_check_crc (st, tmp))return -EIO ;@@ -320,7 +321,7 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned cnt,ad7280_delay (st);for (i =0 ; i < cnt; i++) { -__ad7280_read32 (st->spi, &tmp); +__ad7280_read32 (st, &tmp);if (ad7280_check_crc (st, tmp))return -EIO ;@@ -363,7 +364,7 @@ static int ad7280_chain_setup(struct ad7280_state *st)return ret;for (n =0 ; n <=AD7280A_MAX_CHAIN ; n++) { -__ad7280_read32 (st->spi, &val); +__ad7280_read32 (st, &val);if (val ==0 )return n -1 ;
PATCH 12/15 staging:iio:ad7746: Mark transfer buffer as __be32
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32
--- drivers/staging/iio/cdc/ad7746.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/cdc/ad7746.c +1 -1
@@ -567,7 +567,7 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,u8 regval, reg;union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data;
Signature · 1 line
1.8.0
Re: [PATCH 12/15] staging:iio:ad7746: Mark transfer buffer as __be32
Quoted 9 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32 drivers/staging/iio/cdc/ad7746.c:599:25: warning: cast to restricted __be32Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks
Quoted 18 lines
--- drivers/staging/iio/cdc/ad7746.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/iio/cdc/ad7746.c +1
-1@@ -567,7 +567,7 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,u8 regval, reg;union { -u32 d32; +__be32 d32;u8 d8[4 ]; } data;
PATCH 13/15 staging:iio:ad7746: Do not store the transfer buffer on the stack
In reply to Lars-Peter ClausenSome I2C controllers might not be able to handle transfer buffers that are stored on stack.
--- drivers/staging/iio/cdc/ad7746.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/staging/iio/cdc/ad7746.c +7 -7
@@ -105,6 +105,11 @@ struct ad7746_chip_info {u8 vt_setup;u8 capdac[2 ][2 ];s8 capdac_set; + +union { +__be32 d32; +u8 d8[4 ]; + } data____cacheline_aligned ; };enum ad7746_chan {
@@ -566,11 +571,6 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,int ret, delay;u8 regval, reg; -union { -__be32 d32; -u8 d8[4 ]; - } data; -mutex_lock (&indio_dev->mlock);switch (mask) {
@@ -591,12 +591,12 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,/* Now read the actual register */ ret =i2c_smbus_read_i2c_block_data (chip->client, - chan->address >>8 ,3 , &data.d8[1 ]); + chan->address >>8 ,3 , &chip->data.d8[1 ]);if (ret <0 ) goto out; - *val = (be32_to_cpu (data.d32) &0xFFFFFF ) -0x800000 ; + *val = (be32_to_cpu (chip->data.d32) &0xFFFFFF ) -0x800000 ;switch (chan->type) {case IIO_TEMP :
Signature · 1 line
1.8.0
Re: [PATCH 13/15] staging:iio:ad7746: Do not store the transfer buffer on the stack
Quoted 4 lines · Lars-Peter Clausen
Some I2C controllers might not be able to handle transfer buffers that are stored on stack.
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks,
Quoted 48 lines
--- drivers/staging/iio/cdc/ad7746.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/staging/iio/cdc/ad7746.c +7
-7@@ -105,6 +105,11 @@ struct ad7746_chip_info {u8 vt_setup;u8 capdac[2 ][2 ];s8 capdac_set; + +union { +__be32 d32; +u8 d8[4 ]; + } data____cacheline_aligned ; };enum ad7746_chan {@@ -566,11 +571,6 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,int ret, delay;u8 regval, reg; -union { -__be32 d32; -u8 d8[4 ]; - } data; -mutex_lock (&indio_dev->mlock);switch (mask) {@@ -591,12 +591,12 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,/* Now read the actual register */ ret =i2c_smbus_read_i2c_block_data (chip->client, - chan->address >>8 ,3 , &data.d8[1 ]); + chan->address >>8 ,3 , &chip->data.d8[1 ]);if (ret <0 ) goto out; - *val = (be32_to_cpu (data.d32) &0xFFFFFF ) -0x800000 ; + *val = (be32_to_cpu (chip->data.d32) &0xFFFFFF ) -0x800000 ;switch (chan->type) {case IIO_TEMP :
Jonathan Cameron
maintainerRe: [PATCH 13/15] staging:iio:ad7746: Do not store the transfer buffer on the stack
Quoted 8 lines · Jonathan Cameron
Quoted 4 lines · Lars-Peter Clausen
Some I2C controllers might not be able to handle transfer buffers that are stored on stack.
Signed-off-by Lars-Peter Clausen <[email protected]>Applied to the togreg branch of iio.git
Thanks,
Hi Lars,
I let this one through without quite enough scrutiny. It's a valid cleanup, but the statement that some i2c controllers migh tnot be able to handle transfer buffers that are stored on the stack is missleading, seeing as the relevant i2c calls do an explicit memcpy - (curriously to another buffer that is also on the stack...) I guess this might change in future. In the pull request I've mentioned that it isn't a problem right now.
So I should have picked up on the commit message content!
oops.
I'm not rebasing for a missleading bit of comment though so hopefully no one upstream will care too much!
Quoted 53 lines
Quoted 38 lines
--- drivers/staging/iio/cdc/ad7746.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/staging/iio/cdc/ad7746.c +5
-6@@ -105,6 +105,11 @@ struct ad7746_chip_info {u8 vt_setup;u8 capdac[2 ][2 ];s8 capdac_set; + +union { +__be32 d32; +u8 d8[4 ]; + } data____cacheline_aligned ; };enum ad7746_chan {@@ -566,11 +571,6 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,int ret, delay;u8 regval, reg; -union { -__be32 d32; -u8 d8[4 ]; - } data; -mutex_lock (&indio_dev->mlock);switch (mask) {@@ -591,12 +591,12 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,/* Now read the actual register */ ret = i2c_smbus_read_i2c_block_data(chip->client, - chan->address >>8 ,3 , &data.d8[1 ]);drivers/staging/iio/cdc/ad7746.c static int ad7746_read_raw(struct iio_dev *indio_dev, · line 602
Quoted 10 lines
drivers/staging/iio/cdc/ad7746.c +2
-1+ chan->address >> 8, 3, &chip->data.d8[1]);if (ret <0 ) goto out; - *val = (be32_to_cpu (data.d32) &0xFFFFFF ) -0x800000 ; + *val = (be32_to_cpu (chip->data.d32) &0xFFFFFF ) -0x800000 ;switch (chan->type) {case IIO_TEMP :--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 14/15 staging:iio:ad9832: Mark transfer buffers as __be16
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/staging/iio/frequency/ad9832.c:43:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:43:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:43:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:46:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:46:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:46:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:49:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:49:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:49:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:52:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:52:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:52:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:65:27: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:65:27: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:65:27: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:68:27: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:68:27: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:68:27: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:107:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:107:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:107:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:120:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:120:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:120:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:133:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:133:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:133:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:144:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:144:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:144:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:277:18: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:277:18: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:277:18: got restricted __be16 [usertype] <noident>
--- drivers/staging/iio/frequency/ad9832.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/frequency/ad9832.h +3 -3
@@ -92,9 +92,9 @@ struct ad9832_state {* transfer buffers to live in their own cache lines. */ union { -unsigned short freq_data[4 ]____cacheline_aligned ; -unsigned short phase_data[2 ]; -unsigned short data; +__be16 freq_data[4 ]____cacheline_aligned ; +__be16 phase_data[2 ]; +__be16 data; }; };
Signature · 1 line
1.8.0
Re: [PATCH 14/15] staging:iio:ad9832: Mark transfer buffers as __be16
Quoted 35 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/staging/iio/frequency/ad9832.c:43:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:43:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:43:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:46:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:46:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:46:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:49:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:49:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:49:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:52:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:52:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:52:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:65:27: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:65:27: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:65:27: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:68:27: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:68:27: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:68:27: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:107:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:107:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:107:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:120:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:120:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:120:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:133:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:133:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:133:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:144:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:144:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:144:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:277:18: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:277:18: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:277:18: got restricted__be16[usertype] <noident>
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks,
Quoted 22 lines
--- drivers/staging/iio/frequency/ad9832.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/iio/frequency/ad9832.h +3
-3@@ -92,9 +92,9 @@ struct ad9832_state {* transfer buffers to live in their own cache lines. */ union { -unsigned short freq_data[4 ]____cacheline_aligned ; -unsigned short phase_data[2 ]; -unsigned short data; +__be16 freq_data[4 ]____cacheline_aligned ; +__be16 phase_data[2 ]; +__be16 data; }; };
Re: [PATCH 14/15] staging:iio:ad9832: Mark transfer buffers as __be16
Quoted 36 lines · Jonathan Cameron
Quoted 35 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/staging/iio/frequency/ad9832.c:43:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:43:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:43:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:46:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:46:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:46:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:49:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:49:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:49:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:52:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:52:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:52:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:65:27: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:65:27: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:65:27: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:68:27: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:68:27: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9832.c:68:27: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:107:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:107:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:107:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:120:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:120:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:120:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:133:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:133:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:133:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:144:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:144:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:144:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9832.c:277:18: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9832.c:277:18: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9832.c:277:18: got restricted__be16[usertype] <noident>
Quoted 2 lines
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>Applied to the togreg branch of iio.git
Thanks, for taking care of the patches. Somehow this one and the ad9834 didn't make it. Shall I resend?
- Lars
Jonathan Cameron
maintainerRe: [PATCH 14/15] staging:iio:ad9832: Mark transfer buffers as __be16
Quoted 67 lines · Lars-Peter Clausen
Quoted 3 lines · Jonathan Cameron
Quoted 2 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/staging/iio/frequency/ad9832.c:43:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:43:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:43:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: expected unsignedshort [unsigned] data
Quoted 9 lines
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: got restricted
__be16[usertype] <noident>Quoted 3 lines
Quoted 2 lines
Signed-off-by Lars-Peter Clausen <[email protected]>Applied to the togreg branch of iio.git
Thanks, for taking care of the patches. Somehow this one and the ad9834 didn't make it. Shall I resend?
Oops I probably got distracted. Don't worry about the resending. I will track them down.
Quoted 6 lines
- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Jonathan Cameron
maintainerRe: [PATCH 14/15] staging:iio:ad9832: Mark transfer buffers as __be16
Quoted 73 lines · Jonathan Cameron
Quoted 70 lines · Lars-Peter Clausen
Quoted 3 lines · Jonathan Cameron
Quoted 2 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/staging/iio/frequency/ad9832.c:43:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:43:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:43:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>Applied to the togreg branch of iio.git
Thanks, for taking care of the patches. Somehow this one and the ad9834 didn't make it. Shall I resend?
Oops I probably got distracted. Don't worry about the resending. I will track them down.
Both have now 'actually' been applied and pushed out.
Quoted 7 lines
Quoted 6 lines
- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 14/15] staging:iio:ad9832: Mark transfer buffers as __be16
Quoted 74 lines · Jonathan Cameron
Quoted 73 lines · Jonathan Cameron
Quoted 70 lines · Lars-Peter Clausen
Quoted 3 lines · Jonathan Cameron
Quoted 2 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/staging/iio/frequency/ad9832.c:43:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:43:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:43:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:46:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:49:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:52:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:65:27: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: expected unsignedshort [unsigned] [short] <noident>
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:68:27: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:107:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:120:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:133:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:144:26: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: warning: incorrecttype in assignment (different base types)
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: expected unsignedshort [unsigned] data
Quoted 1 line
Quoted 1 line
drivers/staging/iio/frequency/ad9832.c:277:18: got restricted
__be16[usertype] <noident>Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>Applied to the togreg branch of iio.git
Thanks, for taking care of the patches. Somehow this one and the ad9834 didn't make it. Shall I resend?
Oops I probably got distracted. Don't worry about the resending. I will track them down.
Both have now 'actually' been applied and pushed out.
thanks.
PATCH 15/15 staging:iio:ad9834: Mark transfer buffers as __b16
In reply to Lars-Peter ClausenFixes the following warnings from sparse:
drivers/staging/iio/frequency/ad9834.c:45:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:45:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9834.c:45:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:47:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:47:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9834.c:47:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:59:18: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:59:18: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:59:18: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:100:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:100:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:100:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:108:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:108:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:108:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:122:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:122:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:122:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:131:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:131:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:131:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:194:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:194:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:194:26: got restricted __be16 [usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:387:18: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:387:18: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:387:18: got restricted __be16 [usertype] <noident>
--- drivers/staging/iio/frequency/ad9834.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/frequency/ad9834.h +2 -2
@@ -65,8 +65,8 @@ struct ad9834_state {* DMA (thus cache coherency maintenance) requires the * transfer buffers to live in their own cache lines. */ -unsigned short data____cacheline_aligned ; -unsigned short freq_data[2 ] ; +__be16 data____cacheline_aligned ; +__be16 freq_data[2 ]; };
Signature · 1 line
1.8.0
Re: [PATCH 15/15] staging:iio:ad9834: Mark transfer buffers as __b16
Quoted 29 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/staging/iio/frequency/ad9834.c:45:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:45:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9834.c:45:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:47:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:47:26: expected unsigned short [unsigned] [short] <noident>
drivers/staging/iio/frequency/ad9834.c:47:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:59:18: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:59:18: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:59:18: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:100:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:100:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:100:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:108:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:108:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:108:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:122:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:122:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:122:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:131:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:131:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:131:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:194:26: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:194:26: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:194:26: got restricted__be16[usertype] <noident>
drivers/staging/iio/frequency/ad9834.c:387:18: warning: incorrect type in assignment (different base types)
drivers/staging/iio/frequency/ad9834.c:387:18: expected unsigned short [unsigned] data
drivers/staging/iio/frequency/ad9834.c:387:18: got restricted__be16[usertype] <noident>
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks
Quoted 20 lines
--- drivers/staging/iio/frequency/ad9834.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/iio/frequency/ad9834.h +2
-2@@ -65,8 +65,8 @@ struct ad9834_state {* DMA (thus cache coherency maintenance) requires the * transfer buffers to live in their own cache lines. */ -unsigned short data____cacheline_aligned ; -unsigned short freq_data[2 ] ; +__be16 data____cacheline_aligned ; +__be16 freq_data[2 ]; };
Quoted 12 lines · Lars-Peter Clausen
Fixes the following warnings from sparse:
drivers/iio/dac/ad5504.c:71:19: warning: incorrect type in initializer (different base types) drivers/iio/dac/ad5504.c:71:19: expected unsigned short [unsigned] [usertype] tmp drivers/iio/dac/ad5504.c:71:19: got restricted __be16 [usertype] <noident> drivers/iio/dac/ad5504.c:80:19: warning: incorrect type in initializer (different base types) drivers/iio/dac/ad5504.c:80:19: expected unsigned short [unsigned] [usertype] tmp drivers/iio/dac/ad5504.c:80:19: got restricted __be16 [usertype] <noident> drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16 drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16 drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16 drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to the togreg branch of iio.git
Thanks,
Quoted 29 lines
--- drivers/iio/dac/ad5504.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/iio/dac/ad5504.c +3
-3@@ -68,7 +68,7 @@ enum ad5504_supported_device_ids {static int ad5504_spi_write (struct spi_device *spi,u8 addr,u16 val) { -u16 tmp =cpu_to_be16 (AD5504_CMD_WRITE | +__be16 tmp =cpu_to_be16 (AD5504_CMD_WRITE |AD5504_ADDR (addr) | (val &AD5504_RES_MASK ));@@ -77,8 +77,8 @@ static int ad5504_spi_write(struct spi_device *spi, u8 addr, u16 val)static int ad5504_spi_read (struct spi_device *spi,u8 addr) { -u16 tmp =cpu_to_be16 (AD5504_CMD_READ |AD5504_ADDR (addr)); -u16 val; +__be16 tmp =cpu_to_be16 (AD5504_CMD_READ |AD5504_ADDR (addr)); +__be16 val;int ret;struct spi_transfer t = { .tx_buf = &tmp,