diff mbox series

[1/3] media: zoran: use upper case for card types

Message ID 21fd8f12edb27d269eefdbea172aa3a80e2aa6ce.1601544491.git.mchehab+huawei@kernel.org
State Accepted
Commit 0568d6c20e03ae620d6e84579f68337afc2d9c2b
Headers show
Series [1/3] media: zoran: use upper case for card types | expand

Commit Message

Mauro Carvalho Chehab Oct. 1, 2020, 9:28 a.m. UTC
Don't mix case there: let's just use uppercase, as this is
the common pattern for such define-like enums.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/staging/media/zoran/zoran.h      |  8 ++++----
 drivers/staging/media/zoran/zoran_card.c | 20 ++++++++++----------
 2 files changed, 14 insertions(+), 14 deletions(-)

Comments

Corentin Labbe Oct. 2, 2020, 7:21 a.m. UTC | #1
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@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@baylibre.com>

Thanks
diff mbox series

Patch

diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h
index 372fadfd9a01..7217a64fe59b 100644
--- a/drivers/staging/media/zoran/zoran.h
+++ b/drivers/staging/media/zoran/zoran.h
@@ -75,11 +75,11 @@  enum card_type {
 	UNKNOWN = -1,
 
 	/* Pinnacle/Miro */
-	DC10_old,		/* DC30 like */
-	DC10_new,		/* DC10plus like */
-	DC10plus,
+	DC10_OLD,		/* DC30 like */
+	DC10_NEW,		/* DC10_PLUS like */
+	DC10_PLUS,
 	DC30,
-	DC30plus,
+	DC30_PLUS,
 
 	/* Linux Media Labs */
 	LML33,
diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c
index 84a5d52517cd..8d56d039a686 100644
--- a/drivers/staging/media/zoran/zoran_card.c
+++ b/drivers/staging/media/zoran/zoran_card.c
@@ -104,8 +104,8 @@  MODULE_VERSION(ZORAN_VERSION);
 	.subvendor = (subven), .subdevice = (subdev), .driver_data = (data) }
 
 static const struct pci_device_id zr36067_pci_tbl[] = {
-	ZR_DEVICE(PCI_VENDOR_ID_MIRO, PCI_DEVICE_ID_MIRO_DC10PLUS, DC10plus),
-	ZR_DEVICE(PCI_VENDOR_ID_MIRO, PCI_DEVICE_ID_MIRO_DC30PLUS, DC30plus),
+	ZR_DEVICE(PCI_VENDOR_ID_MIRO, PCI_DEVICE_ID_MIRO_DC10PLUS, DC10_PLUS),
+	ZR_DEVICE(PCI_VENDOR_ID_MIRO, PCI_DEVICE_ID_MIRO_DC30PLUS, DC30_PLUS),
 	ZR_DEVICE(PCI_VENDOR_ID_ELECTRONICDESIGNGMBH, PCI_DEVICE_ID_LML_33R10, LML33R10),
 	ZR_DEVICE(PCI_VENDOR_ID_IOMEGA, PCI_DEVICE_ID_IOMEGA_BUZ, BUZ),
 	ZR_DEVICE(PCI_ANY_ID, PCI_ANY_ID, NUM_CARDS),
@@ -311,7 +311,7 @@  static const unsigned short bt866_addrs[] = { 0x44, I2C_CLIENT_END };
 
 static struct card_info zoran_cards[NUM_CARDS] = {
 	{
-		.type = DC10_old,
+		.type = DC10_OLD,
 		.name = "DC10(old)",
 		.i2c_decoder = "vpx3220a",
 		.addrs_decoder = vpx3220_addrs,
@@ -340,7 +340,7 @@  static struct card_info zoran_cards[NUM_CARDS] = {
 		.input_mux = 0,
 		.init = &dc10_init,
 	}, {
-		.type = DC10_new,
+		.type = DC10_NEW,
 		.name = "DC10(new)",
 		.i2c_decoder = "saa7110",
 		.addrs_decoder = saa7110_addrs,
@@ -369,8 +369,8 @@  static struct card_info zoran_cards[NUM_CARDS] = {
 		.input_mux = 0,
 		.init = &dc10plus_init,
 	}, {
-		.type = DC10plus,
-		.name = "DC10plus",
+		.type = DC10_PLUS,
+		.name = "DC10_PLUS",
 		.i2c_decoder = "saa7110",
 		.addrs_decoder = saa7110_addrs,
 		.i2c_encoder = "adv7175",
@@ -430,8 +430,8 @@  static struct card_info zoran_cards[NUM_CARDS] = {
 		.input_mux = 0,
 		.init = &dc10_init,
 	}, {
-		.type = DC30plus,
-		.name = "DC30plus",
+		.type = DC30_PLUS,
+		.name = "DC30_PLUS",
 		.i2c_decoder = "vpx3220a",
 		.addrs_decoder = vpx3220_addrs,
 		.i2c_encoder = "adv7175",
@@ -694,7 +694,7 @@  int zoran_check_jpg_settings(struct zoran *zr,
 		break;
 	case 4:
 
-		if (zr->card.type == DC10_new) {
+		if (zr->card.type == DC10_NEW) {
 			pci_dbg(zr->pci_dev, "%s - HDec by 4 is not supported on the DC10\n", __func__);
 			err0++;
 			break;
@@ -715,7 +715,7 @@  int zoran_check_jpg_settings(struct zoran *zr,
 		/* We have to check the data the user has set */
 
 		if (settings->HorDcm != 1 && settings->HorDcm != 2 &&
-		    (zr->card.type == DC10_new || settings->HorDcm != 4)) {
+		    (zr->card.type == DC10_NEW || settings->HorDcm != 4)) {
 			settings->HorDcm = clamp(settings->HorDcm, 1, 2);
 			err0++;
 		}