All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer
@ 2014-03-19  3:53 Axel Lin
  2014-03-19  3:55 ` [PATCH 2/7] spi: atmel: Let spi core validate " Axel Lin
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Axel Lin @ 2014-03-19  3:53 UTC (permalink / raw)
  To: Mark Brown
  Cc: Wenyou Yang, Fabrice Crohas, Illia Smyrnov, Atsushi Nemoto,
	Lars-Peter Clausen, linux-spi-u79uwXL29TY76Z2rM5mHXA

Reject transfer if both tx_buf and rx_buf are NULL for non-zero length transfer.
Add the checking in spi core so we can remove the same checking in various
drivers.

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 26b331d..0a29d2a 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1876,6 +1876,10 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
 		if (xfer->len % w_size)
 			return -EINVAL;
 
+		/* non-zero length transfer must has tx_buf or rx_buf */
+		if (xfer->len && !xfer->tx_buf && !xfer->rx_buf)
+			return -EINVAL;
+
 		if (xfer->speed_hz && master->min_speed_hz &&
 		    xfer->speed_hz < master->min_speed_hz)
 			return -EINVAL;
-- 
1.8.3.2



--
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] 13+ messages in thread

* [PATCH 2/7] spi: atmel: Let spi core validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:53 [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer Axel Lin
@ 2014-03-19  3:55 ` Axel Lin
  2014-03-19  4:01   ` Yang, Wenyou
  2014-03-19  3:56 ` [PATCH 3/7] spi: omap-100k: " Axel Lin
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Axel Lin @ 2014-03-19  3:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Wenyou Yang, linux-spi-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-atmel.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index bda961e..c54492b 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1065,11 +1065,6 @@ static int atmel_spi_one_transfer(struct spi_master *master,
 
 	as = spi_master_get_devdata(master);
 
-	if (!(xfer->tx_buf || xfer->rx_buf) && xfer->len) {
-		dev_dbg(&spi->dev, "missing rx or tx buf\n");
-		return -EINVAL;
-	}
-
 	if (xfer->bits_per_word) {
 		asd = spi->controller_state;
 		bits = (asd->csr >> 4) & 0xf;
-- 
1.8.3.2



--
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] 13+ messages in thread

* [PATCH 3/7] spi: omap-100k: Let spi core validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:53 [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer Axel Lin
  2014-03-19  3:55 ` [PATCH 2/7] spi: atmel: Let spi core validate " Axel Lin
@ 2014-03-19  3:56 ` Axel Lin
  2014-03-19  3:57 ` [PATCH 4/7] spi: omap2-mcspi: " Axel Lin
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Axel Lin @ 2014-03-19  3:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Fabrice Crohas, linux-spi-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-omap-100k.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c
index c9e2282..05069ee 100644
--- a/drivers/spi/spi-omap-100k.c
+++ b/drivers/spi/spi-omap-100k.c
@@ -324,10 +324,6 @@ static int omap1_spi100k_transfer_one_message(struct spi_master *master,
 	int status = 0;
 
 	list_for_each_entry(t, &m->transfers, transfer_list) {
-		if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) {
-			status = -EINVAL;
-			break;
-		}
 		if (par_override || t->speed_hz || t->bits_per_word) {
 			par_override = 1;
 			status = omap1_spi100k_setup_transfer(spi, t);
-- 
1.8.3.2



--
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] 13+ messages in thread

* [PATCH 4/7] spi: omap2-mcspi: Let spi core validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:53 [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer Axel Lin
  2014-03-19  3:55 ` [PATCH 2/7] spi: atmel: Let spi core validate " Axel Lin
  2014-03-19  3:56 ` [PATCH 3/7] spi: omap-100k: " Axel Lin
@ 2014-03-19  3:57 ` Axel Lin
  2014-03-19  3:58 ` [PATCH 5/7] spi: txx9: " Axel Lin
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Axel Lin @ 2014-03-19  3:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Illia Smyrnov, linux-spi-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-omap2-mcspi.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 2941c5b..a0746a7 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1081,10 +1081,6 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
 
 	omap2_mcspi_set_enable(spi, 0);
 	list_for_each_entry(t, &m->transfers, transfer_list) {
-		if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) {
-			status = -EINVAL;
-			break;
-		}
 		if (par_override ||
 		    (t->speed_hz != spi->max_speed_hz) ||
 		    (t->bits_per_word != spi->bits_per_word)) {
@@ -1212,16 +1208,6 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
 		void		*rx_buf = t->rx_buf;
 		unsigned	len = t->len;
 
-		if ((len && !(rx_buf || tx_buf))) {
-			dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d bpw\n",
-					t->speed_hz,
-					len,
-					tx_buf ? "tx" : "",
-					rx_buf ? "rx" : "",
-					t->bits_per_word);
-			return -EINVAL;
-		}
-
 		if (m->is_dma_mapped || len < DMA_MIN_BYTES)
 			continue;
 
-- 
1.8.3.2



--
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] 13+ messages in thread

* [PATCH 5/7] spi: txx9: Let spi core validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:53 [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer Axel Lin
                   ` (2 preceding siblings ...)
  2014-03-19  3:57 ` [PATCH 4/7] spi: omap2-mcspi: " Axel Lin
@ 2014-03-19  3:58 ` Axel Lin
  2014-03-19  3:59 ` [PATCH 6/7] spi: xcomm: " Axel Lin
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Axel Lin @ 2014-03-19  3:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Atsushi Nemoto, linux-spi-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-txx9.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c
index 820b499..10ffbc0 100644
--- a/drivers/spi/spi-txx9.c
+++ b/drivers/spi/spi-txx9.c
@@ -299,17 +299,10 @@ static int txx9spi_transfer(struct spi_device *spi, struct spi_message *m)
 {
 	struct spi_master *master = spi->master;
 	struct txx9spi *c = spi_master_get_devdata(master);
-	struct spi_transfer *t;
 	unsigned long flags;
 
 	m->actual_length = 0;
 
-	/* check each transfer's parameters */
-	list_for_each_entry(t, &m->transfers, transfer_list) {
-		if (!t->tx_buf && !t->rx_buf && t->len)
-			return -EINVAL;
-	}
-
 	spin_lock_irqsave(&c->lock, flags);
 	list_add_tail(&m->queue, &c->queue);
 	queue_work(c->workqueue, &c->work);
-- 
1.8.3.2



--
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] 13+ messages in thread

* [PATCH 6/7] spi: xcomm: Let spi core validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:53 [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer Axel Lin
                   ` (3 preceding siblings ...)
  2014-03-19  3:58 ` [PATCH 5/7] spi: txx9: " Axel Lin
@ 2014-03-19  3:59 ` Axel Lin
  2014-03-19  7:39   ` Lars-Peter Clausen
  2014-03-19  4:00 ` [PATCH 7/7] spi: bitbang: " Axel Lin
  2014-03-19  8:06 ` [PATCH 1/7] spi: core: Validate " Geert Uytterhoeven
  6 siblings, 1 reply; 13+ messages in thread
From: Axel Lin @ 2014-03-19  3:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Lars-Peter Clausen, linux-spi-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-xcomm.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c
index bb478dc..736a488 100644
--- a/drivers/spi/spi-xcomm.c
+++ b/drivers/spi/spi-xcomm.c
@@ -149,11 +149,6 @@ static int spi_xcomm_transfer_one(struct spi_master *master,
 
 	list_for_each_entry(t, &msg->transfers, transfer_list) {
 
-		if (!t->tx_buf && !t->rx_buf && t->len) {
-			status = -EINVAL;
-			break;
-		}
-
 		status = spi_xcomm_setup_transfer(spi_xcomm, spi, t, &settings);
 		if (status < 0)
 			break;
-- 
1.8.3.2



--
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] 13+ messages in thread

* [PATCH 7/7] spi: bitbang: Let spi core validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:53 [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer Axel Lin
                   ` (4 preceding siblings ...)
  2014-03-19  3:59 ` [PATCH 6/7] spi: xcomm: " Axel Lin
@ 2014-03-19  4:00 ` Axel Lin
  2014-03-19  8:06 ` [PATCH 1/7] spi: core: Validate " Geert Uytterhoeven
  6 siblings, 0 replies; 13+ messages in thread
From: Axel Lin @ 2014-03-19  4:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-bitbang.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c
index 3bfdb85..4beabea 100644
--- a/drivers/spi/spi-bitbang.c
+++ b/drivers/spi/spi-bitbang.c
@@ -317,10 +317,6 @@ static int spi_bitbang_transfer_one(struct spi_master *master,
 			ndelay(nsecs);
 		}
 		cs_change = t->cs_change;
-		if (!t->tx_buf && !t->rx_buf && t->len) {
-			status = -EINVAL;
-			break;
-		}
 
 		/* transfer data.  the lower level code handles any
 		 * new dma mappings it needs. our caller always gave
-- 
1.8.3.2



--
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] 13+ messages in thread

* RE: [PATCH 2/7] spi: atmel: Let spi core validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:55 ` [PATCH 2/7] spi: atmel: Let spi core validate " Axel Lin
@ 2014-03-19  4:01   ` Yang, Wenyou
  0 siblings, 0 replies; 13+ messages in thread
From: Yang, Wenyou @ 2014-03-19  4:01 UTC (permalink / raw)
  To: Axel Lin, Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1188 bytes --]



> -----Original Message-----
> From: Axel Lin [mailto:axel.lin@ingics.com]
> Sent: Wednesday, March 19, 2014 11:55 AM
> To: Mark Brown
> Cc: Yang, Wenyou; linux-spi@vger.kernel.org
> Subject: [PATCH 2/7] spi: atmel: Let spi core validate Tx/Rx buffers for
> non-zero length transfer
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Wenyou.Yang <wenyou.yang@atmel.com>
> ---
>  drivers/spi/spi-atmel.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index
> bda961e..c54492b 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -1065,11 +1065,6 @@ static int atmel_spi_one_transfer(struct
> spi_master *master,
> 
>  	as = spi_master_get_devdata(master);
> 
> -	if (!(xfer->tx_buf || xfer->rx_buf) && xfer->len) {
> -		dev_dbg(&spi->dev, "missing rx or tx buf\n");
> -		return -EINVAL;
> -	}
> -
>  	if (xfer->bits_per_word) {
>  		asd = spi->controller_state;
>  		bits = (asd->csr >> 4) & 0xf;
> --
> 1.8.3.2
> 
> 

N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±²˜¢žØ^n‡r¡ö¦zË\x1aëh™¨è­Ú&¢îý»\x05ËÛÔØï¦v¬Îf\x1dp)¹¹br	šê+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹\x1e®w¥¢¸?™¨è­Ú&¢)ߢ^[f

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

* Re: [PATCH 6/7] spi: xcomm: Let spi core validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:59 ` [PATCH 6/7] spi: xcomm: " Axel Lin
@ 2014-03-19  7:39   ` Lars-Peter Clausen
  0 siblings, 0 replies; 13+ messages in thread
From: Lars-Peter Clausen @ 2014-03-19  7:39 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA

On 03/19/2014 04:59 AM, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>

Acked-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>

Thanks.
--
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] 13+ messages in thread

* Re: [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer
  2014-03-19  3:53 [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer Axel Lin
                   ` (5 preceding siblings ...)
  2014-03-19  4:00 ` [PATCH 7/7] spi: bitbang: " Axel Lin
@ 2014-03-19  8:06 ` Geert Uytterhoeven
       [not found]   ` <CAMuHMdWCdp_SW5CNt50cSfG700JRU3tr=Pbyhv8nv-1Ve=XUNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  6 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2014-03-19  8:06 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, Wenyou Yang, Fabrice Crohas, Illia Smyrnov,
	Atsushi Nemoto, Lars-Peter Clausen, linux-spi

On Wed, Mar 19, 2014 at 4:53 AM, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
> Reject transfer if both tx_buf and rx_buf are NULL for non-zero length transfer.
> Add the checking in spi core so we can remove the same checking in various
> drivers.

Just wondering: are there any SPI slave drivers that implement dummy cycles
this way?

> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/spi/spi.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 26b331d..0a29d2a 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1876,6 +1876,10 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
>                 if (xfer->len % w_size)
>                         return -EINVAL;
>
> +               /* non-zero length transfer must has tx_buf or rx_buf */

have

> +               if (xfer->len && !xfer->tx_buf && !xfer->rx_buf)
> +                       return -EINVAL;
> +

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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
--
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] 13+ messages in thread

* Re: [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer
       [not found]   ` <CAMuHMdWCdp_SW5CNt50cSfG700JRU3tr=Pbyhv8nv-1Ve=XUNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-03-19 15:43     ` Axel Lin
       [not found]       ` <CAFRkauCUUOQ0xxa-k5_TMKUA7jnnz1FPjXnGT4T10v7upyOy8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2014-08-16 14:34     ` Mark Brown
  1 sibling, 1 reply; 13+ messages in thread
From: Axel Lin @ 2014-03-19 15:43 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Mark Brown, Wenyou Yang, Fabrice Crohas, Illia Smyrnov,
	Atsushi Nemoto, Lars-Peter Clausen, linux-spi

2014-03-19 16:06 GMT+08:00 Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>:
> On Wed, Mar 19, 2014 at 4:53 AM, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
>> Reject transfer if both tx_buf and rx_buf are NULL for non-zero length transfer.
>> Add the checking in spi core so we can remove the same checking in various
>> drivers.
>
> Just wondering: are there any SPI slave drivers that implement dummy cycles
> this way?

I think I found one such case:
drivers/net/wireless/libertas/if_spi.c
the dummy_trans has non-zero length, and both tx_buf and rx_buf are NULL.

But that means it doesn't work with master drivers with this checking, e.g.
all drivers using bitbang library has this checking.

Regards,
Axel
--
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] 13+ messages in thread

* Re: [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer
       [not found]       ` <CAFRkauCUUOQ0xxa-k5_TMKUA7jnnz1FPjXnGT4T10v7upyOy8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-03-19 16:08         ` Mark Brown
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2014-03-19 16:08 UTC (permalink / raw)
  To: Axel Lin
  Cc: Geert Uytterhoeven, Wenyou Yang, Fabrice Crohas, Illia Smyrnov,
	Atsushi Nemoto, Lars-Peter Clausen, linux-spi

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

On Wed, Mar 19, 2014 at 11:43:55PM +0800, Axel Lin wrote:
> 2014-03-19 16:06 GMT+08:00 Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>:

> > Just wondering: are there any SPI slave drivers that implement dummy cycles
> > this way?

> I think I found one such case:
> drivers/net/wireless/libertas/if_spi.c
> the dummy_trans has non-zero length, and both tx_buf and rx_buf are NULL.

> But that means it doesn't work with master drivers with this checking, e.g.
> all drivers using bitbang library has this checking.

I have to say that this seems rather abusive on the part of the driver,
it's going to cause implementation issues in the masters - I expect more
than just those that check aren't doing to do the right thing.

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

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

* Re: [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer
       [not found]   ` <CAMuHMdWCdp_SW5CNt50cSfG700JRU3tr=Pbyhv8nv-1Ve=XUNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2014-03-19 15:43     ` Axel Lin
@ 2014-08-16 14:34     ` Mark Brown
  1 sibling, 0 replies; 13+ messages in thread
From: Mark Brown @ 2014-08-16 14:34 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Axel Lin, Wenyou Yang, Fabrice Crohas, Illia Smyrnov,
	Atsushi Nemoto, Lars-Peter Clausen, linux-spi

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

On Wed, Mar 19, 2014 at 09:06:31AM +0100, Geert Uytterhoeven wrote:
> On Wed, Mar 19, 2014 at 4:53 AM, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:

> > Reject transfer if both tx_buf and rx_buf are NULL for non-zero length transfer.
> > Add the checking in spi core so we can remove the same checking in various
> > drivers.

> Just wondering: are there any SPI slave drivers that implement dummy cycles
> this way?

The ChromeOS EC apparently does this.

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

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

end of thread, other threads:[~2014-08-16 14:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19  3:53 [PATCH 1/7] spi: core: Validate Tx/Rx buffers for non-zero length transfer Axel Lin
2014-03-19  3:55 ` [PATCH 2/7] spi: atmel: Let spi core validate " Axel Lin
2014-03-19  4:01   ` Yang, Wenyou
2014-03-19  3:56 ` [PATCH 3/7] spi: omap-100k: " Axel Lin
2014-03-19  3:57 ` [PATCH 4/7] spi: omap2-mcspi: " Axel Lin
2014-03-19  3:58 ` [PATCH 5/7] spi: txx9: " Axel Lin
2014-03-19  3:59 ` [PATCH 6/7] spi: xcomm: " Axel Lin
2014-03-19  7:39   ` Lars-Peter Clausen
2014-03-19  4:00 ` [PATCH 7/7] spi: bitbang: " Axel Lin
2014-03-19  8:06 ` [PATCH 1/7] spi: core: Validate " Geert Uytterhoeven
     [not found]   ` <CAMuHMdWCdp_SW5CNt50cSfG700JRU3tr=Pbyhv8nv-1Ve=XUNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-19 15:43     ` Axel Lin
     [not found]       ` <CAFRkauCUUOQ0xxa-k5_TMKUA7jnnz1FPjXnGT4T10v7upyOy8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-19 16:08         ` Mark Brown
2014-08-16 14:34     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.