* [PATCH 1/3] spi: Re-do the returning value of rspi_dma_check_then_transfer
[not found] ` <1430200551-20708-1-git-send-email-cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
@ 2015-04-28 5:55 ` Cao Minh Hiep
2015-04-28 9:02 ` Geert Uytterhoeven
[not found] ` <1430200551-20708-2-git-send-email-cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
2015-04-28 5:55 ` [PATCH 2/3] spi: modify the name of qspi_trigger_transfer_out_int function Cao Minh Hiep
2015-04-28 5:55 ` [PATCH 3/3] spi: Re-do the returning value of qspi_transfer_out_in Cao Minh Hiep
2 siblings, 2 replies; 12+ messages in thread
From: Cao Minh Hiep @ 2015-04-28 5:55 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-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
To reduce indentation and complex of code, insteeds of returning zero,
the function rspi_dma_check_then_transfer should be returned
rspi_dma_transfer directly after checking error.
Signed-off-by: Hiep Cao Minh <cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
---
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..a17564a 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
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 1/3] spi: Re-do the returning value of rspi_dma_check_then_transfer
2015-04-28 5:55 ` [PATCH 1/3] spi: Re-do the returning value of rspi_dma_check_then_transfer Cao Minh Hiep
@ 2015-04-28 9:02 ` Geert Uytterhoeven
[not found] ` <CAMuHMdU8fHW9SCHPTpjwQMfsQc7Qn3F29-P2tsi_j-4Pjp_QCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[not found] ` <1430200551-20708-2-git-send-email-cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
1 sibling, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2015-04-28 9:02 UTC (permalink / raw)
To: Cao Minh Hiep
Cc: Geert Uytterhoeven, Mark Brown, linux-spi, Kuninori Morimoto,
Yoshihiro Shimoda, Ryusuke Sakato, Linux-sh list
Hi Hiep-san,
On Tue, Apr 28, 2015 at 7:55 AM, Cao Minh Hiep <cm-hiep@jinso.co.jp> wrote:
> To reduce indentation and complex of code, insteeds of returning zero,
> the function rspi_dma_check_then_transfer should be returned
> rspi_dma_transfer directly after checking error.
Thanks for the update!
Unfortunately it doesn't compile...
> --- 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)) {
Superfluous opening curly brace.
Please compile and run test your patches.
Thanks!
> + 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,
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 12+ messages in thread[parent not found: <1430200551-20708-2-git-send-email-cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>]
* Re: [PATCH 1/3] spi: Re-do the returning value of rspi_dma_check_then_transfer
[not found] ` <1430200551-20708-2-git-send-email-cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
@ 2015-04-28 11:45 ` Sergei Shtylyov
[not found] ` <553F72F1.9010300-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Sergei Shtylyov @ 2015-04-28 11:45 UTC (permalink / raw)
To: Cao Minh Hiep, 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
Hello.
On 4/28/2015 8:55 AM, Cao Minh Hiep wrote:
> From: Hiep Cao Minh <cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
> To reduce indentation and complex of code, insteeds of returning zero,
Complexity?
> the function rspi_dma_check_then_transfer should be returned
Returning? Or perhaps just "return", without "be"?
> rspi_dma_transfer directly after checking error.
> Signed-off-by: Hiep Cao Minh <cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
> ---
> drivers/spi/spi-rspi.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
[...]
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] spi: modify the name of qspi_trigger_transfer_out_int function
[not found] ` <1430200551-20708-1-git-send-email-cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
2015-04-28 5:55 ` [PATCH 1/3] spi: Re-do the returning value of rspi_dma_check_then_transfer Cao Minh Hiep
@ 2015-04-28 5:55 ` Cao Minh Hiep
[not found] ` <1430200551-20708-3-git-send-email-cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
2015-04-28 5:55 ` [PATCH 3/3] spi: Re-do the returning value of qspi_transfer_out_in Cao Minh Hiep
2 siblings, 1 reply; 12+ messages in thread
From: Cao Minh Hiep @ 2015-04-28 5:55 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-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
The name of "qspi_trigger_transfer_out_int" function should be
"qspi_trigger_transfer_out_in" without "t".
Signed-off-by: Hiep Cao Minh <cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
---
drivers/spi/spi-rspi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index a17564a..3f65508 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -721,7 +721,7 @@ static int rspi_rz_transfer_one(struct spi_master *master,
return rspi_common_transfer(rspi, xfer);
}
-static int qspi_trigger_transfer_out_int(struct rspi_data *rspi, const u8 *tx,
+static int qspi_trigger_transfer_out_in(struct rspi_data *rspi, const u8 *tx,
u8 *rx, unsigned int len)
{
int i, n, ret;
@@ -768,7 +768,7 @@ static int qspi_transfer_out_in(struct rspi_data *rspi,
if (ret != -EAGAIN)
return ret;
- ret = qspi_trigger_transfer_out_int(rspi, xfer->tx_buf,
+ ret = qspi_trigger_transfer_out_in(rspi, xfer->tx_buf,
xfer->rx_buf, xfer->len);
if (ret < 0)
return ret;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 3/3] spi: Re-do the returning value of qspi_transfer_out_in
[not found] ` <1430200551-20708-1-git-send-email-cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
2015-04-28 5:55 ` [PATCH 1/3] spi: Re-do the returning value of rspi_dma_check_then_transfer Cao Minh Hiep
2015-04-28 5:55 ` [PATCH 2/3] spi: modify the name of qspi_trigger_transfer_out_int function Cao Minh Hiep
@ 2015-04-28 5:55 ` Cao Minh Hiep
2015-04-28 11:07 ` Geert Uytterhoeven
2 siblings, 1 reply; 12+ messages in thread
From: Cao Minh Hiep @ 2015-04-28 5:55 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-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
To reduce complex of code, drop "ret" then qspi_transfer_out_in function
should be returned the value of "qspi_trigger_transfer_out_in" directly.
Signed-off-by: Hiep Cao Minh <cm-hiep-HEF513clHfp3+QwDJ9on6Q@public.gmane.org>
---
drivers/spi/spi-rspi.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 3f65508..4a2cdac 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -768,12 +768,8 @@ static int qspi_transfer_out_in(struct rspi_data *rspi,
if (ret != -EAGAIN)
return ret;
- ret = qspi_trigger_transfer_out_in(rspi, xfer->tx_buf,
+ return qspi_trigger_transfer_out_in(rspi, xfer->tx_buf,
xfer->rx_buf, xfer->len);
- if (ret < 0)
- return ret;
-
- return 0;
}
static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer)
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 3/3] spi: Re-do the returning value of qspi_transfer_out_in
2015-04-28 5:55 ` [PATCH 3/3] spi: Re-do the returning value of qspi_transfer_out_in Cao Minh Hiep
@ 2015-04-28 11:07 ` Geert Uytterhoeven
2015-04-30 0:28 ` Cao Minh Hiep
0 siblings, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2015-04-28 11:07 UTC (permalink / raw)
To: Cao Minh Hiep
Cc: Geert Uytterhoeven, Mark Brown, linux-spi, Kuninori Morimoto,
Yoshihiro Shimoda, Ryusuke Sakato, Linux-sh list
On Tue, Apr 28, 2015 at 7:55 AM, Cao Minh Hiep <cm-hiep@jinso.co.jp> wrote:
> From: Hiep Cao Minh <cm-hiep@jinso.co.jp>
>
> To reduce complex of code, drop "ret" then qspi_transfer_out_in function
> should be returned the value of "qspi_trigger_transfer_out_in" directly.
>
> Signed-off-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 3/3] spi: Re-do the returning value of qspi_transfer_out_in
2015-04-28 11:07 ` Geert Uytterhoeven
@ 2015-04-30 0:28 ` Cao Minh Hiep
0 siblings, 0 replies; 12+ messages in thread
From: Cao Minh Hiep @ 2015-04-30 0:28 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Geert Uytterhoeven, Mark Brown, linux-spi, Kuninori Morimoto,
Yoshihiro Shimoda, Ryusuke Sakato, Linux-sh list
On 2015年04月28日 20:07, Geert Uytterhoeven wrote:
> On Tue, Apr 28, 2015 at 7:55 AM, Cao Minh Hiep <cm-hiep@jinso.co.jp> wrote:
>> From: Hiep Cao Minh <cm-hiep@jinso.co.jp>
>>
>> To reduce complex of code, drop "ret" then qspi_transfer_out_in function
>> should be returned the value of "qspi_trigger_transfer_out_in" directly.
>>
>> Signed-off-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Thanks,
^ permalink raw reply [flat|nested] 12+ messages in thread