All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>
To: cip-dev@lists.cip-project.org,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Pavel Machek <pavel@denx.de>
Cc: Biju Das <biju.das.jz@bp.renesas.com>
Subject: [cip-dev] [PATCH 4.19.y-cip 3/7] spi: spi-mem: Add SPI_MEM_NO_DATA to the spi_mem_data_dir enum
Date: Mon, 23 Nov 2020 12:03:50 +0000	[thread overview]
Message-ID: <20201123120354.26413-4-prabhakar.mahadev-lad.rj@bp.renesas.com> (raw)
In-Reply-To: <20201123120354.26413-1-prabhakar.mahadev-lad.rj@bp.renesas.com>

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

From: Boris Brezillon <boris.brezillon@bootlin.com>

commit 0ebb261a0b2d090de618a383d2378d4a00834958 upstream.

When defining spi_mem_op templates we don't necessarily know the size
that will be passed when the template is actually used, and basing the
supports_op() check on op->data.nbytes to know whether there will be
data transferred for a specific operation is this not possible.

Add SPI_MEM_NO_DATA to the spi_mem_data_dir enum so that we can base
our checks on op->data.dir instead of op->data.nbytes.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
[PL: manually applied the changes]
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/spi/spi-mem.c       | 2 +-
 include/linux/spi/spi-mem.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 62a7b80801d2..967f581bca4f 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -142,7 +142,7 @@ static bool spi_mem_default_supports_op(struct spi_mem *mem,
 	    spi_check_buswidth_req(mem, op->dummy.buswidth, true))
 		return false;
 
-	if (op->data.nbytes &&
+	if (op->data.dir != SPI_MEM_NO_DATA &&
 	    spi_check_buswidth_req(mem, op->data.buswidth,
 				   op->data.dir == SPI_MEM_DATA_OUT))
 		return false;
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index 69ee30456864..80db2de83402 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -57,10 +57,12 @@
 /**
  * enum spi_mem_data_dir - describes the direction of a SPI memory data
  *			   transfer from the controller perspective
+ * @SPI_MEM_NO_DATA: no data transferred
  * @SPI_MEM_DATA_IN: data coming from the SPI memory
  * @SPI_MEM_DATA_OUT: data sent the SPI memory
  */
 enum spi_mem_data_dir {
+	SPI_MEM_NO_DATA,
 	SPI_MEM_DATA_IN,
 	SPI_MEM_DATA_OUT,
 };
-- 
2.17.1


[-- Attachment #2: Type: text/plain, Size: 420 bytes --]


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5819): https://lists.cip-project.org/g/cip-dev/message/5819
Mute This Topic: https://lists.cip-project.org/mt/78451542/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-


  parent reply	other threads:[~2020-11-23 12:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 12:03 [cip-dev] [PATCH 4.19.y-cip 0/7] Add RPC-IF driver for RZ/G2x SoC's Lad Prabhakar
2020-11-23 12:03 ` [cip-dev] [PATCH 4.19.y-cip 1/7] dt-bindings: memory: document Renesas RPC-IF bindings Lad Prabhakar
2020-11-23 12:03 ` [cip-dev] [PATCH 4.19.y-cip 2/7] memory: add Renesas RPC-IF driver Lad Prabhakar
2020-11-23 19:37   ` Pavel Machek
2020-11-23 23:00     ` Lad Prabhakar
2020-11-24  9:27       ` Pavel Machek
2020-11-23 19:38   ` Pavel Machek
2020-11-23 23:02     ` Lad Prabhakar
2020-11-23 12:03 ` Lad Prabhakar [this message]
2020-11-23 12:03 ` [cip-dev] [PATCH 4.19.y-cip 4/7] spi: spi-mem: export spi_mem_default_supports_op() Lad Prabhakar
2020-11-23 12:03 ` [cip-dev] [PATCH 4.19.y-cip 5/7] spi: spi-mem: Split spi_mem_exec_op() code Lad Prabhakar
2020-11-23 19:43   ` Pavel Machek
2020-11-23 23:05     ` Lad Prabhakar
2020-11-23 12:03 ` [cip-dev] [PATCH 4.19.y-cip 6/7] spi: spi-mem: Add a new API to support direct mapping Lad Prabhakar
2020-11-23 19:46   ` Pavel Machek
2020-11-23 23:08     ` Lad Prabhakar
2020-11-23 12:03 ` [cip-dev] [PATCH 4.19.y-cip 7/7] spi: add Renesas RPC-IF driver Lad Prabhakar
2020-11-23 19:52   ` Pavel Machek
2020-11-23 23:12     ` Lad Prabhakar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201123120354.26413-4-prabhakar.mahadev-lad.rj@bp.renesas.com \
    --to=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.