SUPERH platform development
 help / color / mirror / Atom feed
* [PATCH 0/1 v2] spi: Re-do the returning value of rspi_dma_check_then_transfer
@ 2015-04-30  2:12 Cao Minh Hiep
  2015-04-30  2:12 ` [PATCH 1/1 " Cao Minh Hiep
  0 siblings, 1 reply; 4+ messages in thread
From: Cao Minh Hiep @ 2015-04-30  2:12 UTC (permalink / raw)
  To: geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ
  Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, linux-spi-u79uwXL29TY76Z2rM5mHXA,
	kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ,
	yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ,
	ryusuke.sakato.bx-zM6kxYcvzFBBDgjK7y7TUQ,
	linux-sh-u79uwXL29TY76Z2rM5mHXA

From: Hiep Cao Minh <cm-hiep@jinso.co.jp>

Hi Mark
Hi Geert

This is version 2 of spi-Re-do-the-returning-value-of-rspi_dma_check_then_transfer patch.
I have tested it at linux Upstream Linux-4.0.0-10713-g6e24fd1 on Lager and Koelsch.
To reduce indentation and complexity of code, drop "ret" then function 
rspi_dma_check_then_transfer should be returning rspi_dma_transfer directly
after checking error.
Please consider the following patch for the Rcar-Gen2.

Hiep Cao Minh (1):
  spi: Re-do the returning value of rspi_dma_check_then_transfer

 drivers/spi/spi-rspi.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1 v2] spi: Re-do the returning value of rspi_dma_check_then_transfer
  2015-04-30  2:12 [PATCH 0/1 v2] spi: Re-do the returning value of rspi_dma_check_then_transfer Cao Minh Hiep
@ 2015-04-30  2:12 ` Cao Minh Hiep
  2015-05-07 12:57   ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Cao Minh Hiep @ 2015-04-30  2:12 UTC (permalink / raw)
  To: geert+renesas
  Cc: broonie, linux-spi, kuninori.morimoto.gx, yoshihiro.shimoda.uh,
	ryusuke.sakato.bx, linux-sh

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(-)

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,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1 v2] spi: Re-do the returning value of rspi_dma_check_then_transfer
  2015-04-30  2:12 ` [PATCH 1/1 " Cao Minh Hiep
@ 2015-05-07 12:57   ` Mark Brown
       [not found]     ` <20150507125744.GX15510-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2015-05-07 12:57 UTC (permalink / raw)
  To: Cao Minh Hiep
  Cc: geert+renesas, linux-spi, kuninori.morimoto.gx,
	yoshihiro.shimoda.uh, ryusuke.sakato.bx, linux-sh

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1 v2] spi: Re-do the returning value of rspi_dma_check_then_transfer
       [not found]     ` <20150507125744.GX15510-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2015-05-08  1:35       ` Cao Minh Hiep
  0 siblings, 0 replies; 4+ messages in thread
From: Cao Minh Hiep @ 2015-05-08  1:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ,
	yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ,
	ryusuke.sakato.bx-zM6kxYcvzFBBDgjK7y7TUQ,
	linux-sh-u79uwXL29TY76Z2rM5mHXA

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-08  1:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30  2:12 [PATCH 0/1 v2] spi: Re-do the returning value of rspi_dma_check_then_transfer Cao Minh Hiep
2015-04-30  2:12 ` [PATCH 1/1 " Cao Minh Hiep
2015-05-07 12:57   ` Mark Brown
     [not found]     ` <20150507125744.GX15510-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-05-08  1:35       ` Cao Minh Hiep

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox