[PATCH v2 3/4] drm/gem: rename struct drm_gem_dma_object.{paddr => dma_addr}

Danilo Krummrich dakr at redhat.com
Thu Jul 7 10:00:04 UTC 2022


Hi Laurent,

On 7/6/22 19:28, Laurent Pinchart wrote:
> Hi Danilo,
> 
> Thank you for the patch.
> 
> On Wed, Jul 06, 2022 at 02:43:51PM +0200, Danilo Krummrich wrote:
>> The field paddr of struct drm_gem_dma_object holds a DMA address, which
>> might actually be a physical address. However, depending on the platform,
>> it can also be a bus address or a virtual address managed by an IOMMU.
>>
>> Hence, rename the field to dma_addr, which is more applicable.
>>
>> Since 'paddr' is a very commonly used term and symbol name a simple regex
>> does not do the trick. Instead, users of the struct were fixed up
>> iteratively with a trial and error approach building with
>> `make allyesconfig && make drivers/gpu/drm`.
> 
> Not for this patch as you've already done the work manually, but can I
> recommend the excellent coccinelle tool ? Its semantic patches can very
> easily rename structure members.
Actually, I should have and I will. It seems like there are a few 
drivers I missed with that - the ones not using CONFIG_COMPILE_TEST.

Additionally, I will also test cross-compiling for ARM and ARM64.

- Danilo
> 
>> Signed-off-by: Danilo Krummrich <dakr at redhat.com>
>> ---
>>   .../arm/display/komeda/komeda_framebuffer.c   |  4 ++--
>>   drivers/gpu/drm/arm/malidp_mw.c               |  2 +-
>>   drivers/gpu/drm/arm/malidp_planes.c           | 12 +++++-----
>>   drivers/gpu/drm/aspeed/aspeed_gfx_crtc.c      |  2 +-
>>   drivers/gpu/drm/drm_fb_dma_helper.c           | 10 ++++----
>>   drivers/gpu/drm/drm_gem_dma_helper.c          | 23 +++++++++++--------
>>   drivers/gpu/drm/imx/ipuv3-plane.c             |  6 ++---
>>   drivers/gpu/drm/sprd/sprd_dpu.c               |  2 +-
>>   drivers/gpu/drm/sun4i/sun8i_ui_layer.c        | 14 +++++------
>>   drivers/gpu/drm/sun4i/sun8i_vi_layer.c        | 14 +++++------
>>   drivers/gpu/drm/tidss/tidss_dispc.c           | 16 ++++++-------
>>   drivers/gpu/drm/tiny/arcpgu.c                 |  2 +-
>>   drivers/gpu/drm/vc4/vc4_bo.c                  |  2 +-
>>   drivers/gpu/drm/vc4/vc4_gem.c                 |  8 +++----
>>   drivers/gpu/drm/vc4/vc4_irq.c                 |  2 +-
>>   drivers/gpu/drm/vc4/vc4_plane.c               |  4 ++--
>>   drivers/gpu/drm/vc4/vc4_render_cl.c           | 14 +++++------
>>   drivers/gpu/drm/vc4/vc4_txp.c                 |  2 +-
>>   drivers/gpu/drm/vc4/vc4_v3d.c                 |  4 ++--
>>   drivers/gpu/drm/vc4/vc4_validate.c            | 12 +++++-----
>>   include/drm/drm_gem_dma_helper.h              |  4 ++--
>>   21 files changed, 81 insertions(+), 78 deletions(-)
> 
> [snip]
> 
>> diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c
>> index 56fc1a1e7f87..8851d294bb53 100644
>> --- a/drivers/gpu/drm/drm_gem_dma_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_dma_helper.c
> 
> [snip]
> 
>> @@ -460,10 +461,11 @@ drm_gem_dma_prime_import_sg_table(struct drm_device *dev,
>>   	if (IS_ERR(dma_obj))
>>   		return ERR_CAST(dma_obj);
>>   
>> -	dma_obj->paddr = sg_dma_address(sgt->sgl);
>> +	dma_obj->dma_addr = sg_dma_address(sgt->sgl);
>>   	dma_obj->sgt = sgt;
>>   
>> -	DRM_DEBUG_PRIME("dma_addr = %pad, size = %zu\n", &dma_obj->paddr, attach->dmabuf->size);
>> +	DRM_DEBUG_PRIME("dma_addr = %pad, size = %zu\n", &dma_obj->dma_addr,
>> +							 attach->dmabuf->size);
> 
> The second line should be aligned left, just right of the opening
> parenthesis.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
>>   
>>   	return &dma_obj->base;
>>   }
> 
> [snip]
> 



More information about the dri-devel mailing list