From: Tomasz Figa <hidden> Date: 2013-08-11 00:33:28
Not all fields of dma_slave_config struct are being initialized by
prepare_dma() function, leaving those which are not in undefined state,
which can confuse DMA drivers using them.
This patch adds call to memset() to zero the struct before initializing
a subset of its fields.
Signed-off-by: Tomasz Figa <redacted>
---
drivers/spi/spi-s3c64xx.c | 2 ++
1 file changed, 2 insertions(+)
From: Tomasz Figa <hidden> Date: 2013-08-11 00:33:29
Comments in linux/spi/spi.h and observed behavior show that .setup()
callback can be called multiple times without corresponding calls to
.cleanup(), what was incorrectly assumed by spi-s3c64xx driver, leading
to failures trying to request CS GPIO multiple times.
This patch modifies the behavior of spi-s3c64xx driver to request CS
GPIO only on first call to .setup() after last .cleanup().
Signed-off-by: Tomasz Figa <redacted>
---
drivers/spi/spi-s3c64xx.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
@@ -1068,20 +1068,21 @@ static int s3c64xx_spi_setup(struct spi_device *spi)return-ENODEV;}-/* Request gpio only if cs line is asserted by gpio pins */-if(sdd->cs_gpio){-err=gpio_request_one(cs->line,GPIOF_OUT_INIT_HIGH,-dev_name(&spi->dev));-if(err){-dev_err(&spi->dev,-"Failed to get /CS gpio [%d]: %d\n",-cs->line,err);-gotoerr_gpio_req;+if(!spi_get_ctldata(spi)){+/* Request gpio only if cs line is asserted by gpio pins */+if(sdd->cs_gpio){+err=gpio_request_one(cs->line,GPIOF_OUT_INIT_HIGH,+dev_name(&spi->dev));+if(err){+dev_err(&spi->dev,+"Failed to get /CS gpio [%d]: %d\n",+cs->line,err);+gotoerr_gpio_req;+}}-}-if(!spi_get_ctldata(spi))spi_set_ctldata(spi,cs);+}sci=sdd->cntrlr_info;
From: Tomasz Figa <hidden> Date: 2013-08-11 00:33:30
Since the driver supports only contiguous buffers, there is no need to
manually construct a scatterlist with just a single entry, when there is
a dedicated helper for this purpose.
This patch modifies prepare_dma() function to use available helper instead
of manually creating a scatterlist.
Signed-off-by: Tomasz Figa <redacted>
---
drivers/spi/spi-s3c64xx.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
On Sun, Aug 11, 2013 at 02:33:28AM +0200, Tomasz Figa wrote:
Not all fields of dma_slave_config struct are being initialized by
prepare_dma() function, leaving those which are not in undefined state,
which can confuse DMA drivers using them.