public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: "Mark Brown" <broonie@kernel.org>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Brian Norris" <computersforpeace@gmail.com>,
	"Marek Vasut" <marek.vasut@gmail.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Cyrille Pitchen" <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Mark Brown" <broonie@kernel.org>,
	linux-spi@vger.kernel.org, "Peter Pan" <peterpansjtu@gmail.com>,
	"Frieder Schrempf" <frieder.schrempf@exceet.de>,
	"Vignesh R" <vigneshr@ti.com>,
	"Yogesh Gaur" <yogeshnarayan.gaur@nxp.com>,
	"Rafał Miłecki" <rafal@milecki.pl>,
	"Kamal Dasu" <kdasu.kdev@gmail.com>,
	"Maxime Chevallier" <maxime.chevallier@bootlin.com>,
	linux-spi@vger.kernel.org
Subject: Applied "spi: Expose spi_{map, unmap}_buf() for internal use" to the spi tree
Date: Mon, 23 Apr 2018 19:05:43 +0100	[thread overview]
Message-ID: <E1fAfqR-0004M5-3E@debutante> (raw)
In-Reply-To: <20180422183522.11118-2-boris.brezillon@bootlin.com>

The patch

   spi: Expose spi_{map,unmap}_buf() for internal use

has been applied to the spi tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 46336966bf0852d76f76c1292c057635b05dbb1b Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@bootlin.com>
Date: Sun, 22 Apr 2018 20:35:14 +0200
Subject: [PATCH] spi: Expose spi_{map,unmap}_buf() for internal use

spi_{map,unmap}_buf() are needed by the spi-mem logic that is about to
be introduced to prepare data buffer for DMA operations.

Remove the static specifier on these functions and add their prototypes
to drivers/spi/internals.h. We do not export the symbols here because
both SPI_MEM and SPI can't be enabled as modules and we'd like to
prevent controller/device drivers from using these functions.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/internals.h | 41 +++++++++++++++++++++++++++++++++++++++++
 drivers/spi/spi.c       | 25 +++++++------------------
 2 files changed, 48 insertions(+), 18 deletions(-)
 create mode 100644 drivers/spi/internals.h

diff --git a/drivers/spi/internals.h b/drivers/spi/internals.h
new file mode 100644
index 000000000000..dbe56c77b464
--- /dev/null
+++ b/drivers/spi/internals.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018 Exceet Electronics GmbH
+ * Copyright (C) 2018 Bootlin
+ *
+ * Author: Boris Brezillon <boris.brezillon@bootlin.com>
+ *
+ * Helpers needed by the spi or spi-mem logic. Should not be used outside of
+ * spi-mem.c and spi.c.
+ */
+
+#ifndef __LINUX_SPI_INTERNALS_H
+#define __LINUX_SPI_INTERNALS_H
+
+#include <linux/device.h>
+#include <linux/dma-direction.h>
+#include <linux/scatterlist.h>
+#include <linux/spi/spi.h>
+
+#ifdef CONFIG_HAS_DMA
+int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
+		struct sg_table *sgt, void *buf, size_t len,
+		enum dma_data_direction dir);
+void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,
+		   struct sg_table *sgt, enum dma_data_direction dir);
+#else /* !CONFIG_HAS_DMA */
+static inline int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
+			      struct sg_table *sgt, void *buf, size_t len,
+			      enum dma_data_direction dir)
+{
+	return -EINVAL;
+}
+
+static inline void spi_unmap_buf(struct spi_controller *ctlr,
+				 struct device *dev, struct sg_table *sgt,
+				 enum dma_data_direction dir)
+{
+}
+#endif /* CONFIG_HAS_DMA */
+
+#endif /* __LINUX_SPI_INTERNALS_H */
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 7b213faa0a2b..86b778d8563e 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -46,6 +46,8 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/spi.h>
 
+#include "internals.h"
+
 static DEFINE_IDR(spi_master_idr);
 
 static void spidev_release(struct device *dev)
@@ -740,9 +742,9 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
 }
 
 #ifdef CONFIG_HAS_DMA
-static int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
-		       struct sg_table *sgt, void *buf, size_t len,
-		       enum dma_data_direction dir)
+int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
+		struct sg_table *sgt, void *buf, size_t len,
+		enum dma_data_direction dir)
 {
 	const bool vmalloced_buf = is_vmalloc_addr(buf);
 	unsigned int max_seg_size = dma_get_max_seg_size(dev);
@@ -821,8 +823,8 @@ static int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
 	return 0;
 }
 
-static void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,
-			  struct sg_table *sgt, enum dma_data_direction dir)
+void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,
+		   struct sg_table *sgt, enum dma_data_direction dir)
 {
 	if (sgt->orig_nents) {
 		dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir);
@@ -907,19 +909,6 @@ static int __spi_unmap_msg(struct spi_controller *ctlr, struct spi_message *msg)
 	return 0;
 }
 #else /* !CONFIG_HAS_DMA */
-static inline int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
-			      struct sg_table *sgt, void *buf, size_t len,
-			      enum dma_data_direction dir)
-{
-	return -EINVAL;
-}
-
-static inline void spi_unmap_buf(struct spi_controller *ctlr,
-				 struct device *dev, struct sg_table *sgt,
-				 enum dma_data_direction dir)
-{
-}
-
 static inline int __spi_map_msg(struct spi_controller *ctlr,
 				struct spi_message *msg)
 {
-- 
2.17.0

  reply	other threads:[~2018-04-23 18:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-22 18:35 [PATCH v3 0/9] spi: Extend the framework to generically support memory devices Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 1/9] spi: Expose spi_{map,unmap}_buf() for internal use Boris Brezillon
2018-04-23 18:05   ` Mark Brown [this message]
2018-04-22 18:35 ` [PATCH v3 2/9] spi: Add an helper to flush the message queue Boris Brezillon
2018-04-23 18:05   ` Applied "spi: Add an helper to flush the message queue" to the spi tree Mark Brown
2018-04-22 18:35 ` [PATCH v3 3/9] spi: Extend the core to ease integration of SPI memory controllers Boris Brezillon
2018-04-23 21:53   ` Andy Shevchenko
2018-04-23 22:10     ` Boris Brezillon
2018-04-24 10:47       ` Mark Brown
2018-05-11  2:58   ` Applied "spi: Extend the core to ease integration of SPI memory controllers" to the spi tree Mark Brown
2018-04-22 18:35 ` [PATCH v3 4/9] spi: Make support for regular transfers optional when ->mem_ops != NULL Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 5/9] spi: bcm-qspi: Implement the spi_mem interface Boris Brezillon
2018-04-24 15:19   ` Kamal Dasu
2018-04-22 18:35 ` [PATCH v3 6/9] spi: bcm53xx: " Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 7/9] spi: ti-qspi: " Boris Brezillon
2018-04-26  9:10   ` Vignesh R
2018-04-26  9:28     ` Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 8/9] mtd: spi-nor: Use the spi_mem_xx() API Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 9/9] spi: Get rid of the spi_flash_read() API Boris Brezillon
2018-05-11  9:24   ` Boris Brezillon
2018-04-26  9:07 ` [PATCH v3 0/9] spi: Extend the framework to generically support memory devices Vignesh R
2018-04-26  9:27   ` Boris Brezillon

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=E1fAfqR-0004M5-3E@debutante \
    --to=broonie@kernel.org \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@exceet.de \
    --cc=kdasu.kdev@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=marek.vasut@gmail.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=peterpansjtu@gmail.com \
    --cc=rafal@milecki.pl \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=yogeshnarayan.gaur@nxp.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox