diff mbox

[1/1,v2] spi: Re-do the returning value of rspi_dma_check_then_transfer

Message ID 1430359932-13245-2-git-send-email-cm-hiep@jinso.co.jp (mailing list archive)
State Accepted
Commit 6310372dc34bae740db280d3354b2e470cd31284
Headers show

Commit Message

Cao Minh Hiep April 30, 2015, 2:12 a.m. UTC
From: Hiep Cao Minh <cm-hiep@jinso.co.jp>

To reduce indentation and complexity of code, insteeds of returning zero
the function rspi_dma_check_then_transfer should return rspi_dma_transfer
directly after checking error.

Signed-off-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
---
 drivers/spi/spi-rspi.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Mark Brown May 7, 2015, 12:57 p.m. UTC | #1
On Thu, Apr 30, 2015 at 11:12:12AM +0900, Cao Minh Hiep wrote:
> From: Hiep Cao Minh <cm-hiep@jinso.co.jp>
> 
> To reduce indentation and complexity of code, insteeds of returning zero
> the function rspi_dma_check_then_transfer should return rspi_dma_transfer
> directly after checking error.

Applied, thanks.  Please use subject lines reflecting the style for the
subsystem and don't send cover letters for single patches - if there's
any content in there it's usually a sign that the changelog is not
detailed enough.
Cao Minh Hiep May 8, 2015, 1:35 a.m. UTC | #2
Hi Mark-san

On 2015?05?07? 21:57, Mark Brown wrote:
> On Thu, Apr 30, 2015 at 11:12:12AM +0900, Cao Minh Hiep wrote:
>> From: Hiep Cao Minh <cm-hiep@jinso.co.jp>
>>
>> To reduce indentation and complexity of code, insteeds of returning zero
>> the function rspi_dma_check_then_transfer should return rspi_dma_transfer
>> directly after checking error.
> Applied, thanks.  Please use subject lines reflecting the style for the
> subsystem and don't send cover letters for single patches - if there's
> any content in there it's usually a sign that the changelog is not
> detailed enough.
Thank you!, I understood.

Hiep.

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 186924a..0061e28 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -665,15 +665,12 @@  static bool rspi_can_dma(struct spi_master *master, struct spi_device *spi,
 static int rspi_dma_check_then_transfer(struct rspi_data *rspi,
 					 struct spi_transfer *xfer)
 {
-	if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) {
-		/* rx_buf can be NULL on RSPI on SH in TX-only Mode */
-		int ret = rspi_dma_transfer(rspi, &xfer->tx_sg,
-					xfer->rx_buf ? &xfer->rx_sg : NULL);
-		if (ret != -EAGAIN)
-			return 0;
-	}
+	if (!rspi->master->can_dma || !__rspi_can_dma(rspi, xfer))
+		return -EAGAIN;
 
-	return -EAGAIN;
+	/* rx_buf can be NULL on RSPI on SH in TX-only Mode */
+	return rspi_dma_transfer(rspi, &xfer->tx_sg,
+				xfer->rx_buf ? &xfer->rx_sg : NULL);
 }
 
 static int rspi_common_transfer(struct rspi_data *rspi,