dmaengine Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/4] dmaengine: use inclusive terminology
@ 2020-10-15  7:31 Vinod Koul
  2020-10-15  7:31 ` [PATCH 1/4] dmaengine: move enums in interface to use peripheral term Vinod Koul
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Vinod Koul @ 2020-10-15  7:31 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul

dmaengine history has a non inclusive terminology of dmaengine slave, I
feel it is time to replace that. This series starts the work by replacing
slave with peripheral as I feel this is an appropriate term for dmaengine
peripheral devices.

This series updates the header for dmaengine and use macros to keep existing
name to avoid breaking users. If people are okay with this, I will post rest
of the pile which does conversion for whole subsystem. After next cycle we
will move users and once that is done drop the macros.

Vinod Koul (4):
  dmaengine: move enums in interface to use peripheral term
  dmaengine: move struct in interface to use peripheral term
  dmaengine: move APIs in interface to use peripheral term
  dmaengine: core: update to use peripheral term

 drivers/dma/dmaengine.c   |  48 ++++++------
 include/linux/dmaengine.h | 161 +++++++++++++++++++++++---------------
 2 files changed, 124 insertions(+), 85 deletions(-)

-- 
2.26.2


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

* [PATCH 1/4] dmaengine: move enums in interface to use peripheral term
  2020-10-15  7:31 [PATCH 0/4] dmaengine: use inclusive terminology Vinod Koul
@ 2020-10-15  7:31 ` Vinod Koul
  2020-10-19  8:54   ` Peter Ujfalusi
  2020-10-15  7:31 ` [PATCH 2/4] dmaengine: move struct " Vinod Koul
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Vinod Koul @ 2020-10-15  7:31 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul

dmaengine history has a non inclusive terminology of dmaengine slave, I
feel it is time to replace that. Start with moving enums in dmaengine
interface with replacement of slave to peripheral which is an
appropriate term for dmaengine peripheral devices

Since the change of name can break users, the new names have been added
with old enums kept as macro define for new names. Once the users have
been migrated, these macros will be dropped.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 include/linux/dmaengine.h | 44 ++++++++++++++++++++++++++-------------
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index dd357a747780..f7f420876d21 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -59,7 +59,7 @@ enum dma_transaction_type {
 	DMA_INTERRUPT,
 	DMA_PRIVATE,
 	DMA_ASYNC_TX,
-	DMA_SLAVE,
+	DMA_PERIPHERAL,
 	DMA_CYCLIC,
 	DMA_INTERLEAVE,
 	DMA_COMPLETION_NO_ORDER,
@@ -69,12 +69,14 @@ enum dma_transaction_type {
 	DMA_TX_TYPE_END,
 };
 
+#define DMA_SLAVE DMA_PERIPHERAL
+
 /**
  * enum dma_transfer_direction - dma transfer mode and direction indicator
  * @DMA_MEM_TO_MEM: Async/Memcpy mode
- * @DMA_MEM_TO_DEV: Slave mode & From Memory to Device
- * @DMA_DEV_TO_MEM: Slave mode & From Device to Memory
- * @DMA_DEV_TO_DEV: Slave mode & From Device to Device
+ * @DMA_MEM_TO_DEV: Peripheral mode & From Memory to Device
+ * @DMA_DEV_TO_MEM: Peripheral mode & From Device to Memory
+ * @DMA_DEV_TO_DEV: Peripheral mode & From Device to Device
  */
 enum dma_transfer_direction {
 	DMA_MEM_TO_MEM,
@@ -364,22 +366,34 @@ struct dma_chan_dev {
 	int dev_id;
 };
 
+#define	DMA_SLAVE_BUSWIDTH_UNDEFINED	DMA_PERIPHERAL_BUSWIDTH_UNDEFINED
+#define	DMA_SLAVE_BUSWIDTH_1_BYTE	DMA_PERIPHERAL_BUSWIDTH_1_BYTE
+#define	DMA_SLAVE_BUSWIDTH_2_BYTES	DMA_PERIPHERAL_BUSWIDTH_2_BYTES
+#define	DMA_SLAVE_BUSWIDTH_3_BYTES	DMA_PERIPHERAL_BUSWIDTH_3_BYTES
+#define	DMA_SLAVE_BUSWIDTH_4_BYTES	DMA_PERIPHERAL_BUSWIDTH_4_BYTES
+#define	DMA_SLAVE_BUSWIDTH_8_BYTES	DMA_PERIPHERAL_BUSWIDTH_8_BYTES
+#define	DMA_SLAVE_BUSWIDTH_16_BYTES	DMA_PERIPHERAL_BUSWIDTH_16_BYTES
+#define	DMA_SLAVE_BUSWIDTH_32_BYTES	DMA_PERIPHERAL_BUSWIDTH_32_BYTES
+#define	DMA_SLAVE_BUSWIDTH_64_BYTES	DMA_PERIPHERAL_BUSWIDTH_64_BYTES
+
 /**
- * enum dma_slave_buswidth - defines bus width of the DMA slave
+ * enum dma_peripheral_buswidth - defines bus width of the DMA peripheral
  * device, source or target buses
  */
-enum dma_slave_buswidth {
-	DMA_SLAVE_BUSWIDTH_UNDEFINED = 0,
-	DMA_SLAVE_BUSWIDTH_1_BYTE = 1,
-	DMA_SLAVE_BUSWIDTH_2_BYTES = 2,
-	DMA_SLAVE_BUSWIDTH_3_BYTES = 3,
-	DMA_SLAVE_BUSWIDTH_4_BYTES = 4,
-	DMA_SLAVE_BUSWIDTH_8_BYTES = 8,
-	DMA_SLAVE_BUSWIDTH_16_BYTES = 16,
-	DMA_SLAVE_BUSWIDTH_32_BYTES = 32,
-	DMA_SLAVE_BUSWIDTH_64_BYTES = 64,
+enum dma_peripheral_buswidth {
+	DMA_PERIPHERAL_BUSWIDTH_UNDEFINED = 0,
+	DMA_PERIPHERAL_BUSWIDTH_1_BYTE = 1,
+	DMA_PERIPHERAL_BUSWIDTH_2_BYTES = 2,
+	DMA_PERIPHERAL_BUSWIDTH_3_BYTES = 3,
+	DMA_PERIPHERAL_BUSWIDTH_4_BYTES = 4,
+	DMA_PERIPHERAL_BUSWIDTH_8_BYTES = 8,
+	DMA_PERIPHERAL_BUSWIDTH_16_BYTES = 16,
+	DMA_PERIPHERAL_BUSWIDTH_32_BYTES = 32,
+	DMA_PERIPHERAL_BUSWIDTH_64_BYTES = 64,
 };
 
+#define dma_slave_buswidth dma_peripheral_buswidth
+
 /**
  * struct dma_slave_config - dma slave channel runtime config
  * @direction: whether the data shall go in or out on this slave
-- 
2.26.2


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

* [PATCH 2/4] dmaengine: move struct in interface to use peripheral term
  2020-10-15  7:31 [PATCH 0/4] dmaengine: use inclusive terminology Vinod Koul
  2020-10-15  7:31 ` [PATCH 1/4] dmaengine: move enums in interface to use peripheral term Vinod Koul
@ 2020-10-15  7:31 ` Vinod Koul
  2020-10-19  9:04   ` Peter Ujfalusi
  2020-10-15  7:31 ` [PATCH 3/4] dmaengine: move APIs " Vinod Koul
  2020-10-15  7:31 ` [PATCH 4/4] dmaengine: core: update " Vinod Koul
  3 siblings, 1 reply; 11+ messages in thread
From: Vinod Koul @ 2020-10-15  7:31 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul

dmaengine history has a non inclusive terminology of dmaengine slave, I
feel it is time to replace that.

This moves structures in dmaengine interface with replacement of slave
to peripheral which is an appropriate term for dmaengine peripheral
devices

Since the change of name can break users, the new names have been added
with old structs kept as macro define for new names. Once the users have
been migrated, these macros will be dropped.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/dma/dmaengine.c   | 12 +++----
 include/linux/dmaengine.h | 71 +++++++++++++++++++++------------------
 2 files changed, 45 insertions(+), 38 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 7974fa0400d8..3b796081a5e4 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -793,10 +793,10 @@ static const struct dma_slave_map *dma_filter_match(struct dma_device *device,
 		return NULL;
 
 	for (i = 0; i < device->filter.mapcnt; i++) {
-		const struct dma_slave_map *map = &device->filter.map[i];
+		const struct dma_peripheral_map *map = &device->filter.map[i];
 
 		if (!strcmp(map->devname, dev_name(dev)) &&
-		    !strcmp(map->slave, name))
+		    !strcmp(map->peripheral, name))
 			return map;
 	}
 
@@ -861,7 +861,7 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
 	chan->name = kasprintf(GFP_KERNEL, "dma:%s", name);
 	if (!chan->name)
 		return chan;
-	chan->slave = dev;
+	chan->peripheral = dev;
 
 	if (sysfs_create_link(&chan->dev->device.kobj, &dev->kobj,
 			      DMA_SLAVE_NAME))
@@ -910,12 +910,12 @@ void dma_release_channel(struct dma_chan *chan)
 	if (--chan->device->privatecnt == 0)
 		dma_cap_clear(DMA_PRIVATE, chan->device->cap_mask);
 
-	if (chan->slave) {
+	if (chan->peripheral) {
 		sysfs_remove_link(&chan->dev->device.kobj, DMA_SLAVE_NAME);
-		sysfs_remove_link(&chan->slave->kobj, chan->name);
+		sysfs_remove_link(&chan->peripheral->kobj, chan->name);
 		kfree(chan->name);
 		chan->name = NULL;
-		chan->slave = NULL;
+		chan->peripheral = NULL;
 	}
 
 #ifdef CONFIG_DEBUG_FS
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index f7f420876d21..04b993a5373c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -312,13 +312,13 @@ struct dma_router {
 /**
  * struct dma_chan - devices supply DMA channels, clients use them
  * @device: ptr to the dma device who supplies this channel, always !%NULL
- * @slave: ptr to the device using this channel
+ * @peripheral: ptr to the device using this channel
  * @cookie: last cookie value returned to client
  * @completed_cookie: last completed cookie for this channel
  * @chan_id: channel ID for sysfs
  * @dev: class device for sysfs
  * @name: backlink name for sysfs
- * @dbg_client_name: slave name for debugfs in format:
+ * @dbg_client_name: peripheral name for debugfs in format:
  *	dev_name(requester's dev):channel name, for example: "2b00000.mcasp:tx"
  * @device_node: used to add this to the device chan list
  * @local: per-cpu pointer to a struct dma_chan_percpu
@@ -330,7 +330,7 @@ struct dma_router {
  */
 struct dma_chan {
 	struct dma_device *device;
-	struct device *slave;
+	struct device *peripheral;
 	dma_cookie_t cookie;
 	dma_cookie_t completed_cookie;
 
@@ -395,16 +395,16 @@ enum dma_peripheral_buswidth {
 #define dma_slave_buswidth dma_peripheral_buswidth
 
 /**
- * struct dma_slave_config - dma slave channel runtime config
- * @direction: whether the data shall go in or out on this slave
+ * struct dma_peripheral_config - dma peripheral channel runtime config
+ * @direction: whether the data shall go in or out on this peripheral
  * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are
  * legal values. DEPRECATED, drivers should use the direction argument
- * to the device_prep_slave_sg and device_prep_dma_cyclic functions or
+ * to the device_prep_peripheral_sg and device_prep_dma_cyclic functions or
  * the dir field in the dma_interleaved_template structure.
- * @src_addr: this is the physical address where DMA slave data
+ * @src_addr: this is the physical address where DMA peripheral data
  * should be read (RX), if the source is memory this argument is
  * ignored.
- * @dst_addr: this is the physical address where DMA slave data
+ * @dst_addr: this is the physical address where DMA peripheral data
  * should be written (TX), if the source is memory this argument
  * is ignored.
  * @src_addr_width: this is the width in bytes of the source (RX)
@@ -426,12 +426,12 @@ enum dma_peripheral_buswidth {
  * loops in this area in order to transfer the data.
  * @dst_port_window_size: same as src_port_window_size but for the destination
  * port.
- * @device_fc: Flow Controller Settings. Only valid for slave channels. Fill
+ * @device_fc: Flow Controller Settings. Only valid for peripheral channels. Fill
  * with 'true' if peripheral should be flow controller. Direction will be
  * selected at Runtime.
- * @slave_id: Slave requester id. Only valid for slave channels. The dma
- * slave peripheral will have unique id as dma requester which need to be
- * pass as slave config.
+ * @peripheral_id: Peripheral requester id. Only valid for peripheral channels. The dma
+ * peripheral will have unique id as dma requester which need to be
+ * pass as peripheral config.
  *
  * This struct is passed in as configuration data to a DMA engine
  * in order to set up a certain channel for DMA transport at runtime.
@@ -440,25 +440,28 @@ enum dma_peripheral_buswidth {
  * will then be passed in as an argument to the function.
  *
  * The rationale for adding configuration information to this struct is as
- * follows: if it is likely that more than one DMA slave controllers in
+ * follows: if it is likely that more than one DMA peripheral controllers in
  * the world will support the configuration option, then make it generic.
  * If not: if it is fixed so that it be sent in static from the platform
  * data, then prefer to do that.
  */
-struct dma_slave_config {
+struct dma_peripheral_config {
 	enum dma_transfer_direction direction;
 	phys_addr_t src_addr;
 	phys_addr_t dst_addr;
-	enum dma_slave_buswidth src_addr_width;
-	enum dma_slave_buswidth dst_addr_width;
+	enum dma_peripheral_buswidth src_addr_width;
+	enum dma_peripheral_buswidth dst_addr_width;
 	u32 src_maxburst;
 	u32 dst_maxburst;
 	u32 src_port_window_size;
 	u32 dst_port_window_size;
 	bool device_fc;
 	unsigned int slave_id;
+	unsigned int peripheral_id;
 };
 
+#define dma_slave_config dma_peripheral_config
+
 /**
  * enum dma_residue_granularity - Granularity of the reported transfer residue
  * @DMA_RESIDUE_GRANULARITY_DESCRIPTOR: Residue reporting is not support. The
@@ -486,12 +489,12 @@ enum dma_residue_granularity {
 };
 
 /**
- * struct dma_slave_caps - expose capabilities of a slave channel only
+ * struct dma_peripheral_caps - expose capabilities of a peripheral channel only
  * @src_addr_widths: bit mask of src addr widths the channel supports.
  *	Width is specified in bytes, e.g. for a channel supporting
  *	a width of 4 the mask should have BIT(4) set.
  * @dst_addr_widths: bit mask of dst addr widths the channel supports
- * @directions: bit mask of slave directions the channel supports.
+ * @directions: bit mask of peripheral directions the channel supports.
  *	Since the enum dma_transfer_direction is not defined as bit flag for
  *	each type, the dma controller should set BIT(<TYPE>) and same
  *	should be checked by controller as well
@@ -508,7 +511,7 @@ enum dma_residue_granularity {
  * @descriptor_reuse: if a descriptor can be reused by client and
  * resubmitted multiple times
  */
-struct dma_slave_caps {
+struct dma_peripheral_caps {
 	u32 src_addr_widths;
 	u32 dst_addr_widths;
 	u32 directions;
@@ -522,6 +525,8 @@ struct dma_slave_caps {
 	bool descriptor_reuse;
 };
 
+#define dma_slave_caps dma_peripheral_caps
+
 static inline const char *dma_chan_name(struct dma_chan *chan)
 {
 	return dev_name(&chan->dev->device);
@@ -754,29 +759,31 @@ enum dmaengine_alignment {
 };
 
 /**
- * struct dma_slave_map - associates slave device and it's slave channel with
+ * struct dma_peripheral_map - associates peripheral device and it's peripheral channel with
  * parameter to be used by a filter function
  * @devname: name of the device
- * @slave: slave channel name
+ * @peripheral: peripheral channel name
  * @param: opaque parameter to pass to struct dma_filter.fn
  */
-struct dma_slave_map {
+struct dma_peripheral_map {
 	const char *devname;
-	const char *slave;
+	const char *peripheral;
 	void *param;
 };
 
+#define dma_slave_map dma_peripheral_map
+
 /**
- * struct dma_filter - information for slave device/channel to filter_fn/param
+ * struct dma_filter - information for peripheral device/channel to filter_fn/param
  * mapping
  * @fn: filter function callback
- * @mapcnt: number of slave device/channel in the map
+ * @mapcnt: number of peripheral device/channel in the map
  * @map: array of channel to filter mapping data
  */
 struct dma_filter {
 	dma_filter_fn fn;
 	int mapcnt;
-	const struct dma_slave_map *map;
+	const struct dma_peripheral_map *map;
 };
 
 /**
@@ -785,7 +792,7 @@ struct dma_filter {
  * @privatecnt: how many DMA channels are requested by dma_request_channel
  * @channels: the list of struct dma_chan
  * @global_node: list_head for global dma_device_list
- * @filter: information for device/slave to filter function/param mapping
+ * @filter: information for device/peripheral to filter function/param mapping
  * @cap_mask: one or more dma_capability flags
  * @desc_metadata_modes: supported metadata modes by the DMA device
  * @max_xor: maximum number of xor sources, 0 if no capability
@@ -801,7 +808,7 @@ struct dma_filter {
  *	Width is specified in bytes, e.g. for a device supporting
  *	a width of 4 the mask should have BIT(4) set.
  * @dst_addr_widths: bit mask of dst addr widths the device supports
- * @directions: bit mask of slave directions the device supports.
+ * @directions: bit mask of peripheral directions the device supports.
  *	Since the enum dma_transfer_direction is not defined as bit flag for
  *	each type, the dma controller should set BIT(<TYPE>) and same
  *	should be checked by controller as well
@@ -823,13 +830,13 @@ struct dma_filter {
  * @device_prep_dma_memset: prepares a memset operation
  * @device_prep_dma_memset_sg: prepares a memset operation over a scatter list
  * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
- * @device_prep_slave_sg: prepares a slave dma operation
+ * @device_prep_peripheral_sg: prepares a peripheral dma operation
  * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio.
  *	The function takes a buffer of size buf_len. The callback function will
  *	be called after period_len bytes have been transferred.
  * @device_prep_interleaved_dma: Transfer expression in a generic way.
  * @device_prep_dma_imm_data: DMA's 8 byte immediate data to the dst address
- * @device_caps: May be used to override the generic DMA slave capabilities
+ * @device_caps: May be used to override the generic DMA peripheral capabilities
  *	with per-channel specific ones
  * @device_config: Pushes a new configuration to a channel, return 0 or an error
  *	code
@@ -932,9 +939,9 @@ struct dma_device {
 		unsigned long flags);
 
 	void (*device_caps)(struct dma_chan *chan,
-			    struct dma_slave_caps *caps);
+			    struct dma_peripheral_caps *caps);
 	int (*device_config)(struct dma_chan *chan,
-			     struct dma_slave_config *config);
+			     struct dma_peripheral_config *config);
 	int (*device_pause)(struct dma_chan *chan);
 	int (*device_resume)(struct dma_chan *chan);
 	int (*device_terminate_all)(struct dma_chan *chan);
-- 
2.26.2


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

* [PATCH 3/4] dmaengine: move APIs in interface to use peripheral term
  2020-10-15  7:31 [PATCH 0/4] dmaengine: use inclusive terminology Vinod Koul
  2020-10-15  7:31 ` [PATCH 1/4] dmaengine: move enums in interface to use peripheral term Vinod Koul
  2020-10-15  7:31 ` [PATCH 2/4] dmaengine: move struct " Vinod Koul
@ 2020-10-15  7:31 ` Vinod Koul
  2020-10-19  9:17   ` Peter Ujfalusi
  2020-10-15  7:31 ` [PATCH 4/4] dmaengine: core: update " Vinod Koul
  3 siblings, 1 reply; 11+ messages in thread
From: Vinod Koul @ 2020-10-15  7:31 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul

dmaengine history has a non inclusive terminology of dmaengine slave, I
feel it is time to replace that.

This moves APIs in dmaengine interface with replacement of slave
to peripheral which is an appropriate term for dmaengine peripheral
devices

Since the change of name can break users, the new names have been added
with old APIs kept as macro define for new names. Once the users have
been migrated, these macros will be dropped.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 include/linux/dmaengine.h | 46 +++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 04b993a5373c..d8dce3cdfdd4 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -923,6 +923,10 @@ struct dma_device {
 	struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
 		struct dma_chan *chan, unsigned long flags);
 
+	struct dma_async_tx_descriptor *(*device_prep_peripheral_sg)(
+		struct dma_chan *chan, struct scatterlist *sgl,
+		unsigned int sg_len, enum dma_transfer_direction direction,
+		unsigned long flags, void *context);
 	struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
 		struct dma_chan *chan, struct scatterlist *sgl,
 		unsigned int sg_len, enum dma_transfer_direction direction,
@@ -959,8 +963,8 @@ struct dma_device {
 #endif
 };
 
-static inline int dmaengine_slave_config(struct dma_chan *chan,
-					  struct dma_slave_config *config)
+static inline int dmaengine_peripheral_config(struct dma_chan *chan,
+					  struct dma_peripheral_config *config)
 {
 	if (chan->device->device_config)
 		return chan->device->device_config(chan, config);
@@ -968,12 +972,16 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
 	return -ENOSYS;
 }
 
-static inline bool is_slave_direction(enum dma_transfer_direction direction)
+#define dmaengine_slave_config dmaengine_peripheral_config
+
+static inline bool is_peripheral_direction(enum dma_transfer_direction direction)
 {
 	return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM);
 }
 
-static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
+#define is_slave_direction is_peripheral_direction
+
+static inline struct dma_async_tx_descriptor *dmaengine_prep_peripheral_single(
 	struct dma_chan *chan, dma_addr_t buf, size_t len,
 	enum dma_transfer_direction dir, unsigned long flags)
 {
@@ -989,7 +997,9 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
 						  dir, flags, NULL);
 }
 
-static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
+#define dmaengine_prep_slave_single dmaengine_prep_peripheral_single
+
+static inline struct dma_async_tx_descriptor *dmaengine_prep_peripheral_sg(
 	struct dma_chan *chan, struct scatterlist *sgl,	unsigned int sg_len,
 	enum dma_transfer_direction dir, unsigned long flags)
 {
@@ -1000,6 +1010,8 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
 						  dir, flags, NULL);
 }
 
+#define dmaengine_prep_slave_sg dmaengine_prep_peripheral_sg
+
 #ifdef CONFIG_RAPIDIO_DMA_ENGINE
 struct rio_dma_ext;
 static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg(
@@ -1498,7 +1510,7 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name);
 struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask);
 
 void dma_release_channel(struct dma_chan *chan);
-int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps);
+int dma_get_peripheral_caps(struct dma_chan *chan, struct dma_peripheral_caps *caps);
 #else
 static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
 {
@@ -1535,19 +1547,21 @@ static inline struct dma_chan *dma_request_chan_by_mask(
 static inline void dma_release_channel(struct dma_chan *chan)
 {
 }
-static inline int dma_get_slave_caps(struct dma_chan *chan,
-				     struct dma_slave_caps *caps)
+static inline int dma_get_peripheral_caps(struct dma_chan *chan,
+				     struct dma_peripheral_caps *caps)
 {
 	return -ENXIO;
 }
 #endif
 
+#define dma_get_slave_caps dma_get_peripheral_caps
+
 static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx)
 {
-	struct dma_slave_caps caps;
+	struct dma_peripheral_caps caps;
 	int ret;
 
-	ret = dma_get_slave_caps(tx->chan, &caps);
+	ret = dma_get_peripheral_caps(tx->chan, &caps);
 	if (ret)
 		return ret;
 
@@ -1592,17 +1606,19 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
 
 /* Deprecated, please use dma_request_chan() directly */
 static inline struct dma_chan * __deprecated
-dma_request_slave_channel(struct device *dev, const char *name)
+dma_request_peripheral_channel(struct device *dev, const char *name)
 {
 	struct dma_chan *ch = dma_request_chan(dev, name);
 
 	return IS_ERR(ch) ? NULL : ch;
 }
 
+#define dma_request_slave_channel dma_request_peripheral_channel
+
 static inline struct dma_chan
-*dma_request_slave_channel_compat(const dma_cap_mask_t mask,
-				  dma_filter_fn fn, void *fn_param,
-				  struct device *dev, const char *name)
+*dma_request_peripheral_channel_compat(const dma_cap_mask_t mask,
+				       dma_filter_fn fn, void *fn_param,
+				       struct device *dev, const char *name)
 {
 	struct dma_chan *chan;
 
@@ -1616,6 +1632,8 @@ static inline struct dma_chan
 	return __dma_request_channel(&mask, fn, fn_param, NULL);
 }
 
+#define dma_request_slave_channel_compat dma_request_peripheral_channel_compat
+
 static inline char *
 dmaengine_get_direction_text(enum dma_transfer_direction dir)
 {
-- 
2.26.2


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

* [PATCH 4/4] dmaengine: core: update to use peripheral term
  2020-10-15  7:31 [PATCH 0/4] dmaengine: use inclusive terminology Vinod Koul
                   ` (2 preceding siblings ...)
  2020-10-15  7:31 ` [PATCH 3/4] dmaengine: move APIs " Vinod Koul
@ 2020-10-15  7:31 ` Vinod Koul
  3 siblings, 0 replies; 11+ messages in thread
From: Vinod Koul @ 2020-10-15  7:31 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul

dmaengine history has a non inclusive terminology of dmaengine slave, I
feel it is time to replace that.

This moves dmaengine file to use peripheral instead of slave in comments
and updates to use the newly add inclusive names for enums/struct/apis

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/dma/dmaengine.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 3b796081a5e4..9041f4f10ea3 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -143,7 +143,7 @@ static inline void dmaengine_debug_unregister(struct dma_device *dma_dev) { }
 
 /* --- sysfs implementation --- */
 
-#define DMA_SLAVE_NAME	"slave"
+#define DMA_PERIPHERAL_NAME	"peripheral"
 
 /**
  * dev_to_dma_chan - convert a device pointer to its sysfs container object
@@ -266,13 +266,13 @@ static int __init dma_channel_table_init(void)
 
 	bitmap_fill(dma_cap_mask_all.bits, DMA_TX_TYPE_END);
 
-	/* 'interrupt', 'private', and 'slave' are channel capabilities,
+	/* 'interrupt', 'private', and 'peripheral' are channel capabilities,
 	 * but are not associated with an operation so they do not need
 	 * an entry in the channel_table
 	 */
 	clear_bit(DMA_INTERRUPT, dma_cap_mask_all.bits);
 	clear_bit(DMA_PRIVATE, dma_cap_mask_all.bits);
-	clear_bit(DMA_SLAVE, dma_cap_mask_all.bits);
+	clear_bit(DMA_PERIPHERAL, dma_cap_mask_all.bits);
 
 	for_each_dma_cap_mask(cap, dma_cap_mask_all) {
 		channel_table[cap] = alloc_percpu(struct dma_chan_tbl_ent);
@@ -576,15 +576,15 @@ int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
 
 	device = chan->device;
 
-	/* check if the channel supports slave transactions */
-	if (!(test_bit(DMA_SLAVE, device->cap_mask.bits) ||
+	/* check if the channel supports peripheral transactions */
+	if (!(test_bit(DMA_PERIPHERAL, device->cap_mask.bits) ||
 	      test_bit(DMA_CYCLIC, device->cap_mask.bits)))
 		return -ENXIO;
 
 	/*
-	 * Check whether it reports it uses the generic slave
+	 * Check whether it reports it uses the generic peripheral
 	 * capabilities, if not, that means it doesn't support any
-	 * kind of slave capabilities reporting.
+	 * kind of peripheral capabilities reporting.
 	 */
 	if (!device->directions)
 		return -ENXIO;
@@ -603,7 +603,7 @@ int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
 
 	/*
 	 * DMA engine device might be configured with non-uniformly
-	 * distributed slave capabilities per device channels. In this
+	 * distributed capabilities per device channels. In this
 	 * case the corresponding driver may provide the device_caps
 	 * callback to override the generic capabilities with
 	 * channel-specific ones.
@@ -783,9 +783,9 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
 }
 EXPORT_SYMBOL_GPL(__dma_request_channel);
 
-static const struct dma_slave_map *dma_filter_match(struct dma_device *device,
-						    const char *name,
-						    struct device *dev)
+static const struct dma_peripheral_map *dma_filter_match(struct dma_device *device,
+						         const char *name,
+						         struct device *dev)
 {
 	int i;
 
@@ -804,9 +804,9 @@ static const struct dma_slave_map *dma_filter_match(struct dma_device *device,
 }
 
 /**
- * dma_request_chan - try to allocate an exclusive slave channel
+ * dma_request_chan - try to allocate an exclusive peripheral channel
  * @dev:	pointer to client device structure
- * @name:	slave channel name
+ * @name:	peripheral channel name
  *
  * Returns pointer to appropriate DMA channel on success or an error pointer.
  */
@@ -833,13 +833,13 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
 	mutex_lock(&dma_list_mutex);
 	list_for_each_entry_safe(d, _d, &dma_device_list, global_node) {
 		dma_cap_mask_t mask;
-		const struct dma_slave_map *map = dma_filter_match(d, name, dev);
+		const struct dma_peripheral_map *map = dma_filter_match(d, name, dev);
 
 		if (!map)
 			continue;
 
 		dma_cap_zero(mask);
-		dma_cap_set(DMA_SLAVE, mask);
+		dma_cap_set(DMA_PERIPHERAL, mask);
 
 		chan = find_candidate(d, &mask, d->filter.fn, map->param);
 		if (!IS_ERR(chan))
@@ -864,8 +864,8 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
 	chan->peripheral = dev;
 
 	if (sysfs_create_link(&chan->dev->device.kobj, &dev->kobj,
-			      DMA_SLAVE_NAME))
-		dev_warn(dev, "Cannot create DMA %s symlink\n", DMA_SLAVE_NAME);
+			      DMA_PERIPHERAL_NAME))
+		dev_warn(dev, "Cannot create DMA %s symlink\n", DMA_PERIPHERAL_NAME);
 	if (sysfs_create_link(&dev->kobj, &chan->dev->device.kobj, chan->name))
 		dev_warn(dev, "Cannot create DMA %s symlink\n", chan->name);
 
@@ -911,7 +911,7 @@ void dma_release_channel(struct dma_chan *chan)
 		dma_cap_clear(DMA_PRIVATE, chan->device->cap_mask);
 
 	if (chan->peripheral) {
-		sysfs_remove_link(&chan->dev->device.kobj, DMA_SLAVE_NAME);
+		sysfs_remove_link(&chan->dev->device.kobj, DMA_PERIPHERAL_NAME);
 		sysfs_remove_link(&chan->peripheral->kobj, chan->name);
 		kfree(chan->name);
 		chan->name = NULL;
-- 
2.26.2


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

* Re: [PATCH 1/4] dmaengine: move enums in interface to use peripheral term
  2020-10-15  7:31 ` [PATCH 1/4] dmaengine: move enums in interface to use peripheral term Vinod Koul
@ 2020-10-19  8:54   ` Peter Ujfalusi
  2020-10-27 17:11     ` Vinod Koul
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Ujfalusi @ 2020-10-19  8:54 UTC (permalink / raw)
  To: Vinod Koul, dmaengine



On 15/10/2020 10.31, Vinod Koul wrote:
> dmaengine history has a non inclusive terminology of dmaengine slave, I
> feel it is time to replace that. Start with moving enums in dmaengine
> interface with replacement of slave to peripheral which is an
> appropriate term for dmaengine peripheral devices
> 
> Since the change of name can break users, the new names have been added
> with old enums kept as macro define for new names. Once the users have
> been migrated, these macros will be dropped.
> 
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> ---
>  include/linux/dmaengine.h | 44 ++++++++++++++++++++++++++-------------
>  1 file changed, 29 insertions(+), 15 deletions(-)
> 
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index dd357a747780..f7f420876d21 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -59,7 +59,7 @@ enum dma_transaction_type {
>  	DMA_INTERRUPT,
>  	DMA_PRIVATE,
>  	DMA_ASYNC_TX,
> -	DMA_SLAVE,
> +	DMA_PERIPHERAL,
>  	DMA_CYCLIC,
>  	DMA_INTERLEAVE,
>  	DMA_COMPLETION_NO_ORDER,
> @@ -69,12 +69,14 @@ enum dma_transaction_type {
>  	DMA_TX_TYPE_END,
>  };
>  
> +#define DMA_SLAVE DMA_PERIPHERAL
> +
>  /**
>   * enum dma_transfer_direction - dma transfer mode and direction indicator
>   * @DMA_MEM_TO_MEM: Async/Memcpy mode
> - * @DMA_MEM_TO_DEV: Slave mode & From Memory to Device
> - * @DMA_DEV_TO_MEM: Slave mode & From Device to Memory
> - * @DMA_DEV_TO_DEV: Slave mode & From Device to Device
> + * @DMA_MEM_TO_DEV: Peripheral mode & From Memory to Device
> + * @DMA_DEV_TO_MEM: Peripheral mode & From Device to Memory
> + * @DMA_DEV_TO_DEV: Peripheral mode & From Device to Device
>   */
>  enum dma_transfer_direction {
>  	DMA_MEM_TO_MEM,
> @@ -364,22 +366,34 @@ struct dma_chan_dev {
>  	int dev_id;
>  };
>  
> +#define	DMA_SLAVE_BUSWIDTH_UNDEFINED	DMA_PERIPHERAL_BUSWIDTH_UNDEFINED
> +#define	DMA_SLAVE_BUSWIDTH_1_BYTE	DMA_PERIPHERAL_BUSWIDTH_1_BYTE
> +#define	DMA_SLAVE_BUSWIDTH_2_BYTES	DMA_PERIPHERAL_BUSWIDTH_2_BYTES
> +#define	DMA_SLAVE_BUSWIDTH_3_BYTES	DMA_PERIPHERAL_BUSWIDTH_3_BYTES
> +#define	DMA_SLAVE_BUSWIDTH_4_BYTES	DMA_PERIPHERAL_BUSWIDTH_4_BYTES
> +#define	DMA_SLAVE_BUSWIDTH_8_BYTES	DMA_PERIPHERAL_BUSWIDTH_8_BYTES
> +#define	DMA_SLAVE_BUSWIDTH_16_BYTES	DMA_PERIPHERAL_BUSWIDTH_16_BYTES
> +#define	DMA_SLAVE_BUSWIDTH_32_BYTES	DMA_PERIPHERAL_BUSWIDTH_32_BYTES
> +#define	DMA_SLAVE_BUSWIDTH_64_BYTES	DMA_PERIPHERAL_BUSWIDTH_64_BYTES

Probably move the defines after the enum dma_peripheral_buswidth block
as well?

> +
>  /**
> - * enum dma_slave_buswidth - defines bus width of the DMA slave
> + * enum dma_peripheral_buswidth - defines bus width of the DMA peripheral
>   * device, source or target buses
>   */
> -enum dma_slave_buswidth {
> -	DMA_SLAVE_BUSWIDTH_UNDEFINED = 0,
> -	DMA_SLAVE_BUSWIDTH_1_BYTE = 1,
> -	DMA_SLAVE_BUSWIDTH_2_BYTES = 2,
> -	DMA_SLAVE_BUSWIDTH_3_BYTES = 3,
> -	DMA_SLAVE_BUSWIDTH_4_BYTES = 4,
> -	DMA_SLAVE_BUSWIDTH_8_BYTES = 8,
> -	DMA_SLAVE_BUSWIDTH_16_BYTES = 16,
> -	DMA_SLAVE_BUSWIDTH_32_BYTES = 32,
> -	DMA_SLAVE_BUSWIDTH_64_BYTES = 64,
> +enum dma_peripheral_buswidth {
> +	DMA_PERIPHERAL_BUSWIDTH_UNDEFINED = 0,
> +	DMA_PERIPHERAL_BUSWIDTH_1_BYTE = 1,
> +	DMA_PERIPHERAL_BUSWIDTH_2_BYTES = 2,
> +	DMA_PERIPHERAL_BUSWIDTH_3_BYTES = 3,
> +	DMA_PERIPHERAL_BUSWIDTH_4_BYTES = 4,
> +	DMA_PERIPHERAL_BUSWIDTH_8_BYTES = 8,
> +	DMA_PERIPHERAL_BUSWIDTH_16_BYTES = 16,
> +	DMA_PERIPHERAL_BUSWIDTH_32_BYTES = 32,
> +	DMA_PERIPHERAL_BUSWIDTH_64_BYTES = 64,
>  };
>  
> +#define dma_slave_buswidth dma_peripheral_buswidth
> +
>  /**
>   * struct dma_slave_config - dma slave channel runtime config
>   * @direction: whether the data shall go in or out on this slave
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH 2/4] dmaengine: move struct in interface to use peripheral term
  2020-10-15  7:31 ` [PATCH 2/4] dmaengine: move struct " Vinod Koul
@ 2020-10-19  9:04   ` Peter Ujfalusi
  2020-10-27 17:16     ` Vinod Koul
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Ujfalusi @ 2020-10-19  9:04 UTC (permalink / raw)
  To: Vinod Koul, dmaengine

Hi Vinod,

one minor comment...

On 15/10/2020 10.31, Vinod Koul wrote:
> dmaengine history has a non inclusive terminology of dmaengine slave, I
> feel it is time to replace that.
> 
> This moves structures in dmaengine interface with replacement of slave
> to peripheral which is an appropriate term for dmaengine peripheral
> devices
> 
> Since the change of name can break users, the new names have been added
> with old structs kept as macro define for new names. Once the users have
> been migrated, these macros will be dropped.
> 
> Signed-off-by: Vinod Koul <vkoul@kernel.org>

...

> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index f7f420876d21..04b993a5373c 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h

...

>  /**
> - * struct dma_slave_map - associates slave device and it's slave channel with
> + * struct dma_peripheral_map - associates peripheral device and it's peripheral channel with
>   * parameter to be used by a filter function
>   * @devname: name of the device
> - * @slave: slave channel name
> + * @peripheral: peripheral channel name

I know that this is slave -> peripheral change, but would not be better
to call this as 'channame'?

>   * @param: opaque parameter to pass to struct dma_filter.fn
>   */
> -struct dma_slave_map {
> +struct dma_peripheral_map {
>  	const char *devname;
> -	const char *slave;
> +	const char *peripheral;
>  	void *param;
>  };
>  
> +#define dma_slave_map dma_peripheral_map
> +

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH 3/4] dmaengine: move APIs in interface to use peripheral term
  2020-10-15  7:31 ` [PATCH 3/4] dmaengine: move APIs " Vinod Koul
@ 2020-10-19  9:17   ` Peter Ujfalusi
  2020-10-28  4:33     ` Vinod Koul
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Ujfalusi @ 2020-10-19  9:17 UTC (permalink / raw)
  To: Vinod Koul, dmaengine

Hi Vinod,

On 15/10/2020 10.31, Vinod Koul wrote:
> dmaengine history has a non inclusive terminology of dmaengine slave, I
> feel it is time to replace that.
> 
> This moves APIs in dmaengine interface with replacement of slave
> to peripheral which is an appropriate term for dmaengine peripheral
> devices
> 
> Since the change of name can break users, the new names have been added
> with old APIs kept as macro define for new names. Once the users have
> been migrated, these macros will be dropped.
> 
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> ---
>  include/linux/dmaengine.h | 46 +++++++++++++++++++++++++++------------
>  1 file changed, 32 insertions(+), 14 deletions(-)
> 
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index 04b993a5373c..d8dce3cdfdd4 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -923,6 +923,10 @@ struct dma_device {
>  	struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
>  		struct dma_chan *chan, unsigned long flags);
>  
> +	struct dma_async_tx_descriptor *(*device_prep_peripheral_sg)(
> +		struct dma_chan *chan, struct scatterlist *sgl,
> +		unsigned int sg_len, enum dma_transfer_direction direction,
> +		unsigned long flags, void *context);
>  	struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
>  		struct dma_chan *chan, struct scatterlist *sgl,
>  		unsigned int sg_len, enum dma_transfer_direction direction,
> @@ -959,8 +963,8 @@ struct dma_device {
>  #endif
>  };
>  
> -static inline int dmaengine_slave_config(struct dma_chan *chan,
> -					  struct dma_slave_config *config)
> +static inline int dmaengine_peripheral_config(struct dma_chan *chan,
> +					  struct dma_peripheral_config *config)
>  {
>  	if (chan->device->device_config)
>  		return chan->device->device_config(chan, config);
> @@ -968,12 +972,16 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
>  	return -ENOSYS;
>  }
>  
> -static inline bool is_slave_direction(enum dma_transfer_direction direction)
> +#define dmaengine_slave_config dmaengine_peripheral_config
> +
> +static inline bool is_peripheral_direction(enum dma_transfer_direction direction)
>  {
>  	return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM);
>  }
>  
> -static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
> +#define is_slave_direction is_peripheral_direction
> +
> +static inline struct dma_async_tx_descriptor *dmaengine_prep_peripheral_single(
>  	struct dma_chan *chan, dma_addr_t buf, size_t len,
>  	enum dma_transfer_direction dir, unsigned long flags)
>  {
> @@ -989,7 +997,9 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
>  						  dir, flags, NULL);
>  }
>  
> -static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
> +#define dmaengine_prep_slave_single dmaengine_prep_peripheral_single
> +
> +static inline struct dma_async_tx_descriptor *dmaengine_prep_peripheral_sg(
>  	struct dma_chan *chan, struct scatterlist *sgl,	unsigned int sg_len,
>  	enum dma_transfer_direction dir, unsigned long flags)
>  {
> @@ -1000,6 +1010,8 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
>  						  dir, flags, NULL);
>  }
>  
> +#define dmaengine_prep_slave_sg dmaengine_prep_peripheral_sg
> +

If you do similar changes to _single() then DMA drivers can migrate to
the new device_prep_peripheral_sg in their own pace:

static inline struct dma_async_tx_descriptor *dmaengine_prep_peripheral_sg(
	struct dma_chan *chan, struct scatterlist *sgl,	unsigned int sg_len,
	enum dma_transfer_direction dir, unsigned long flags)
{
	if (!chan || !chan->device)
		return NULL;

	if (chan->device->device_prep_peripheral_sg)
		return chan->device->device_prep_peripheral_sg(chan, sgl, sg_len,
							       dir, flags, NULL);

	if (chan->device->device_prep_slave_sg)
		return chan->device->device_prep_slave_sg(chan, sgl, sg_len,
							  dir, flags, NULL);
	return NULL;
}



>  #ifdef CONFIG_RAPIDIO_DMA_ENGINE
>  struct rio_dma_ext;
>  static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg(
> @@ -1498,7 +1510,7 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name);
>  struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask);
>  
>  void dma_release_channel(struct dma_chan *chan);
> -int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps);
> +int dma_get_peripheral_caps(struct dma_chan *chan, struct dma_peripheral_caps *caps);
>  #else
>  static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
>  {
> @@ -1535,19 +1547,21 @@ static inline struct dma_chan *dma_request_chan_by_mask(
>  static inline void dma_release_channel(struct dma_chan *chan)
>  {
>  }
> -static inline int dma_get_slave_caps(struct dma_chan *chan,
> -				     struct dma_slave_caps *caps)
> +static inline int dma_get_peripheral_caps(struct dma_chan *chan,
> +				     struct dma_peripheral_caps *caps)
>  {
>  	return -ENXIO;
>  }
>  #endif
>  
> +#define dma_get_slave_caps dma_get_peripheral_caps
> +
>  static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx)
>  {
> -	struct dma_slave_caps caps;
> +	struct dma_peripheral_caps caps;
>  	int ret;
>  
> -	ret = dma_get_slave_caps(tx->chan, &caps);
> +	ret = dma_get_peripheral_caps(tx->chan, &caps);
>  	if (ret)
>  		return ret;
>  
> @@ -1592,17 +1606,19 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
>  
>  /* Deprecated, please use dma_request_chan() directly */
>  static inline struct dma_chan * __deprecated
> -dma_request_slave_channel(struct device *dev, const char *name)
> +dma_request_peripheral_channel(struct device *dev, const char *name)
>  {
>  	struct dma_chan *ch = dma_request_chan(dev, name);
>  
>  	return IS_ERR(ch) ? NULL : ch;
>  }
>  
> +#define dma_request_slave_channel dma_request_peripheral_channel
> +
>  static inline struct dma_chan
> -*dma_request_slave_channel_compat(const dma_cap_mask_t mask,
> -				  dma_filter_fn fn, void *fn_param,
> -				  struct device *dev, const char *name)
> +*dma_request_peripheral_channel_compat(const dma_cap_mask_t mask,
> +				       dma_filter_fn fn, void *fn_param,
> +				       struct device *dev, const char *name)
>  {
>  	struct dma_chan *chan;
>  
> @@ -1616,6 +1632,8 @@ static inline struct dma_chan
>  	return __dma_request_channel(&mask, fn, fn_param, NULL);
>  }
>  
> +#define dma_request_slave_channel_compat dma_request_peripheral_channel_compat
> +
>  static inline char *
>  dmaengine_get_direction_text(enum dma_transfer_direction dir)
>  {
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH 1/4] dmaengine: move enums in interface to use peripheral term
  2020-10-19  8:54   ` Peter Ujfalusi
@ 2020-10-27 17:11     ` Vinod Koul
  0 siblings, 0 replies; 11+ messages in thread
From: Vinod Koul @ 2020-10-27 17:11 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: dmaengine

On 19-10-20, 11:54, Peter Ujfalusi wrote:
> On 15/10/2020 10.31, Vinod Koul wrote:
> > dmaengine history has a non inclusive terminology of dmaengine slave, I
> > feel it is time to replace that. Start with moving enums in dmaengine
> > interface with replacement of slave to peripheral which is an
> > appropriate term for dmaengine peripheral devices
> > 
> > Since the change of name can break users, the new names have been added
> > with old enums kept as macro define for new names. Once the users have
> > been migrated, these macros will be dropped.
> > 
> > Signed-off-by: Vinod Koul <vkoul@kernel.org>
> > ---
> >  include/linux/dmaengine.h | 44 ++++++++++++++++++++++++++-------------
> >  1 file changed, 29 insertions(+), 15 deletions(-)
> > 
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index dd357a747780..f7f420876d21 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -59,7 +59,7 @@ enum dma_transaction_type {
> >  	DMA_INTERRUPT,
> >  	DMA_PRIVATE,
> >  	DMA_ASYNC_TX,
> > -	DMA_SLAVE,
> > +	DMA_PERIPHERAL,
> >  	DMA_CYCLIC,
> >  	DMA_INTERLEAVE,
> >  	DMA_COMPLETION_NO_ORDER,
> > @@ -69,12 +69,14 @@ enum dma_transaction_type {
> >  	DMA_TX_TYPE_END,
> >  };
> >  
> > +#define DMA_SLAVE DMA_PERIPHERAL
> > +
> >  /**
> >   * enum dma_transfer_direction - dma transfer mode and direction indicator
> >   * @DMA_MEM_TO_MEM: Async/Memcpy mode
> > - * @DMA_MEM_TO_DEV: Slave mode & From Memory to Device
> > - * @DMA_DEV_TO_MEM: Slave mode & From Device to Memory
> > - * @DMA_DEV_TO_DEV: Slave mode & From Device to Device
> > + * @DMA_MEM_TO_DEV: Peripheral mode & From Memory to Device
> > + * @DMA_DEV_TO_MEM: Peripheral mode & From Device to Memory
> > + * @DMA_DEV_TO_DEV: Peripheral mode & From Device to Device
> >   */
> >  enum dma_transfer_direction {
> >  	DMA_MEM_TO_MEM,
> > @@ -364,22 +366,34 @@ struct dma_chan_dev {
> >  	int dev_id;
> >  };
> >  
> > +#define	DMA_SLAVE_BUSWIDTH_UNDEFINED	DMA_PERIPHERAL_BUSWIDTH_UNDEFINED
> > +#define	DMA_SLAVE_BUSWIDTH_1_BYTE	DMA_PERIPHERAL_BUSWIDTH_1_BYTE
> > +#define	DMA_SLAVE_BUSWIDTH_2_BYTES	DMA_PERIPHERAL_BUSWIDTH_2_BYTES
> > +#define	DMA_SLAVE_BUSWIDTH_3_BYTES	DMA_PERIPHERAL_BUSWIDTH_3_BYTES
> > +#define	DMA_SLAVE_BUSWIDTH_4_BYTES	DMA_PERIPHERAL_BUSWIDTH_4_BYTES
> > +#define	DMA_SLAVE_BUSWIDTH_8_BYTES	DMA_PERIPHERAL_BUSWIDTH_8_BYTES
> > +#define	DMA_SLAVE_BUSWIDTH_16_BYTES	DMA_PERIPHERAL_BUSWIDTH_16_BYTES
> > +#define	DMA_SLAVE_BUSWIDTH_32_BYTES	DMA_PERIPHERAL_BUSWIDTH_32_BYTES
> > +#define	DMA_SLAVE_BUSWIDTH_64_BYTES	DMA_PERIPHERAL_BUSWIDTH_64_BYTES
> 
> Probably move the defines after the enum dma_peripheral_buswidth block
> as well?

Yes missed that, thanks for pointing

-- 
~Vinod

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

* Re: [PATCH 2/4] dmaengine: move struct in interface to use peripheral term
  2020-10-19  9:04   ` Peter Ujfalusi
@ 2020-10-27 17:16     ` Vinod Koul
  0 siblings, 0 replies; 11+ messages in thread
From: Vinod Koul @ 2020-10-27 17:16 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: dmaengine

On 19-10-20, 12:04, Peter Ujfalusi wrote:
> Hi Vinod,
> 
> one minor comment...
> 
> On 15/10/2020 10.31, Vinod Koul wrote:
> > dmaengine history has a non inclusive terminology of dmaengine slave, I
> > feel it is time to replace that.
> > 
> > This moves structures in dmaengine interface with replacement of slave
> > to peripheral which is an appropriate term for dmaengine peripheral
> > devices
> > 
> > Since the change of name can break users, the new names have been added
> > with old structs kept as macro define for new names. Once the users have
> > been migrated, these macros will be dropped.
> > 
> > Signed-off-by: Vinod Koul <vkoul@kernel.org>
> 
> ...
> 
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index f7f420876d21..04b993a5373c 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> 
> ...
> 
> >  /**
> > - * struct dma_slave_map - associates slave device and it's slave channel with
> > + * struct dma_peripheral_map - associates peripheral device and it's peripheral channel with
> >   * parameter to be used by a filter function
> >   * @devname: name of the device
> > - * @slave: slave channel name
> > + * @peripheral: peripheral channel name
> 
> I know that this is slave -> peripheral change, but would not be better
> to call this as 'channame'?

okay have made in chan_name

-- 
~Vinod

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

* Re: [PATCH 3/4] dmaengine: move APIs in interface to use peripheral term
  2020-10-19  9:17   ` Peter Ujfalusi
@ 2020-10-28  4:33     ` Vinod Koul
  0 siblings, 0 replies; 11+ messages in thread
From: Vinod Koul @ 2020-10-28  4:33 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: dmaengine

On 19-10-20, 12:17, Peter Ujfalusi wrote:
> Hi Vinod,
> 
> On 15/10/2020 10.31, Vinod Koul wrote:
> > dmaengine history has a non inclusive terminology of dmaengine slave, I
> > feel it is time to replace that.
> > 
> > This moves APIs in dmaengine interface with replacement of slave
> > to peripheral which is an appropriate term for dmaengine peripheral
> > devices
> > 
> > Since the change of name can break users, the new names have been added
> > with old APIs kept as macro define for new names. Once the users have
> > been migrated, these macros will be dropped.
> > 
> > Signed-off-by: Vinod Koul <vkoul@kernel.org>
> > ---
> >  include/linux/dmaengine.h | 46 +++++++++++++++++++++++++++------------
> >  1 file changed, 32 insertions(+), 14 deletions(-)
> > 
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index 04b993a5373c..d8dce3cdfdd4 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -923,6 +923,10 @@ struct dma_device {
> >  	struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
> >  		struct dma_chan *chan, unsigned long flags);
> >  
> > +	struct dma_async_tx_descriptor *(*device_prep_peripheral_sg)(
> > +		struct dma_chan *chan, struct scatterlist *sgl,
> > +		unsigned int sg_len, enum dma_transfer_direction direction,
> > +		unsigned long flags, void *context);
> >  	struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
> >  		struct dma_chan *chan, struct scatterlist *sgl,
> >  		unsigned int sg_len, enum dma_transfer_direction direction,
> > @@ -959,8 +963,8 @@ struct dma_device {
> >  #endif
> >  };
> >  
> > -static inline int dmaengine_slave_config(struct dma_chan *chan,
> > -					  struct dma_slave_config *config)
> > +static inline int dmaengine_peripheral_config(struct dma_chan *chan,
> > +					  struct dma_peripheral_config *config)
> >  {
> >  	if (chan->device->device_config)
> >  		return chan->device->device_config(chan, config);
> > @@ -968,12 +972,16 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
> >  	return -ENOSYS;
> >  }
> >  
> > -static inline bool is_slave_direction(enum dma_transfer_direction direction)
> > +#define dmaengine_slave_config dmaengine_peripheral_config
> > +
> > +static inline bool is_peripheral_direction(enum dma_transfer_direction direction)
> >  {
> >  	return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM);
> >  }
> >  
> > -static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
> > +#define is_slave_direction is_peripheral_direction
> > +
> > +static inline struct dma_async_tx_descriptor *dmaengine_prep_peripheral_single(
> >  	struct dma_chan *chan, dma_addr_t buf, size_t len,
> >  	enum dma_transfer_direction dir, unsigned long flags)
> >  {
> > @@ -989,7 +997,9 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
> >  						  dir, flags, NULL);
> >  }
> >  
> > -static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
> > +#define dmaengine_prep_slave_single dmaengine_prep_peripheral_single
> > +
> > +static inline struct dma_async_tx_descriptor *dmaengine_prep_peripheral_sg(
> >  	struct dma_chan *chan, struct scatterlist *sgl,	unsigned int sg_len,
> >  	enum dma_transfer_direction dir, unsigned long flags)
> >  {
> > @@ -1000,6 +1010,8 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
> >  						  dir, flags, NULL);
> >  }
> >  
> > +#define dmaengine_prep_slave_sg dmaengine_prep_peripheral_sg
> > +
> 
> If you do similar changes to _single() then DMA drivers can migrate to
> the new device_prep_peripheral_sg in their own pace:

Yes not sure why I missed that, I have updated this for all three APIs
which use .device_prep_slave_sg()

Thanks
-- 
~Vinod

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

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15  7:31 [PATCH 0/4] dmaengine: use inclusive terminology Vinod Koul
2020-10-15  7:31 ` [PATCH 1/4] dmaengine: move enums in interface to use peripheral term Vinod Koul
2020-10-19  8:54   ` Peter Ujfalusi
2020-10-27 17:11     ` Vinod Koul
2020-10-15  7:31 ` [PATCH 2/4] dmaengine: move struct " Vinod Koul
2020-10-19  9:04   ` Peter Ujfalusi
2020-10-27 17:16     ` Vinod Koul
2020-10-15  7:31 ` [PATCH 3/4] dmaengine: move APIs " Vinod Koul
2020-10-19  9:17   ` Peter Ujfalusi
2020-10-28  4:33     ` Vinod Koul
2020-10-15  7:31 ` [PATCH 4/4] dmaengine: core: update " Vinod Koul

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org
	public-inbox-index dmaengine

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git