Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752936AbcKRA7D (ORCPT ); Thu, 17 Nov 2016 19:59:03 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:40589 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752760AbcKRA7B (ORCPT ); Thu, 17 Nov 2016 19:59:01 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Thu, 17 Nov 2016 16:52:43 -0800 From: Stefan Agner To: Sanchayan Maity Cc: broonie@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH 1/4] spi: spi-fsl-dspi: Fix SPI transfer issue when using multiple SPI_IOC_MESSAGE In-Reply-To: References: Message-ID: User-Agent: Roundcube Webmail/1.1.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1632 Lines: 48 On 2016-11-17 04:16, Sanchayan Maity wrote: > Current DMA implementation had a bug where the DMA transfer would > exit the loop in dspi_transfer_one_message after the completion of > a single transfer. This results in a multi message transfer submitted > with SPI_IOC_MESSAGE to terminate incorrectly without an error. Looks good to me: Reviewed-by: Stefan Agner > > Signed-off-by: Sanchayan Maity > --- > drivers/spi/spi-fsl-dspi.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c > index bc64700..b1ee1f5 100644 > --- a/drivers/spi/spi-fsl-dspi.c > +++ b/drivers/spi/spi-fsl-dspi.c > @@ -714,7 +714,7 @@ static int dspi_transfer_one_message(struct > spi_master *master, > SPI_RSER_TFFFE | SPI_RSER_TFFFD | > SPI_RSER_RFDFE | SPI_RSER_RFDFD); > status = dspi_dma_xfer(dspi); > - goto out; > + break; > default: > dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", > trans_mode); > @@ -722,9 +722,13 @@ static int dspi_transfer_one_message(struct > spi_master *master, > goto out; > } > > - if (wait_event_interruptible(dspi->waitq, dspi->waitflags)) > - dev_err(&dspi->pdev->dev, "wait transfer complete fail!\n"); > - dspi->waitflags = 0; > + if (trans_mode != DSPI_DMA_MODE) { > + if (wait_event_interruptible(dspi->waitq, > + dspi->waitflags)) > + dev_err(&dspi->pdev->dev, > + "wait transfer complete fail!\n"); > + dspi->waitflags = 0; > + } > > if (transfer->delay_usecs) > udelay(transfer->delay_usecs);