Skip to contentSkip to conversation

staging: vt6655: Rename `dwAL2230InitTable` array

PATCH In review Karolina Drobnik 3 participants 5 messages Oct 20, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6655: Rename `dwAL2230InitTable` array

Drop Hungarian notation prefix in dwAL2230InitTable array. Change it to use snake case.

Fix issue detected by checkpatch.pl:
CHECK: Avoid CamelCase: <dwAL2230InitTable>

---
 drivers/staging/vt6655/rf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6655/rf.c +4 -4
index a6f17162d017..6bdacf8fbc27 100644
@@ -33,7 +33,7 @@
 #define SWITCH_CHANNEL_DELAY_AL7230 200 /* us */
 #define AL7230_PWR_IDX_LEN    64
 
-static const unsigned long dwAL2230InitTable[CB_AL2230_INIT_SEQ] = {
+static const unsigned long al2230_init_table[CB_AL2230_INIT_SEQ] = {
 	0x03F79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
 	0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
 	0x01A00200 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
@@ -545,7 +545,7 @@ static bool RFbAL2230Init(struct vnt_private *priv)
 	IFRFbWriteEmbedded(priv, (0x07168700 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW));
 
 	for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
-		ret &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[ii]);
+		ret &= IFRFbWriteEmbedded(priv, al2230_init_table[ii]);
 	MACvTimer0MicroSDelay(priv, 30); /* delay 30 us */
 
 	/* PLL On */
@@ -557,7 +557,7 @@ static bool RFbAL2230Init(struct vnt_private *priv)
 	ret &= IFRFbWriteEmbedded(priv, (0x00780f00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW));
 	MACvTimer0MicroSDelay(priv, 30);/* 30us */
 	ret &= IFRFbWriteEmbedded(priv,
-				  dwAL2230InitTable[CB_AL2230_INIT_SEQ - 1]);
+				  al2230_init_table[CB_AL2230_INIT_SEQ - 1]);
 
 	MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3    |
 							 SOFTPWRCTL_SWPE2    |
@@ -699,7 +699,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char byRFType,
 			return false;
 
 		for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
-			MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230InitTable[ii]);
+			MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), al2230_init_table[ii]);
 
 		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable0[uChannel - 1]);
 		ii++;
Signature · 1 line
2.30.2
#1 lore raw
Quoted 5 lines · Karolina Drobnik

Drop Hungarian notation prefix in dwAL2230InitTable array. Change it to use snake case.

Fix issue detected by checkpatch.pl:
CHECK: Avoid CamelCase: <dwAL2230InitTable>

Seems fine.

trivial suggestion:

drivers/staging/vt6655/rf.c

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0

[]

drivers/staging/vt6655/rf.c line 39

Quoted 9 lines
drivers/staging/vt6655/rf.c +1 -1
@@ -33,7 +33,7 @@
 #define SWITCH_CHANNEL_DELAY_AL7230 200 /* us */
 #define AL7230_PWR_IDX_LEN    64
 
-static const unsigned long dwAL2230InitTable[CB_AL2230_INIT_SEQ] = {
+static const unsigned long al2230_init_table[CB_AL2230_INIT_SEQ] = {
 	0x03F79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
 	0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
 	0x01A00200 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,

In this file there are more than 100 uses of

	(BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW

Maybe add a define for it and substitute the uses for the define.

#2 lore raw
Quoted 16 lines · Joe Perches

trivial suggestion:

drivers/staging/vt6655/rf.c

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0

[]

drivers/staging/vt6655/rf.c line 39

Quoted 9 lines
drivers/staging/vt6655/rf.c +1 -1
@@ -33,7 +33,7 @@
 #define SWITCH_CHANNEL_DELAY_AL7230 200 /* us */
 #define AL7230_PWR_IDX_LEN    64
 
-static const unsigned long dwAL2230InitTable[CB_AL2230_INIT_SEQ] = {
+static const unsigned long al2230_init_table[CB_AL2230_INIT_SEQ] = {
 	0x03F79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
 	0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
 	0x01A00200 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,

In this file there are more than 100 uses of

Quoted 3 lines
	(BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW

Maybe add a define for it and substitute the uses for the define.

Look at the code too.

It looks as if every use of IFRFbWriteEmbedded() has this added to the 2nd argument and that the 2nd argument isn't used anywhere else.

Maybe remove it altogether and add it to IFRFbWriteEmbedded().

And it looks as if the + uses for these should logically be |

Something like:

drivers/staging/vt6655/rf.c +2 -1
index 0dae593c6944f..26803f6f9a27b 100644
@@ -498,7 +498,8 @@ bool IFRFbWriteEmbedded(struct vnt_private *priv, unsigned long dwData)
        unsigned short ww;
        unsigned long dwValue;
 
-       VNSvOutPortD(iobase + MAC_REG_IFREGCTL, dwData);
+       VNSvOutPortD(iobase + MAC_REG_IFREGCTL,
+                    dwData | (BY_AL2230_REG_LEN << 3) | IFREGCTL_REGW);
 
        /* W_MAX_TIMEOUT is the timeout period */
        for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
#3 lore raw
Quoted 37 lines · Joe Perches
Quoted 16 lines · Joe Perches

trivial suggestion:

drivers/staging/vt6655/rf.c

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0

[]

drivers/staging/vt6655/rf.c line 39

Quoted 9 lines
drivers/staging/vt6655/rf.c +1 -1
@@ -33,7 +33,7 @@
 #define SWITCH_CHANNEL_DELAY_AL7230 200 /* us */
 #define AL7230_PWR_IDX_LEN    64
 
-static const unsigned long dwAL2230InitTable[CB_AL2230_INIT_SEQ] = {
+static const unsigned long al2230_init_table[CB_AL2230_INIT_SEQ] = {
 	0x03F79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
 	0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
 	0x01A00200 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,

In this file there are more than 100 uses of

Quoted 3 lines
	(BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW

Maybe add a define for it and substitute the uses for the define.

Look at the code too.

It looks as if every use of IFRFbWriteEmbedded() has this added to the 2nd argument and that the 2nd argument isn't used anywhere else.

Maybe remove it altogether and add it to IFRFbWriteEmbedded().

And it looks as if the + uses for these should logically be |

Something like:

drivers/staging/vt6655/rf.c +0 -0
index 0dae593c6944f..26803f6f9a27b 100644

drivers/staging/vt6655/rf.c bool IFRFbWriteEmbedded(struct vnt_private *priv, unsigned long dwData) · line 505

Quoted 9 lines
drivers/staging/vt6655/rf.c +2 -1
@@ -498,7 +498,8 @@ bool IFRFbWriteEmbedded(struct vnt_private *priv, unsigned long dwData)
        unsigned short ww;
        unsigned long dwValue;
 
-       VNSvOutPortD(iobase + MAC_REG_IFREGCTL, dwData);
+       VNSvOutPortD(iobase + MAC_REG_IFREGCTL,
+                    dwData | (BY_AL2230_REG_LEN << 3) | IFREGCTL_REGW);
 
        /* W_MAX_TIMEOUT is the timeout period */
        for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {

Karolina,

If more than a hundred such changes are necessary, you may find Coccinelle
useful: https://coccinelle.gitlabpages.inria.fr/website/

julia

Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/157ee66fd0e3304c238e7ad8123277892e0d1132.camel%40perches.com.

#4 lore raw
Quoted 7 lines · Joe Perches
Quoted 5 lines · Joe Perches

In this file there are more than 100 uses of

        (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW

Maybe add a define for it and substitute the uses for the define.

Quoted 8 lines

Look at the code too.

It looks as if every use of IFRFbWriteEmbedded() has this added to the 2nd argument and that the 2nd argument isn't used anywhere else.

Maybe remove it altogether and add it to IFRFbWriteEmbedded().

And it looks as if the + uses for these should logically be |

Sounds like a very good idea. I'll add it to my to-do list, thanks :)

Quoted 5 lines · Julia Lawall

Karolina,

If more than a hundred such changes are necessary, you may find Coccinelle
useful: https://coccinelle.gitlabpages.inria.fr/website/

Hmm, I'll check this out, it may come in handy.

Thanks,
Karolina