dmaengine: use inclusive terminology
Vinod Koul
maintainercover dmaengine: use inclusive terminology
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(-)
Signature · 1 line
2.26.2
Vinod Koul
maintainerPATCH 1/4 dmaengine: move enums in interface to use peripheral term
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.
--- include/linux/dmaengine.h | 44 ++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-)
include/linux/dmaengine.h +29 -15
@@ -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
Signature · 1 line
2.26.2
Re: [PATCH 1/4] dmaengine: move enums in interface to use peripheral term
Quoted 48 lines · 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 <[email protected]>--- include/linux/dmaengine.h | 44 ++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-)include/linux/dmaengine.h +6
-4@@ -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; };
include/linux/dmaengine.h struct dma_chan_dev { · line 377
Quoted 10 lines
include/linux/dmaengine.h +9
-0+#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?
Quoted 24 lines
include/linux/dmaengine.h +9
-11+/** -* 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 ,
include/linux/dmaengine.h struct dma_chan_dev { · line 399
Quoted 10 lines
include/linux/dmaengine.h +5
-0+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
Vinod Koul
maintainerRe: [PATCH 1/4] dmaengine: move enums in interface to use peripheral term
Quoted 50 lines · Peter Ujfalusi
Quoted 49 lines · 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 <[email protected]>--- include/linux/dmaengine.h | 44 ++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-)include/linux/dmaengine.h +6
-4@@ -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; };
Quoted 12 lines
include/linux/dmaengine.h struct dma_chan_dev { · line 377
Quoted 9 lines
include/linux/dmaengine.h +9
-0+#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_BYTESProbably move the defines after the enum
dma_peripheral_buswidthblock as well?
Yes missed that, thanks for pointing
Signature · 1 line
~Vinod
Vinod Koul
maintainerPATCH 2/4 dmaengine: move struct in interface to use peripheral term
In reply to Vinod Kouldmaengine 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.
--- drivers/dma/dmaengine.c | 12 +++---- include/linux/dmaengine.h | 71 +++++++++++++++++++++------------------ 2 files changed, 45 insertions(+), 38 deletions(-)
drivers/dma/dmaengine.c +6 -6
@@ -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
include/linux/dmaengine.h +39 -32
202 lines not on this page · raw message
Signature · 1 line
2.26.2
Re: [PATCH 2/4] dmaengine: move struct in interface to use peripheral term
Hi Vinod,
one minor comment...
Quoted 12 lines · 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 <[email protected]>
...
Quoted 4 lines
include/linux/dmaengine.h +0
-0
...
Quoted 7 lines
/**
- * structdma_slave_map- associates slave device and it's slave channel with
+ * structdma_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'?
include/linux/dmaengine.h enum dmaengine_alignment { · line 775
Quoted 12 lines
* @param: opaque parameter to pass to struct dma_filter.fn */
include/linux/dmaengine.h +4
-2-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
Vinod Koul
maintainerRe: [PATCH 2/4] dmaengine: move struct in interface to use peripheral term
Quoted 35 lines · Peter Ujfalusi
Hi Vinod,
one minor comment...
Quoted 12 lines · 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 <[email protected]>...
Quoted 4 lines
include/linux/dmaengine.h +0
-0...
Quoted 7 lines
/**
- * structdma_slave_map- associates slave device and it's slave channel with
+ * structdma_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
Quoted 2 lines
I know that this is slave -> peripheral change, but would not be better to call this as 'channame'?
okay have made in chan_name
Signature · 1 line
~Vinod
Vinod Koul
maintainerPATCH 3/4 dmaengine: move APIs in interface to use peripheral term
In reply to Vinod Kouldmaengine 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.
--- include/linux/dmaengine.h | 46 +++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-)
include/linux/dmaengine.h +32 -14
@@ -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_chanreturn __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) {
Signature · 1 line
2.26.2
Re: [PATCH 3/4] dmaengine: move APIs in interface to use peripheral term
Hi Vinod,
Quoted 73 lines · 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 <[email protected]>--- include/linux/dmaengine.h | 46 +++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-)include/linux/dmaengine.h +15
-5@@ -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) {
include/linux/dmaengine.h static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg( · line 1014
Quoted 5 lines
include/linux/dmaengine.h +2
-0@@ -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;
}Quoted 64 lines
include/linux/dmaengine.h +13
-9#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;
include/linux/dmaengine.h static inline struct dma_chan · line 1639
Quoted 8 lines
include/linux/dmaengine.h +2
-0@@ -1616,6 +1632,8 @@ static inline struct dma_chanreturn __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
Vinod Koul
maintainerRe: [PATCH 3/4] dmaengine: move APIs in interface to use peripheral term
Quoted 79 lines · Peter Ujfalusi
Hi Vinod,
Quoted 76 lines · 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 <[email protected]>--- include/linux/dmaengine.h | 46 +++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-)include/linux/dmaengine.h +15
-5@@ -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); }
Quoted 5 lines
include/linux/dmaengine.h static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg( · line 1014
Quoted 2 lines
include/linux/dmaengine.h +2
-0+#define dmaengine_prep_slave_sg dmaengine_prep_peripheral_sg +If you do similar changes to
_single()then DMA drivers can migrate to the newdevice_prep_peripheral_sgin 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
Signature · 1 line
~Vinod
Vinod Koul
maintainerPATCH 4/4 dmaengine: core: update to use peripheral term
In reply to Vinod Kouldmaengine 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
--- drivers/dma/dmaengine.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/dma/dmaengine.c +18 -18
@@ -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 ;
Signature · 1 line
2.26.2