mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@redhat.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: daniel@ffwll.ch, laurent.pinchart@ideasonboard.com,
	airlied@linux.ie, tzimmermann@suse.de, mripard@kernel.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH drm-misc-next v5 1/4] drm/fb: rename FB CMA helpers to FB DMA helpers
Date: Thu, 21 Jul 2022 12:42:06 +0200	[thread overview]
Message-ID: <94904971-94b6-4e6f-3297-8ef4d1a04c30@redhat.com> (raw)
In-Reply-To: <Ytg596Lk4kumqeRD@ravnborg.org>

Hi Sam,

On 7/20/22 19:23, Sam Ravnborg wrote:
> Hi Danilo,
> 
> On Wed, Jul 20, 2022 at 05:31:25PM +0200, Danilo Krummrich wrote:
>> Rename "FB CMA" helpers to "FB DMA" helpers - considering the hierarchy
>> of APIs (mm/cma -> dma -> fb dma) calling them "FB DMA" seems to be
>> more applicable.
>>
>> Besides that, commit e57924d4ae80 ("drm/doc: Task to rename CMA helpers")
>> requests to rename the CMA helpers and implies that people seem to be
>> confused about the naming.
>>
>> In order to do this renaming the following script was used:
>>
>> ```
>> 	#!/bin/bash
>>
>> 	DIRS="drivers/gpu include/drm Documentation/gpu"
>>
>> 	REGEX_SYM_UPPER="[0-9A-Z_\-]"
>> 	REGEX_SYM_LOWER="[0-9a-z_\-]"
>>
>> 	REGEX_GREP_UPPER="(${REGEX_SYM_UPPER}*)(FB)_CMA_(${REGEX_SYM_UPPER}*)"
>> 	REGEX_GREP_LOWER="(${REGEX_SYM_LOWER}*)(fb)_cma_(${REGEX_SYM_LOWER}*)"
>>
>> 	REGEX_SED_UPPER="s/${REGEX_GREP_UPPER}/\1\2_DMA_\3/g"
>> 	REGEX_SED_LOWER="s/${REGEX_GREP_LOWER}/\1\2_dma_\3/g"
>>
>> 	# Find all upper case 'CMA' symbols and replace them with 'DMA'.
>> 	for ff in $(grep -REHl "${REGEX_GREP_UPPER}" $DIRS)
>> 	do
>> 	       sed -i -E "$REGEX_SED_UPPER" $ff
>> 	done
>>
>> 	# Find all lower case 'cma' symbols and replace them with 'dma'.
>> 	for ff in $(grep -REHl "${REGEX_GREP_LOWER}" $DIRS)
>> 	do
>> 	       sed -i -E "$REGEX_SED_LOWER" $ff
>> 	done
>>
>> 	# Replace all occurrences of 'CMA' / 'cma' in comments and
>> 	# documentation files with 'DMA' / 'dma'.
>> 	for ff in $(grep -RiHl " cma " $DIRS)
>> 	do
>> 		sed -i -E "s/ cma / dma /g" $ff
>> 		sed -i -E "s/ CMA / DMA /g" $ff
>> 	done
>> ```
>>
>> Only a few more manual modifications were needed, e.g. reverting the
>> following modifications in some DRM Kconfig files
>>
>>      -       select CMA if HAVE_DMA_CONTIGUOUS
>>      +       select DMA if HAVE_DMA_CONTIGUOUS
>>
>> as well as manually picking the occurrences of 'CMA'/'cma' in comments and
>> documentation which relate to "FB CMA", but not "GEM CMA".
>>
>> This patch is compile-time tested building a x86_64 kernel with
>> `make allyesconfig && make drivers/gpu/drm`.
>>
>> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Signed-off-by: Danilo Krummrich <dakr@redhat.com>
> 
> For the most part I like the patch.
> But there is a few cases I would like to see fixed.
> 
> 
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
>> index e89ae0ec60eb..fab18135f12b 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
>> @@ -25,7 +25,7 @@
>>   #include <drm/drm_crtc.h>
>>   #include <drm/drm_debugfs.h>
>>   #include <drm/drm_drv.h>
>> -#include <drm/drm_fb_cma_helper.h>
>> +#include <drm/drm_fb_dma_helper.h>
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
> 
> 
> The only change in the file above is the rename of the include file.
> This is a strong hint that the include is not needed and the correct fix
> is to drop the include. There are more cases like the above.

Yep, good catch.

> 
> This is a manual process on top of what you could automate, but then I
> suggest to identify them and remove the includes before you change the
> file name.
> 
> Or if anyone applies the patches then at least do it in a follow-up at
> the places will never be easier to spot.
> 
> So with this cleanup done either before or after this patch.

I'll add anther patch to remove the unused includes before doing the 
renaming.

> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> 
> 	Sam
> 

- Danilo


  reply	other threads:[~2022-07-21 10:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20 15:31 [PATCH drm-misc-next v5 0/4] drm: rename CMA helpers to " Danilo Krummrich
2022-07-20 15:31 ` [PATCH drm-misc-next v5 1/4] drm/fb: rename FB CMA helpers to FB " Danilo Krummrich
2022-07-20 17:23   ` Sam Ravnborg
2022-07-21 10:42     ` Danilo Krummrich [this message]
2022-07-20 15:31 ` [PATCH drm-misc-next v5 2/4] drm/gem: rename GEM CMA helpers to GEM " Danilo Krummrich
2022-07-20 17:27   ` Sam Ravnborg
2022-07-20 15:35 ` [PATCH drm-misc-next v5 3/4] drm/gem: rename struct drm_gem_dma_object.{paddr => dma_addr} Danilo Krummrich
2022-07-20 17:28   ` Sam Ravnborg
2022-07-20 15:35 ` [PATCH drm-misc-next v5 4/4] drm/todo: remove task to rename CMA helpers Danilo Krummrich
2022-07-20 17:29   ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94904971-94b6-4e6f-3297-8ef4d1a04c30@redhat.com \
    --to=dakr@redhat.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®