From patchwork Thu Oct 15 07:31:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 11838753 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CA9961C for ; Thu, 15 Oct 2020 07:31:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF9832224D for ; Thu, 15 Oct 2020 07:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602747114; bh=AKkD2BXKK07zrp+cxaAHKqs3bNw+VIOYZiGxRH5uZa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IO2LnJAdrO+3G9wj/g3Wx/P1QbhA1g5ZiYlUwecAcjwq+Ytr93iCac6KIs+tRB7MT arPHgm8qYQSWr+d5qbcP/LpoY1zjvP1FOG5iqpIUtVNzDD/M0JRxCT/JS4WXJzLlHh 8Weu8CVUHAzk3dO6EEPkoqGgW9ObBpRcpUvDjXUY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727868AbgJOHbx (ORCPT ); Thu, 15 Oct 2020 03:31:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:47620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726103AbgJOHbx (ORCPT ); Thu, 15 Oct 2020 03:31:53 -0400 Received: from localhost.localdomain (unknown [122.171.209.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E2FC22243; Thu, 15 Oct 2020 07:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602747112; bh=AKkD2BXKK07zrp+cxaAHKqs3bNw+VIOYZiGxRH5uZa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T10YH1wRp4YoUn8uwvBI9QStgWeHBQGfM6UOrhwU77v8fcg6yXHlvUx2Zw+posdGG klKm0wP/6jR2Eq0AB5CtOagxSON0heRjJpH4lWA2K8xeZKGVSsfwsucx+N6cFq+eUG Th4a9KUw3NHGnqRgJaaDHIViWiiPEdWC9vvc8v+M= From: Vinod Koul To: dmaengine@vger.kernel.org Cc: Vinod Koul Subject: [PATCH 1/4] dmaengine: move enums in interface to use peripheral term Date: Thu, 15 Oct 2020 13:01:29 +0530 Message-Id: <20201015073132.3571684-2-vkoul@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201015073132.3571684-1-vkoul@kernel.org> References: <20201015073132.3571684-1-vkoul@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org 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 --- 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 From patchwork Thu Oct 15 07:31:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 11838755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 336E961C for ; Thu, 15 Oct 2020 07:31:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01BB52224D for ; Thu, 15 Oct 2020 07:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602747116; bh=+c6nwfoth7Zjdubli8/24COztlce5AWnbHKzhJqEisg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EOH6Lo76660RlOZDngyvFbObvBorr/Y0Y+U5936Xku8uui94nOpFIy0PR9dbGxHBj 58f+5vXIAM4Mi5syCGX+oMyT0WpzCbhlcGs7dO2JGTzNvaXtSlBC8HHwQKinyNAxaI uUgRJwp9plTNrnzTMBidvcTyGcagnzio9gLL0KMc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727878AbgJOHbz (ORCPT ); Thu, 15 Oct 2020 03:31:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:47642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726103AbgJOHbz (ORCPT ); Thu, 15 Oct 2020 03:31:55 -0400 Received: from localhost.localdomain (unknown [122.171.209.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B0DF22249; Thu, 15 Oct 2020 07:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602747114; bh=+c6nwfoth7Zjdubli8/24COztlce5AWnbHKzhJqEisg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V0PFV3USidkw9WpTriKyZrKkRZjSdaFyhMTp4UgZHXb21bXKygjQ3DdDvWdz9hESn CuuStuXB6a9Bmp8BDJJm4TS9/GJVurlxrgtOya6nIQXUCr2oZjrozry79z9gh8OzD4 J8yzhmLcupP5NCd/AlR3F2OK++JiBuO3iju/icdw= From: Vinod Koul To: dmaengine@vger.kernel.org Cc: Vinod Koul Subject: [PATCH 2/4] dmaengine: move struct in interface to use peripheral term Date: Thu, 15 Oct 2020 13:01:30 +0530 Message-Id: <20201015073132.3571684-3-vkoul@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201015073132.3571684-1-vkoul@kernel.org> References: <20201015073132.3571684-1-vkoul@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org 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 --- 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() 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() 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); From patchwork Thu Oct 15 07:31:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 11838757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6654C14B2 for ; Thu, 15 Oct 2020 07:31:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48C062224A for ; Thu, 15 Oct 2020 07:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602747117; bh=q6y96Az+Nz8rnTWUROCL2UApIOd860PHpToD4g5tVY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WSRlhms9nJQVTVRGlbwyM6LLB2np18v5wbNTilqcpIPtOHz7PzK5TLSgXyrgi2MT6 LqB5dhDZLbOb5hRxEGxiorI+ueH4cL18VESBRo3/aO6Yghr0gG7Ph4n5HODZvO4+VH fDRDRprfMqSjjHX5A57UVLYJRwIAAtvp8vNj0DQo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727934AbgJOHb5 (ORCPT ); Thu, 15 Oct 2020 03:31:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:47660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726103AbgJOHb4 (ORCPT ); Thu, 15 Oct 2020 03:31:56 -0400 Received: from localhost.localdomain (unknown [122.171.209.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 049E62224A; Thu, 15 Oct 2020 07:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602747116; bh=q6y96Az+Nz8rnTWUROCL2UApIOd860PHpToD4g5tVY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ycAx+MeCxuU8C84Mwkn5TTuOB/HO18n93rde5KlresiwZz0fH+SSM9p3cBSUPfoir 3NbU6FEDjvU9v/W2jxfvGDnrbx4COGFJ6hFzsL6KzA1gHRP/ecn7j8BxWhrok9RcTU irjpvkb2LttSNsqG/GVxjpA03ui2sS2yPk1F8m3w= From: Vinod Koul To: dmaengine@vger.kernel.org Cc: Vinod Koul Subject: [PATCH 3/4] dmaengine: move APIs in interface to use peripheral term Date: Thu, 15 Oct 2020 13:01:31 +0530 Message-Id: <20201015073132.3571684-4-vkoul@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201015073132.3571684-1-vkoul@kernel.org> References: <20201015073132.3571684-1-vkoul@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org 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 --- 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) { From patchwork Thu Oct 15 07:31:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 11838759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC91C61C for ; Thu, 15 Oct 2020 07:31:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE77B22247 for ; Thu, 15 Oct 2020 07:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602747118; bh=OntA+LWhL7f5z0uBEaaPch3mqbF3WVBFeZgkfkwuK8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1bOlxqGrqBuh/0iwwgcJzB1sSs0sv3vjoyVH+aDKG7MMbHxwWhK5N6HVaA2slNLup n2M0X1k0uDIIA5YjQbIoeFXRu8Bm5TmVFg4HGeDxnIAUTMzKOgSrNaz0+L2G6d/l7R V41ZYkooUol6euqERAT0gWsQcQXDtA9ZohHjemCA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727942AbgJOHb6 (ORCPT ); Thu, 15 Oct 2020 03:31:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:47678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726103AbgJOHb6 (ORCPT ); Thu, 15 Oct 2020 03:31:58 -0400 Received: from localhost.localdomain (unknown [122.171.209.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D2E7122243; Thu, 15 Oct 2020 07:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602747118; bh=OntA+LWhL7f5z0uBEaaPch3mqbF3WVBFeZgkfkwuK8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T/bqtc5vjLOxSa7uio+xsNEBQNOUv1uScxcP2SZsmSUC58XlpQlIMdM12UvdDBSv+ 38d8/W6wdOLnhyo9mIMx1/7M1hDEF70QN6v6F1IdlrE03s7Oaq+KSAJ2qLoUZZYKi/ 4LkftNXahKWR0hmZi1yOAx130ygx0YYEHytcJHj4= From: Vinod Koul To: dmaengine@vger.kernel.org Cc: Vinod Koul Subject: [PATCH 4/4] dmaengine: core: update to use peripheral term Date: Thu, 15 Oct 2020 13:01:32 +0530 Message-Id: <20201015073132.3571684-5-vkoul@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201015073132.3571684-1-vkoul@kernel.org> References: <20201015073132.3571684-1-vkoul@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org 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 --- 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;