[09/33] dma: Rename free() to rfree()

Message ID 20200112120216.9.Ifb04203c2bf46c05eaf0015b1140a2ae4bb3e090@changeid
State New
Headers show
Series
  • sandbox: Move to SDL2
Related show

Commit Message

Simon Glass Jan. 12, 2020, 7:06 p.m.
This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/dma/dma-uclass.c       | 4 ++--
 drivers/dma/sandbox-dma-test.c | 2 +-
 drivers/dma/ti/k3-udma.c       | 2 +-
 include/dma-uclass.h           | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

Comments

Peter Ujfalusi Jan. 13, 2020, 7:41 a.m. | #1
Hi Simon,

On 12/01/2020 21.06, Simon Glass wrote:
> This function name conflicts with our desire to #define free() to
> something else on sandbox. Since it deals with resources, rename it to
> rfree().
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
>  drivers/dma/dma-uclass.c       | 4 ++--
>  drivers/dma/sandbox-dma-test.c | 2 +-
>  drivers/dma/ti/k3-udma.c       | 2 +-
>  include/dma-uclass.h           | 4 ++--
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
> index 5598bca21c..a0159d7888 100644
> --- a/drivers/dma/dma-uclass.c
> +++ b/drivers/dma/dma-uclass.c
> @@ -122,10 +122,10 @@ int dma_free(struct dma *dma)
>  
>  	debug("%s(dma=%p)\n", __func__, dma);
>  
> -	if (!ops->free)
> +	if (!ops->rfree)
>  		return 0;
>  
> -	return ops->free(dma);
> +	return ops->rfree(dma);
>  }
>  
>  int dma_enable(struct dma *dma)
> diff --git a/drivers/dma/sandbox-dma-test.c b/drivers/dma/sandbox-dma-test.c
> index 8fcef1863e..5aa7838ff5 100644
> --- a/drivers/dma/sandbox-dma-test.c
> +++ b/drivers/dma/sandbox-dma-test.c
> @@ -229,7 +229,7 @@ static const struct dma_ops sandbox_dma_ops = {
>  	.transfer	= sandbox_dma_transfer,
>  	.of_xlate	= sandbox_dma_of_xlate,
>  	.request	= sandbox_dma_request,
> -	.free		= sandbox_dma_free,
> +	.rfree		= sandbox_dma_free,

Please also change the name of the implementing callback function:
s/sandbox_dma_free/sandbox_dma_rfree

>  	.enable		= sandbox_dma_enable,
>  	.disable	= sandbox_dma_disable,
>  	.send		= sandbox_dma_send,
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index f7128610c5..23d6ed0697 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -1720,7 +1720,7 @@ static const struct dma_ops udma_ops = {
>  	.transfer	= udma_transfer,
>  	.of_xlate	= udma_of_xlate,
>  	.request	= udma_request,
> -	.free		= udma_free,
> +	.rfree		= udma_free,

Same here.

>  	.enable		= udma_enable,
>  	.disable	= udma_disable,
>  	.send		= udma_send,
> diff --git a/include/dma-uclass.h b/include/dma-uclass.h
> index a1d9d26ac5..340437acc1 100644
> --- a/include/dma-uclass.h
> +++ b/include/dma-uclass.h
> @@ -58,14 +58,14 @@ struct dma_ops {
>  	 */
>  	int (*request)(struct dma *dma);
>  	/**
> -	 * free - Free a previously requested dma.
> +	 * rfree - Free a previously requested dma.
>  	 *
>  	 * This is the implementation of the client dma_free() API.
>  	 *
>  	 * @dma: The DMA to free.
>  	 * @return 0 if OK, or a negative error code.
>  	 */
> -	int (*free)(struct dma *dma);
> +	int (*rfree)(struct dma *dma);
>  	/**
>  	 * enable() - Enable a DMA Channel.
>  	 *
> 

- P├ęter

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

Patch

diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
index 5598bca21c..a0159d7888 100644
--- a/drivers/dma/dma-uclass.c
+++ b/drivers/dma/dma-uclass.c
@@ -122,10 +122,10 @@  int dma_free(struct dma *dma)
 
 	debug("%s(dma=%p)\n", __func__, dma);
 
-	if (!ops->free)
+	if (!ops->rfree)
 		return 0;
 
-	return ops->free(dma);
+	return ops->rfree(dma);
 }
 
 int dma_enable(struct dma *dma)
diff --git a/drivers/dma/sandbox-dma-test.c b/drivers/dma/sandbox-dma-test.c
index 8fcef1863e..5aa7838ff5 100644
--- a/drivers/dma/sandbox-dma-test.c
+++ b/drivers/dma/sandbox-dma-test.c
@@ -229,7 +229,7 @@  static const struct dma_ops sandbox_dma_ops = {
 	.transfer	= sandbox_dma_transfer,
 	.of_xlate	= sandbox_dma_of_xlate,
 	.request	= sandbox_dma_request,
-	.free		= sandbox_dma_free,
+	.rfree		= sandbox_dma_free,
 	.enable		= sandbox_dma_enable,
 	.disable	= sandbox_dma_disable,
 	.send		= sandbox_dma_send,
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index f7128610c5..23d6ed0697 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -1720,7 +1720,7 @@  static const struct dma_ops udma_ops = {
 	.transfer	= udma_transfer,
 	.of_xlate	= udma_of_xlate,
 	.request	= udma_request,
-	.free		= udma_free,
+	.rfree		= udma_free,
 	.enable		= udma_enable,
 	.disable	= udma_disable,
 	.send		= udma_send,
diff --git a/include/dma-uclass.h b/include/dma-uclass.h
index a1d9d26ac5..340437acc1 100644
--- a/include/dma-uclass.h
+++ b/include/dma-uclass.h
@@ -58,14 +58,14 @@  struct dma_ops {
 	 */
 	int (*request)(struct dma *dma);
 	/**
-	 * free - Free a previously requested dma.
+	 * rfree - Free a previously requested dma.
 	 *
 	 * This is the implementation of the client dma_free() API.
 	 *
 	 * @dma: The DMA to free.
 	 * @return 0 if OK, or a negative error code.
 	 */
-	int (*free)(struct dma *dma);
+	int (*rfree)(struct dma *dma);
 	/**
 	 * enable() - Enable a DMA Channel.
 	 *