linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine
@ 2019-07-30  6:18 Christoph Hellwig
  2019-07-30  7:50 ` Tomi Valkeinen
  2019-07-30 13:50 ` Laurent Pinchart
  0 siblings, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2019-07-30  6:18 UTC (permalink / raw)
  To: tomi.valkeinen; +Cc: laurent.pinchart, dri-devel, iommu, linux-kernel

We can already use DMA_ATTR_WRITE_COMBINE or the _wc prefixed version,
so remove the third way of doing things.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 11 +++++------
 include/linux/dma-mapping.h         |  9 ---------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 785c5546067a..c70f3246a552 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -4609,11 +4609,10 @@ static int dispc_errata_i734_wa_init(struct dispc_device *dispc)
 	i734_buf.size = i734.ovli.width * i734.ovli.height *
 		color_mode_to_bpp(i734.ovli.fourcc) / 8;
 
-	i734_buf.vaddr = dma_alloc_writecombine(&dispc->pdev->dev,
-						i734_buf.size, &i734_buf.paddr,
-						GFP_KERNEL);
+	i734_buf.vaddr = dma_alloc_wc(&dispc->pdev->dev, i734_buf.size,
+			&i734_buf.paddr, GFP_KERNEL);
 	if (!i734_buf.vaddr) {
-		dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed\n",
+		dev_err(&dispc->pdev->dev, "%s: dma_alloc_wc failed\n",
 			__func__);
 		return -ENOMEM;
 	}
@@ -4626,8 +4625,8 @@ static void dispc_errata_i734_wa_fini(struct dispc_device *dispc)
 	if (!dispc->feat->has_gamma_i734_bug)
 		return;
 
-	dma_free_writecombine(&dispc->pdev->dev, i734_buf.size, i734_buf.vaddr,
-			      i734_buf.paddr);
+	dma_free_wc(&dispc->pdev->dev, i734_buf.size, i734_buf.vaddr,
+		    i734_buf.paddr);
 }
 
 static void dispc_errata_i734_wa(struct dispc_device *dispc)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index f7d1eea32c78..633dae466097 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -786,9 +786,6 @@ static inline void *dma_alloc_wc(struct device *dev, size_t size,
 
 	return dma_alloc_attrs(dev, size, dma_addr, gfp, attrs);
 }
-#ifndef dma_alloc_writecombine
-#define dma_alloc_writecombine dma_alloc_wc
-#endif
 
 static inline void dma_free_wc(struct device *dev, size_t size,
 			       void *cpu_addr, dma_addr_t dma_addr)
@@ -796,9 +793,6 @@ static inline void dma_free_wc(struct device *dev, size_t size,
 	return dma_free_attrs(dev, size, cpu_addr, dma_addr,
 			      DMA_ATTR_WRITE_COMBINE);
 }
-#ifndef dma_free_writecombine
-#define dma_free_writecombine dma_free_wc
-#endif
 
 static inline int dma_mmap_wc(struct device *dev,
 			      struct vm_area_struct *vma,
@@ -808,9 +802,6 @@ static inline int dma_mmap_wc(struct device *dev,
 	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size,
 			      DMA_ATTR_WRITE_COMBINE);
 }
-#ifndef dma_mmap_writecombine
-#define dma_mmap_writecombine dma_mmap_wc
-#endif
 
 #ifdef CONFIG_NEED_DMA_MAP_STATE
 #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)        dma_addr_t ADDR_NAME
-- 
2.20.1


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

* Re: [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine
  2019-07-30  6:18 [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine Christoph Hellwig
@ 2019-07-30  7:50 ` Tomi Valkeinen
  2019-07-30 10:20   ` Christoph Hellwig
  2019-07-30 13:50 ` Laurent Pinchart
  1 sibling, 1 reply; 6+ messages in thread
From: Tomi Valkeinen @ 2019-07-30  7:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: laurent.pinchart, dri-devel, iommu, linux-kernel

On 30/07/2019 09:18, Christoph Hellwig wrote:
> We can already use DMA_ATTR_WRITE_COMBINE or the _wc prefixed version,
> so remove the third way of doing things.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/gpu/drm/omapdrm/dss/dispc.c | 11 +++++------
>   include/linux/dma-mapping.h         |  9 ---------
>   2 files changed, 5 insertions(+), 15 deletions(-)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Which tree should this be applied to?

  Tomi

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

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

* Re: [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine
  2019-07-30  7:50 ` Tomi Valkeinen
@ 2019-07-30 10:20   ` Christoph Hellwig
  2019-07-30 11:23     ` Tomi Valkeinen
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-07-30 10:20 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Christoph Hellwig, laurent.pinchart, dri-devel, iommu, linux-kernel

On Tue, Jul 30, 2019 at 10:50:32AM +0300, Tomi Valkeinen wrote:
> On 30/07/2019 09:18, Christoph Hellwig wrote:
>> We can already use DMA_ATTR_WRITE_COMBINE or the _wc prefixed version,
>> so remove the third way of doing things.
>>
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>> ---
>>   drivers/gpu/drm/omapdrm/dss/dispc.c | 11 +++++------
>>   include/linux/dma-mapping.h         |  9 ---------
>>   2 files changed, 5 insertions(+), 15 deletions(-)
>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>
> Which tree should this be applied to?

I'd like to add it to the dma-mapping tree if possible.

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

* Re: [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine
  2019-07-30 10:20   ` Christoph Hellwig
@ 2019-07-30 11:23     ` Tomi Valkeinen
  0 siblings, 0 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2019-07-30 11:23 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: laurent.pinchart, dri-devel, iommu, linux-kernel

On 30/07/2019 13:20, Christoph Hellwig wrote:
> On Tue, Jul 30, 2019 at 10:50:32AM +0300, Tomi Valkeinen wrote:
>> On 30/07/2019 09:18, Christoph Hellwig wrote:
>>> We can already use DMA_ATTR_WRITE_COMBINE or the _wc prefixed version,
>>> so remove the third way of doing things.
>>>
>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>> ---
>>>    drivers/gpu/drm/omapdrm/dss/dispc.c | 11 +++++------
>>>    include/linux/dma-mapping.h         |  9 ---------
>>>    2 files changed, 5 insertions(+), 15 deletions(-)
>>
>> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>
>> Which tree should this be applied to?
> 
> I'd like to add it to the dma-mapping tree if possible.

That's ok for me.

  Tomi

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

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

* Re: [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine
  2019-07-30  6:18 [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine Christoph Hellwig
  2019-07-30  7:50 ` Tomi Valkeinen
@ 2019-07-30 13:50 ` Laurent Pinchart
  2019-08-29 14:54   ` Christoph Hellwig
  1 sibling, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2019-07-30 13:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: tomi.valkeinen, dri-devel, iommu, linux-kernel

Hi Christoph,

Thank you for the patch.

On Tue, Jul 30, 2019 at 09:18:49AM +0300, Christoph Hellwig wrote:
> We can already use DMA_ATTR_WRITE_COMBINE or the _wc prefixed version,
> so remove the third way of doing things.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/gpu/drm/omapdrm/dss/dispc.c | 11 +++++------
>  include/linux/dma-mapping.h         |  9 ---------
>  2 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 785c5546067a..c70f3246a552 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -4609,11 +4609,10 @@ static int dispc_errata_i734_wa_init(struct dispc_device *dispc)
>  	i734_buf.size = i734.ovli.width * i734.ovli.height *
>  		color_mode_to_bpp(i734.ovli.fourcc) / 8;
>  
> -	i734_buf.vaddr = dma_alloc_writecombine(&dispc->pdev->dev,
> -						i734_buf.size, &i734_buf.paddr,
> -						GFP_KERNEL);
> +	i734_buf.vaddr = dma_alloc_wc(&dispc->pdev->dev, i734_buf.size,
> +			&i734_buf.paddr, GFP_KERNEL);

I would have indented this line to match the rest. Apart from that,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	if (!i734_buf.vaddr) {
> -		dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed\n",
> +		dev_err(&dispc->pdev->dev, "%s: dma_alloc_wc failed\n",
>  			__func__);
>  		return -ENOMEM;
>  	}
> @@ -4626,8 +4625,8 @@ static void dispc_errata_i734_wa_fini(struct dispc_device *dispc)
>  	if (!dispc->feat->has_gamma_i734_bug)
>  		return;
>  
> -	dma_free_writecombine(&dispc->pdev->dev, i734_buf.size, i734_buf.vaddr,
> -			      i734_buf.paddr);
> +	dma_free_wc(&dispc->pdev->dev, i734_buf.size, i734_buf.vaddr,
> +		    i734_buf.paddr);
>  }
>  
>  static void dispc_errata_i734_wa(struct dispc_device *dispc)
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index f7d1eea32c78..633dae466097 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -786,9 +786,6 @@ static inline void *dma_alloc_wc(struct device *dev, size_t size,
>  
>  	return dma_alloc_attrs(dev, size, dma_addr, gfp, attrs);
>  }
> -#ifndef dma_alloc_writecombine
> -#define dma_alloc_writecombine dma_alloc_wc
> -#endif
>  
>  static inline void dma_free_wc(struct device *dev, size_t size,
>  			       void *cpu_addr, dma_addr_t dma_addr)
> @@ -796,9 +793,6 @@ static inline void dma_free_wc(struct device *dev, size_t size,
>  	return dma_free_attrs(dev, size, cpu_addr, dma_addr,
>  			      DMA_ATTR_WRITE_COMBINE);
>  }
> -#ifndef dma_free_writecombine
> -#define dma_free_writecombine dma_free_wc
> -#endif
>  
>  static inline int dma_mmap_wc(struct device *dev,
>  			      struct vm_area_struct *vma,
> @@ -808,9 +802,6 @@ static inline int dma_mmap_wc(struct device *dev,
>  	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size,
>  			      DMA_ATTR_WRITE_COMBINE);
>  }
> -#ifndef dma_mmap_writecombine
> -#define dma_mmap_writecombine dma_mmap_wc
> -#endif
>  
>  #ifdef CONFIG_NEED_DMA_MAP_STATE
>  #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)        dma_addr_t ADDR_NAME

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine
  2019-07-30 13:50 ` Laurent Pinchart
@ 2019-08-29 14:54   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2019-08-29 14:54 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Christoph Hellwig, tomi.valkeinen, dri-devel, iommu, linux-kernel

On Tue, Jul 30, 2019 at 04:50:45PM +0300, Laurent Pinchart wrote:
> I would have indented this line to match the rest. Apart from that,

I've fixed that up now that I've applied the patch.

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

end of thread, other threads:[~2019-08-29 14:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30  6:18 [PATCH] dma-mapping: remove dma_{alloc,free,mmap}_writecombine Christoph Hellwig
2019-07-30  7:50 ` Tomi Valkeinen
2019-07-30 10:20   ` Christoph Hellwig
2019-07-30 11:23     ` Tomi Valkeinen
2019-07-30 13:50 ` Laurent Pinchart
2019-08-29 14:54   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).