[PATCH 3/3] media: zoran: fix mixed case on vars

LABBE Corentin clabbe at baylibre.com
Fri Oct 2 07:21:15 UTC 2020


On Thu, Oct 01, 2020 at 11:28:15AM +0200, Mauro Carvalho Chehab wrote:
> Use this small script to replace CamelCase and wrong case
> on vars:
> 
> <script>
> FILES=$(find "$1" -type f|grep -e '.c$' -e '.h$')
> CAMEL_VARS=$(cat tags|perl -ne 'print "$1\n" if (m/^(\w*[A-Z]\w*[a-z]\w*)\s/)')
> for i in $CAMEL_VARS; do
>         new=$(perl -e '
>                 my $s = $ARGV[0];
>                 $s =~ s{([^a-zA-Z]?)([A-Z]*)([A-Z])([a-z]?)}{
>                         my $fc = pos($s)==0;
>                         my ($p0,$p1,$p2,$p3) = ($1,lc$2,lc$3,$4);
>                         my $t = $p0 || $fc ? $p0 : '_';
>                         $t .= $p3 ? $p1 ? "${p1}_$p2$p3" : "$p2$p3" : "$p1$p2";
>                         $t;
>                 }ge;
>                 print $s;' "$i")
>         for j in $FILES; do
>                 sed -E "s,\b$i\b,$new,g" -i $j
>         done
> done
> for i in $(git grep "#define zr" drivers/staging/media/zoran/*.[ch]|perl -ne 'print "$1\n" if (m/#define\s+(zr\S+)/)'); do j=$(echo $i|tr [a-z] [A-Z]); sed "s,\b$i\b,$j,g" -i drivers/staging/media/zoran/*.[ch]; done
> </script>
> 
> This should solve almost all warnings reported by checkpatch.pl
> in strict mode.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei at kernel.org>
> ---
>  drivers/staging/media/zoran/videocodec.h   |   2 +-
>  drivers/staging/media/zoran/zoran.h        |  30 +--
>  drivers/staging/media/zoran/zoran_card.c   |  52 ++---
>  drivers/staging/media/zoran/zoran_device.c | 242 ++++++++++-----------
>  drivers/staging/media/zoran/zoran_driver.c |  94 ++++----
>  drivers/staging/media/zoran/zr36016.c      |  14 +-
>  drivers/staging/media/zoran/zr36050.c      |   2 +-
>  drivers/staging/media/zoran/zr36057.h      | 122 +++++------
>  drivers/staging/media/zoran/zr36060.c      |  76 +++----
>  drivers/staging/media/zoran/zr36060.h      |  66 +++---
>  10 files changed, 350 insertions(+), 350 deletions(-)

Acked-by: Corentin Labbe <clabbe at baylibre.com>

Thanks


More information about the devel mailing list