Skip to contentSkip to conversation

staging: vt6655: Fix line wrapping in `RFvWriteWakeProgSyn`

PATCH Superseded Karolina Drobnik 5 participants 22 messages Oct 28, 2021 – Nov 4, 2021 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover staging: vt6655: Fix line wrapping in `RFvWriteWakeProgSyn`

This patch set is a series of small refactorings of the function RFvWriteWakeProgSyn, now renamed to rf_write_wake_prog_syn. The work here allowed to shorten lines marked by checkpatch.pl as being too long by:
* introducing two new temporary variables (idx and data)
* rewriting a conditional to switch between two modes of AL7320 initialization.

In addition to this, the patch set renames the function to align it with the kernel coding style and updates the function description.

Karolina Drobnik (7):
staging: vt6655: Introduce idx temporary variable
staging: vt6655: Use incrementation in idx
staging: vt6655: Remove unused i increments
staging: vt6655: Introduce data temporary variable
staging: vt6655: Rewrite conditional in AL7320 initialization
staging: vt6655: Rename RFvWriteWakeProgSyn function
staging: vt6655: Update comment for rf_write_wake_prog_syn

 drivers/staging/vt6655/channel.c |  2 +-
 drivers/staging/vt6655/rf.c      | 41 +++++++++++++++-----------------
 drivers/staging/vt6655/rf.h      |  2 +-
 3 files changed, 21 insertions(+), 24 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/7 staging: vt6655: Introduce `idx` temporary variable

Add a local variable to store MISCFIFO_SYNDATA_IDX offset. This change helps in shortening the lines in rf.c that are deemed too long by checkpatch.pl.

---
 drivers/staging/vt6655/rf.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/staging/vt6655/rf.c +9 -8
index bc4abe77db7b..f195dafb6e63 100644
@@ -681,6 +681,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 {
 	void __iomem *iobase = priv->port_offset;
 	int i;
+	unsigned short idx = MISCFIFO_SYNDATA_IDX;
 	unsigned char init_count = 0;
 	unsigned char sleep_count = 0;
 
@@ -699,11 +700,11 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 			return false;
 
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al2230_init_table[i]);
+			MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_init_table[i]);
 
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al2230_channel_table0[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al2230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table1[channel - 1]);
 		break;
 
 		/* Need to check, PLLON need to be low for channel setting */
@@ -716,17 +717,17 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 
 		if (channel <= CB_MAX_CHANNEL_24G) {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_init_table[i]);
+				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table[i]);
 		} else {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_init_table_a_mode[i]);
+				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table_a_mode[i]);
 		}
 
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_channel_table0[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table1[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_channel_table2[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table2[channel - 1]);
 		break;
 
 	case RF_NOTHING:
Signature · 1 line
2.30.2
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/7] staging: vt6655: Introduce `idx` temporary variable

Quoted 14 lines · Karolina Drobnik

Add a local variable to store MISCFIFO_SYNDATA_IDX offset. This change helps in shortening the lines in rf.c that are deemed too long by checkpatch.pl.

---
 drivers/staging/vt6655/rf.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/staging/vt6655/rf.c +0 -0
index bc4abe77db7b..f195dafb6e63 100644

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 683

Quoted 3 lines
drivers/staging/vt6655/rf.c +0 -0
@@ -681,6 +681,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 {
 	void __iomem *iobase = priv->port_offset;
 	int i;

Why not to make *i* as unsigned short and get rid of all the type conversions below ?

Quoted 33 lines
drivers/staging/vt6655/rf.c +6 -6
+	unsigned short idx = MISCFIFO_SYNDATA_IDX;
 	unsigned char init_count = 0;
 	unsigned char sleep_count = 0;
 
@@ -699,11 +700,11 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 			return false;
 
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al2230_init_table[i]);
+			MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_init_table[i]);
 
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al2230_channel_table0[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al2230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table1[channel - 1]);
 		break;
 
 		/* Need to check, PLLON need to be low for channel setting */
@@ -716,17 +717,17 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 
 		if (channel <= CB_MAX_CHANNEL_24G) {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_init_table[i]);
+				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table[i]);
 		} else {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_init_table_a_mode[i]);
+				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table_a_mode[i]);
 		}
 
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_channel_table0[channel - 1]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 733

Quoted 10 lines
drivers/staging/vt6655/rf.c +3 -2
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table1[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + i), al7230_channel_table2[channel - 1]);
+		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table2[channel - 1]);
 		break;
 
 	case RF_NOTHING:

Regards,

~Praveen.

#3 lore raw

Re: [PATCH 1/7] staging: vt6655: Introduce `idx` temporary variable

In reply to Karolina Drobnik
Quoted 4 lines · Karolina Drobnik

Add a local variable to store MISCFIFO_SYNDATA_IDX offset. This change helps in shortening the lines in rf.c that are deemed too long by checkpatch.pl.

No, this just makes the code harder to read. Don't introduce a local variable which only holds a global constant. Variables should be variable and constants should be constants. No one wants to have to look up things for no reason.

regards,
dan carpenter

#4 lore raw

PATCH 2/7 staging: vt6655: Use incrementation in `idx`

In reply to Karolina Drobnik

Increment idx in a loop instead of adding the loop counter i to do so. Thanks to this change, the cast to unsigned short can be removed.

---
 drivers/staging/vt6655/rf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/vt6655/rf.c +8 -8
index f195dafb6e63..c07653566d17 100644
@@ -700,11 +700,11 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 			return false;
 
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_init_table[i]);
+			MACvSetMISCFifo(priv, idx++, al2230_init_table[i]);
 
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table0[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al2230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al2230_channel_table1[channel - 1]);
 		break;
 
 		/* Need to check, PLLON need to be low for channel setting */
@@ -717,17 +717,17 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 
 		if (channel <= CB_MAX_CHANNEL_24G) {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table[i]);
+				MACvSetMISCFifo(priv, idx++, al7230_init_table[i]);
 		} else {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table_a_mode[i]);
+				MACvSetMISCFifo(priv, idx++, al7230_init_table_a_mode[i]);
 		}
 
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table0[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table1[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table2[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table2[channel - 1]);
 		break;
 
 	case RF_NOTHING:
Signature · 1 line
2.30.2
#5 lore raw

Re: [Outreachy kernel] [PATCH 2/7] staging: vt6655: Use incrementation in `idx`

Quoted 30 lines · Karolina Drobnik

Increment idx in a loop instead of adding the loop counter i to do so. Thanks to this change, the cast to unsigned short can be removed.

---
 drivers/staging/vt6655/rf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/vt6655/rf.c +3 -3
index f195dafb6e63..c07653566d17 100644
@@ -700,11 +700,11 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 			return false;
 
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_init_table[i]);
+			MACvSetMISCFifo(priv, idx++, al2230_init_table[i]);
 
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table0[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al2230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al2230_channel_table1[channel - 1]);
 		break;
 
 		/* Need to check, PLLON need to be low for channel setting */

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 720

Quoted 5 lines
drivers/staging/vt6655/rf.c +1 -1
@@ -717,17 +717,17 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 
 		if (channel <= CB_MAX_CHANNEL_24G) {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table[i]);
+				MACvSetMISCFifo(priv, idx++, al7230_init_table[i]);

If I'm not wrong, there is a problem here, we are using the modified idx value here, instead of original which is *MISCFIFO_SYNDATA_IDX*. I don't see idx value being reset either. Am I missing something ?

Further, this bring a question, how are you validating or planning to validate these changes ?

Quoted 8 lines
drivers/staging/vt6655/rf.c +1 -2
 		} else {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table_a_mode[i]);
+				MACvSetMISCFifo(priv, idx++, al7230_init_table_a_mode[i]);
 		}
 
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table0[channel - 1]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 733

Quoted 10 lines
drivers/staging/vt6655/rf.c +3 -2
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table1[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table2[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table2[channel - 1]);
 		break;
 
 	case RF_NOTHING:

Regards,

~Praveen.

#6 lore raw

Re: [Outreachy kernel] [PATCH 2/7] staging: vt6655: Use incrementation in `idx`

Quoted 32 lines · Praveen Kumar
Quoted 31 lines · Karolina Drobnik

Increment idx in a loop instead of adding the loop counter i to do so. Thanks to this change, the cast to unsigned short can be removed.

---
 drivers/staging/vt6655/rf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/vt6655/rf.c +3 -3
index f195dafb6e63..c07653566d17 100644
@@ -700,11 +700,11 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 			return false;
 
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_init_table[i]);
+			MACvSetMISCFifo(priv, idx++, al2230_init_table[i]);
 
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table0[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al2230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al2230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al2230_channel_table1[channel - 1]);
 		break;
 
 		/* Need to check, PLLON need to be low for channel setting */
@@ -717,17 +717,17 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 
Quoted 8 lines

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 720

Quoted 4 lines
drivers/staging/vt6655/rf.c +1 -1
 		if (channel <= CB_MAX_CHANNEL_24G) {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table[i]);
+				MACvSetMISCFifo(priv, idx++, al7230_init_table[i]);

If I'm not wrong, there is a problem here, we are using the modified idx value here, instead of original which is *MISCFIFO_SYNDATA_IDX*. I don't see idx value being reset either. Am I missing something ?

Looks like I missed, the case statement, thus, idx will be intact. Please ignore my previous comment.

However, as mentioned in previous patch, we can also make *i* as unsigned short and that should IMO remove the requirement of cast. But again, this works as well. I'm fine with either. Thanks and sorry for the confusion.

Quoted 18 lines

Further, this bring a question, how are you validating or planning to validate these changes ?

Quoted 16 lines
drivers/staging/vt6655/rf.c +4 -4
 		} else {
 			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_init_table_a_mode[i]);
+				MACvSetMISCFifo(priv, idx++, al7230_init_table_a_mode[i]);
 		}
 
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table0[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table0[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table1[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table1[channel - 1]);
 		i++;
-		MACvSetMISCFifo(priv, (unsigned short)(idx + i), al7230_channel_table2[channel - 1]);
+		MACvSetMISCFifo(priv, idx++, al7230_channel_table2[channel - 1]);
 		break;
 
Quoted 2 lines

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 733

Quoted 2 lines
drivers/staging/vt6655/rf.c +0 -0
 	case RF_NOTHING:

Regards,

~Praveen.

#7 lore raw

Re: [Outreachy kernel] [PATCH 2/7] staging: vt6655: Use incrementation in `idx`

Hi Praveen,

Quoted 2 lines · Praveen Kumar

However, as mentioned in previous patch, we can also make *i* as unsigned short and that should IMO remove the requirement of cast.

I agree, it should remove the cast but I think I'll leave idx as it is.

Quoted 2 lines

But again, this works as well. I'm fine with either. Thanks and sorry for the confusion.

No worries, thanks for looking at my changes. It's good to double check everything :)

Thanks,
Karolina

#8 lore raw

PATCH 3/7 staging: vt6655: Remove unused `i` increments

In reply to Karolina Drobnik

Commit c569952d92ba ("staging: vt6655: Use incrementation in idx") rendered the incrementation of i outside of the loop unnecessary so it can be deleted.

---
 drivers/staging/vt6655/rf.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/vt6655/rf.c +0 -3
index c07653566d17..ea74701917e5 100644
@@ -703,7 +703,6 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 			MACvSetMISCFifo(priv, idx++, al2230_init_table[i]);
 
 		MACvSetMISCFifo(priv, idx++, al2230_channel_table0[channel - 1]);
-		i++;
 		MACvSetMISCFifo(priv, idx++, al2230_channel_table1[channel - 1]);
 		break;
 
@@ -724,9 +723,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 		}
 
 		MACvSetMISCFifo(priv, idx++, al7230_channel_table0[channel - 1]);
-		i++;
 		MACvSetMISCFifo(priv, idx++, al7230_channel_table1[channel - 1]);
-		i++;
 		MACvSetMISCFifo(priv, idx++, al7230_channel_table2[channel - 1]);
 		break;
 
Signature · 1 line
2.30.2
#9 lore raw

PATCH 4/7 staging: vt6655: Introduce `data` temporary variable

In reply to Karolina Drobnik

Add a variable to store initialization tables. Use this variable in AL2230 initialization.

---
 drivers/staging/vt6655/rf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/vt6655/rf.c +3 -1
index ea74701917e5..afd202ea3356 100644
@@ -684,6 +684,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 	unsigned short idx = MISCFIFO_SYNDATA_IDX;
 	unsigned char init_count = 0;
 	unsigned char sleep_count = 0;
+	const unsigned long *data;
 
 	VNSvOutPortW(iobase + MAC_REG_MISCFFNDEX, 0);
 	switch (rf_type) {
@@ -699,8 +700,9 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 		if (init_count > (MISCFIFO_SYNDATASIZE - sleep_count))
 			return false;
 
+		data = al2230_init_table;
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, idx++, al2230_init_table[i]);
+			MACvSetMISCFifo(priv, idx++, *(data++));
 
 		MACvSetMISCFifo(priv, idx++, al2230_channel_table0[channel - 1]);
 		MACvSetMISCFifo(priv, idx++, al2230_channel_table1[channel - 1]);
Signature · 1 line
2.30.2
#10 lore raw

Re: [Outreachy kernel] [PATCH 4/7] staging: vt6655: Introduce `data` temporary variable

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv,

Quoted 13 lines · CEST Karolina Drobnik

Add a variable to store initialization tables. Use this variable in AL2230 initialization.

---
 drivers/staging/vt6655/rf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/vt6655/rf.c +0 -0
index ea74701917e5..afd202ea3356 100644
@@ -684,6 +684,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, 

unsigned char rf_type,

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv,

Quoted 8 lines
drivers/staging/vt6655/rf.c +1 -0
 	unsigned short idx = MISCFIFO_SYNDATA_IDX;
 	unsigned char init_count = 0;
 	unsigned char sleep_count = 0;
+	const unsigned long *data;
 
 	VNSvOutPortW(iobase + MAC_REG_MISCFFNDEX, 0);
 	switch (rf_type) {
@@ -699,8 +700,9 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, 

unsigned char rf_type,

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 6 lines
drivers/staging/vt6655/rf.c +1 -1
 		if (init_count > (MISCFIFO_SYNDATASIZE - sleep_count))
 			return false;
 
+		data = al2230_init_table;
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, idx++, 

al2230_init_table[i]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 705

Quoted 1 line
drivers/staging/vt6655/rf.c +1 -0
+			MACvSetMISCFifo(priv, idx++, *(data++));

Hi Karolina,

I think you are using redundant parentheses in "* (data ++)" but understand that those increments and dereferences are equivalent to "* data ++" (according to the C precedence rules).

Some time ago I suggested that you use those redundant parentheses because Greg Kroah-Hartman had previously explained that he prefers not to see "*foo++" because maintainers and reviewers are not required to remember the C precedence rules.

I hope my suggestion isn't based on a misunderstanding of what Greg wants here and that your patch can be accepted as is.

While we are at it, please notice that Maintainers of different subsystems may see this topic from a different point of view and that they might very well ask you for removing those redundant parentheses.

I'd suggest to use grep and find out what is preferred in other subsystems, when you want to contribute to other parts of Linux.

Thanks,

Fabio

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 706

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++, 

al2230_channel_table0[channel - 1]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 707

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++, 

al2230_channel_table1[channel - 1]);

Quoted 5 lines
Signature · 4 lines
2.30.2

-- 
You received this message because you are subscribed to the Google Groups 

"outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send an

email to [email protected].

Quoted 1 line

To view this discussion on the web visit https://groups.google.com/d/msgid/

outreachy-kernel/dc72a4c3539aed70569f66396ed3b51818bc2aea. 1635415820.git.karolinadrobnik%40gmail.com.

Quoted 1 line
#11 lore raw

Re: [Outreachy kernel] [PATCH 4/7] staging: vt6655: Introduce `data` temporary variable

Quoted 47 lines · Fabio M. De Francesco

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv,

Quoted 13 lines · CEST Karolina Drobnik

Add a variable to store initialization tables. Use this variable in AL2230 initialization.

---
 drivers/staging/vt6655/rf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/vt6655/rf.c +0 -0
index ea74701917e5..afd202ea3356 100644
@@ -684,6 +684,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv,

unsigned char rf_type,

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv,

Quoted 8 lines
drivers/staging/vt6655/rf.c +1 -0
 	unsigned short idx = MISCFIFO_SYNDATA_IDX;
 	unsigned char init_count = 0;
 	unsigned char sleep_count = 0;
+	const unsigned long *data;
 
 	VNSvOutPortW(iobase + MAC_REG_MISCFFNDEX, 0);
 	switch (rf_type) {
@@ -699,8 +700,9 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv,

unsigned char rf_type,

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 6 lines
drivers/staging/vt6655/rf.c +1 -1
 		if (init_count > (MISCFIFO_SYNDATASIZE - sleep_count))
 			return false;
 
+		data = al2230_init_table;
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, idx++,

al2230_init_table[i]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 705

Quoted 1 line
drivers/staging/vt6655/rf.c +1 -0
+			MACvSetMISCFifo(priv, idx++, *(data++));

Hi Karolina,

I think you are using redundant parentheses in "* (data ++)" but understand that those increments and dereferences are equivalent to "* data ++" (according to the C precedence rules).

Some time ago I suggested that you use those redundant parentheses because Greg Kroah-Hartman had previously explained that he prefers not to see "*foo++" because maintainers and reviewers are not required to remember the C precedence rules.

I hope my suggestion isn't based on a misunderstanding of what Greg wants here and that your patch can be accepted as is.

Quoted 6 lines

While we are at it, please notice that Maintainers of different subsystems may see this topic from a different point of view and that they might very well ask you for removing those redundant parentheses.

I'd suggest to use grep and find out what is preferred in other subsystems, when you want to contribute to other parts of Linux.

Would it be better as data[i] ?

Could there be a better name than "data"? Perhaps "table"?

julia

Quoted 30 lines

Thanks,

Fabio

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 706

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++,

al2230_channel_table0[channel - 1]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 707

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++,

al2230_channel_table1[channel - 1]);

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

2.30.2

--
You received this message because you are subscribed to the Google Groups

"outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send an

email to [email protected].

Quoted 1 line

To view this discussion on the web visit https://groups.google.com/d/msgid/

outreachy-kernel/dc72a4c3539aed70569f66396ed3b51818bc2aea. 1635415820.git.karolinadrobnik%40gmail.com.

Quoted 1 line

--
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/2039159.k92FijXA2m%40localhost.localdomain.

#12 lore raw

Re: [Outreachy kernel] [PATCH 4/7] staging: vt6655: Introduce `data` temporary variable

Quoted 23 lines · CEST Julia Lawall
Quoted 20 lines · Fabio M. De Francesco

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv,

Quoted 13 lines · CEST Karolina Drobnik

Add a variable to store initialization tables. Use this variable in AL2230 initialization.

---
 drivers/staging/vt6655/rf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/vt6655/rf.c +0 -0
index ea74701917e5..afd202ea3356 100644
@@ -684,6 +684,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv,

unsigned char rf_type,

Quoted 5 lines
drivers/staging/vt6655/rf.c +1 -0
 	unsigned short idx = MISCFIFO_SYNDATA_IDX;
 	unsigned char init_count = 0;
 	unsigned char sleep_count = 0;
+	const unsigned long *data;
 
Quoted 5 lines
Quoted 5 lines

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv,

Quoted 3 lines
drivers/staging/vt6655/rf.c +0 -0
 	VNSvOutPortW(iobase + MAC_REG_MISCFFNDEX, 0);
 	switch (rf_type) {
@@ -699,8 +700,9 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv,

unsigned char rf_type,

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		if (init_count > (MISCFIFO_SYNDATASIZE - 

sleep_count))

Quoted 11 lines
Quoted 11 lines

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 5 lines
drivers/staging/vt6655/rf.c +1 -1
 			return false;
 
+		data = al2230_init_table;
 		for (i = 0; i < CB_AL2230_INIT_SEQ; i++)
-			MACvSetMISCFifo(priv, idx++,

al2230_init_table[i]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 705

Quoted 1 line
drivers/staging/vt6655/rf.c +1 -0
+			MACvSetMISCFifo(priv, idx++, *(data++));

Hi Karolina,

I think you are using redundant parentheses in "* (data ++)" but

understand

Quoted 4 lines
Quoted 4 lines

that those increments and dereferences are equivalent to "* data ++" (according to the C precedence rules).

Some time ago I suggested that you use those redundant parentheses

because

Quoted 2 lines
Quoted 2 lines

Greg Kroah-Hartman had previously explained that he prefers not to see "*foo++" because maintainers and reviewers are not required to remember

the C

Quoted 6 lines
Quoted 6 lines

precedence rules.

I hope my suggestion isn't based on a misunderstanding of what Greg wants here and that your patch can be accepted as is.

While we are at it, please notice that Maintainers of different

subsystems

Quoted 1 line
Quoted 1 line

may see this topic from a different point of view and that they might

very

Quoted 3 lines
Quoted 3 lines

well ask you for removing those redundant parentheses.

I'd suggest to use grep and find out what is preferred in other

subsystems,

Quoted 3 lines
Quoted 1 line

when you want to contribute to other parts of Linux.

Would it be better as data[i] ?

In this case, yes for sure. It would be better because we are inside a 'for' loop where the code already as an "i" index.

I didn't notice that we are inside the loop and just looked at that increment and dereference for checking the proper syntax.

Quoted 2 lines

Could there be a better name than "data"? Perhaps "table"?

Again, yes if we look at what "data" has been assigned with.

Thanks,

Fabio

Quoted 18 lines

julia

Quoted 14 lines

Thanks,

Fabio

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 706

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++,

al2230_channel_table0[channel - 1]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 707

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++,

al2230_channel_table1[channel - 1]);

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

2.30.2

--
You received this message because you are subscribed to the Google

Groups

Quoted 2 lines
Quoted 2 lines

"outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an

Quoted 2 lines
Quoted 2 lines

email to [email protected].

Quoted 1 line

To view this discussion on the web visit https://groups.google.com/d/

msgid/

Quoted 9 lines
Quoted 9 lines

outreachy-kernel/dc72a4c3539aed70569f66396ed3b51818bc2aea. 1635415820.git.karolinadrobnik%40gmail.com.

Quoted 1 line

--
You received this message because you are subscribed to the Google Groups

"outreachy-kernel" group.

Quoted 1 line
Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send an

email to [email protected].

Quoted 1 line
Quoted 1 line

To view this discussion on the web visit https://groups.google.com/d/

msgid/outreachy-kernel/2039159.k92FijXA2m%40localhost.localdomain.

Quoted 2 lines
Quoted 1 line
#13 lore raw

Re: [Outreachy kernel] [PATCH 4/7] staging: vt6655: Introduce `data` temporary variable

Hi Fabio and Julia,

Thank you very much for looking at my changes.

Quoted 5 lines · Fabio M. De Francesco

Hi Karolina,

I think you are using redundant parentheses in "* (data ++)" but understand that those increments and dereferences are equivalent to "* data ++" (according to the C precedence rules).

Yes, I added them on purpose to improve readability (+ that's also my preference anyway)

Quoted 4 lines

While we are at it, please notice that Maintainers of different subsystems may see this topic from a different point of view and that they might very well ask you for removing those redundant parentheses.

I understand, thanks for letting me know.

Quoted 3 lines · Julia Lawall

Would it be better as data[i] ?

Could there be a better name than "data"? Perhaps "table"?

Hmm, now when I'm thinking about, it indeed looks like a better option. I would even say that data (or table/init_table) can be only used in the AL7320 case and we can go with al2230_init_table for AL2230. The line would be 61 characters long, way below the limit.

What do you think?

Many thanks,
Karolina

#14 lore raw

Re: [Outreachy kernel] [PATCH 4/7] staging: vt6655: Introduce `data` temporary variable

Quoted 11 lines · Julia Lawall
Quoted 3 lines

Would it be better as data[i] ?

Could there be a better name than "data"? Perhaps "table"?

Hmm, now when I'm thinking about, it indeed looks like a better option. I would even say that data (or table/init_table) can be only used in the AL7320 case and we can go with al2230_init_table for AL2230. The line would be 61 characters long, way below the limit.

What do you think?

That would amount to dropping patch 4? That seems fine. It is better to avoid creating aliases.

julia

#15 lore raw

PATCH 5/7 staging: vt6655: Rewrite conditional in AL7320 initialization

In reply to Karolina Drobnik

Use conditional operator to determine which table for AL7320 initialization should be used. Use data temporary value to store this value.

---
 drivers/staging/vt6655/rf.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/staging/vt6655/rf.c +4 -7
index afd202ea3356..af4eb7eb8e7d 100644
@@ -716,13 +716,10 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
 		if (init_count > (MISCFIFO_SYNDATASIZE - sleep_count))
 			return false;
 
-		if (channel <= CB_MAX_CHANNEL_24G) {
-			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, idx++, al7230_init_table[i]);
-		} else {
-			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, idx++, al7230_init_table_a_mode[i]);
-		}
+		data = (channel <= CB_MAX_CHANNEL_24G) ?
+			al7230_init_table : al7230_init_table_a_mode;
+		for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
+			MACvSetMISCFifo(priv, idx++, *(data++));
 
 		MACvSetMISCFifo(priv, idx++, al7230_channel_table0[channel - 1]);
 		MACvSetMISCFifo(priv, idx++, al7230_channel_table1[channel - 1]);
Signature · 1 line
2.30.2
#16 lore raw

Re: [Outreachy kernel] [PATCH 5/7] staging: vt6655: Rewrite conditional in AL7320 initialization

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv,

Quoted 14 lines · CEST Karolina Drobnik

Use conditional operator to determine which table for AL7320 initialization should be used. Use data temporary value to store this value.

---
 drivers/staging/vt6655/rf.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/staging/vt6655/rf.c +0 -0
index afd202ea3356..af4eb7eb8e7d 100644
@@ -716,13 +716,10 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, 

unsigned char rf_type,

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 6 lines
drivers/staging/vt6655/rf.c +0 -3
 		if (init_count > (MISCFIFO_SYNDATASIZE - sleep_count))
 			return false;
 
-		if (channel <= CB_MAX_CHANNEL_24G) {
-			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, idx++, 

al7230_init_table[i]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 3 lines
drivers/staging/vt6655/rf.c +0 -3
-		} else {
-			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, idx++, 

al7230_init_table_a_mode[i]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 3 lines
drivers/staging/vt6655/rf.c +2 -1
-		}
+		data = (channel <= CB_MAX_CHANNEL_24G) ?
+			al7230_init_table : 

al7230_init_table_a_mode;

As far as I know by reading some Greg K-H's replies to other developers, this "<test> ? <true> : <false>" style is not well accepted here.

I'd prefer to see an explicit "if-else" statement because with that style you sacrifice readability and gain nothing here.

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 722

Quoted 2 lines
drivers/staging/vt6655/rf.c +2 -0
+		for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
+			MACvSetMISCFifo(priv, idx++, *(data++));

Again, as Julia pointed out, "*data++" and "*(data++)" are syntactically correct instructions but are not required here. I'm also pretty sure that, by not reusing that index, you're adding additional unnecessary instructions to the resulting assembly code (unless the compiler is able to optimize it).

"*foo++" and the like are powerful and compact instructions, but you should use them in other, more suitable contexts.

Thanks,

Fabio

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 723

Quoted 2 lines
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++, 

al7230_channel_table0[channel - 1]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 724

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++, 

al7230_channel_table1[channel - 1]);

Quoted 5 lines
Signature · 4 lines
2.30.2

-- 
You received this message because you are subscribed to the Google Groups 

"outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send an

email to [email protected].

Quoted 1 line

To view this discussion on the web visit https://groups.google.com/d/msgid/

outreachy-kernel/ 948406a3e7d23f1cdf866aa4448d9428bdd32512.1635415820.git.karolinadrobnik%40gmail.com.

Quoted 1 line
#17 lore raw

Re: [Outreachy kernel] [PATCH 5/7] staging: vt6655: Rewrite conditional in AL7320 initialization

Quoted 32 lines · Fabio M. De Francesco

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv,

Quoted 14 lines · CEST Karolina Drobnik

Use conditional operator to determine which table for AL7320 initialization should be used. Use data temporary value to store this value.

---
 drivers/staging/vt6655/rf.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/staging/vt6655/rf.c +0 -0
index afd202ea3356..af4eb7eb8e7d 100644
@@ -716,13 +716,10 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv,

unsigned char rf_type,

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 6 lines
drivers/staging/vt6655/rf.c +0 -3
 		if (init_count > (MISCFIFO_SYNDATASIZE - sleep_count))
 			return false;
 
-		if (channel <= CB_MAX_CHANNEL_24G) {
-			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, idx++,

al7230_init_table[i]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 3 lines
drivers/staging/vt6655/rf.c +0 -3
-		} else {
-			for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
-				MACvSetMISCFifo(priv, idx++,

al7230_init_table_a_mode[i]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,

Quoted 3 lines
drivers/staging/vt6655/rf.c +2 -1
-		}
+		data = (channel <= CB_MAX_CHANNEL_24G) ?
+			al7230_init_table :

al7230_init_table_a_mode;

Quoted 5 lines

As far as I know by reading some Greg K-H's replies to other developers, this "<test> ? <true> : <false>" style is not well accepted here.

I'd prefer to see an explicit "if-else" statement because with that style you sacrifice readability and gain nothing here.

Actually, I liked the ?: usage in this case. We are making an alias, and it is one thing or another. One can easily see that the same variable is assigned in both cases.

Othes could have another opinion, though.

julia

Quoted 43 lines

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, · line 722

Quoted 3 lines
drivers/staging/vt6655/rf.c +2 -0
+		for (i = 0; i < CB_AL7230_INIT_SEQ; i++)
+			MACvSetMISCFifo(priv, idx++, *(data++));

Again, as Julia pointed out, "*data++" and "*(data++)" are syntactically correct instructions but are not required here. I'm also pretty sure that, by not reusing that index, you're adding additional unnecessary instructions to the resulting assembly code (unless the compiler is able to optimize it).

"*foo++" and the like are powerful and compact instructions, but you should use them in other, more suitable contexts.

Thanks,

Fabio

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 723

Quoted 2 lines
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++,

al7230_channel_table0[channel - 1]);

drivers/staging/vt6655/rf.c bool RFvWriteWakeProgSyn(struct vnt_private *priv, · line 724

Quoted 1 line
drivers/staging/vt6655/rf.c +0 -0
 		MACvSetMISCFifo(priv, idx++,

al7230_channel_table1[channel - 1]);

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

2.30.2

--
You received this message because you are subscribed to the Google Groups

"outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send an

email to [email protected].

Quoted 1 line

To view this discussion on the web visit https://groups.google.com/d/msgid/

outreachy-kernel/ 948406a3e7d23f1cdf866aa4448d9428bdd32512.1635415820.git.karolinadrobnik%40gmail.com.

Quoted 1 line

--
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/1683328.aCfAWUeHFl%40localhost.localdomain.

#18 lore raw

Re: [Outreachy kernel] [PATCH 5/7] staging: vt6655: Rewrite conditional in AL7320 initialization

Quoted 3 lines · Fabio M. De Francesco

As far as I know by reading some Greg K-H's replies to other developers, this
"<test> ? <true> : <false>" style is not well accepted here.

I thought that the expression is simple enough that it can be written this way. Julia nicely summarised why I think it's a good usage of the conditional operator. Still, there's no problem in changing it to "if- else" statement if that's the preferred option.

Thanks,
Karolina

Quoted 1 line
#19 lore raw

Re: [Outreachy kernel] [PATCH 5/7] staging: vt6655: Rewrite conditional in AL7320 initialization

Quoted 9 lines · CEST Karolina Drobnik
Quoted 3 lines · Fabio M. De Francesco

As far as I know by reading some Greg K-H's replies to other developers, this
"<test> ? <true> : <false>" style is not well accepted here.

I thought that the expression is simple enough that it can be written this way. Julia nicely summarised why I think it's a good usage of the conditional operator. Still, there's no problem in changing it to "if- else" statement if that's the preferred option.

If I were you, I'd leave the patch as-is and wait for Greg review.

I was only reporting some words that I recall I read in some emails of Greg. But it is highly probable that those contexts were a bit different or that the statements were much more complex.

As far as what my personal preference is, I think that you shouldn't care because I'm not one of the maintainers. Above all, even if I were one of the maintainers I'd never prevent developers to use their own style with this kind of statements.

To summarize, you'd better leave the patch as-is.

Thanks,

Fabio

Quoted 6 lines

Thanks,
Karolina

Quoted 1 line
#20 lore raw

PATCH 6/7 staging: vt6655: Rename `RFvWriteWakeProgSyn` function

In reply to Karolina Drobnik

To align with the kernel coding style, remove the type from the function name and do not use CamelCase.

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

---
 drivers/staging/vt6655/channel.c | 2 +-
 drivers/staging/vt6655/rf.c      | 4 ++--
 drivers/staging/vt6655/rf.h      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6655/channel.c +1 -1
index b550a1a0844e..e37c8e35a45b 100644
@@ -189,7 +189,7 @@ bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch)
 
 	/* Init Synthesizer Table */
 	if (priv->bEnablePSMode)
-		RFvWriteWakeProgSyn(priv, priv->byRFType, ch->hw_value);
+		rf_write_wake_prog_syn(priv, priv->byRFType, ch->hw_value);
 
 	bb_software_reset(priv);
 
drivers/staging/vt6655/rf.c +2 -2
index af4eb7eb8e7d..7caac1b44a68 100644
@@ -676,8 +676,8 @@ bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType,
  * Return Value: None.
  *
  */
-bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type,
-			 u16 channel)
+bool rf_write_wake_prog_syn(struct vnt_private *priv, unsigned char rf_type,
+			    u16 channel)
 {
 	void __iomem *iobase = priv->port_offset;
 	int i;
drivers/staging/vt6655/rf.h +1 -1
index 0939937d47a8..9fef81846a9f 100644
@@ -60,7 +60,7 @@
 bool IFRFbWriteEmbedded(struct vnt_private *priv, unsigned long dwData);
 bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType, u16 byChannel);
 bool RFbInit(struct vnt_private *priv);
-bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char rf_type, u16 channel);
+bool rf_write_wake_prog_syn(struct vnt_private *priv, unsigned char rf_type, u16 channel);
 bool RFbSetPower(struct vnt_private *priv, unsigned int rate, u16 uCH);
 bool RFbRawSetPower(struct vnt_private *priv, unsigned char byPwr,
 		    unsigned int rate);
Signature · 1 line
2.30.2
#21 lore raw

PATCH 7/7 staging: vt6655: Update comment for `rf_write_wake_prog_syn`

In reply to Karolina Drobnik

Change the function description to include the actual parameters. Update the comment on the return type.

---
 drivers/staging/vt6655/rf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6655/rf.c +4 -4
index 7caac1b44a68..fb31ec70c019 100644
@@ -669,11 +669,11 @@ bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType,
  *
  * Parameters:
  *  In:
- *      iobase      - I/O base address
- *      channel     - channel number
- *      bySleepCnt  - SleepProgSyn count
+ *      priv        - Device Structure
+ *      rf_type     - RF type
+ *      channel     - Channel number
  *
- * Return Value: None.
+ * Return Value: true if succeeded; false if failed.
  *
  */
 bool rf_write_wake_prog_syn(struct vnt_private *priv, unsigned char rf_type,
Signature · 1 line
2.30.2