Skip to contentSkip to conversation

Staging: qlge: Add blank line after variable declarations.

PATCH In review Sam Muhammed 2 participants 6 messages Mar 18, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: qlge: Add blank line after variable declarations.

Cleanup checkpatch.pl WARNING: Missing a blank line after declarations.

---
 drivers/staging/qlge/qlge_dbg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/qlge/qlge_dbg.c +7 -1
index 737d6abd8076..8bf592812518 100644
@@ -496,7 +496,9 @@ static int ql_get_mpi_shadow_regs(struct ql_adapter *qdev, u32 *buf)
 static int ql_get_mpi_regs(struct ql_adapter *qdev, u32 *buf,
 			   u32 offset, u32 count)
 {
-	int i, status = 0;
+	int i;
+	int status = 0;
+
 	for (i = 0; i < count; i++, buf++) {
 		status = ql_read_mpi_reg(qdev, offset + i, buf);
 		if (status)
@@ -1330,6 +1332,7 @@ static void ql_dump_intr_states(struct ql_adapter *qdev)
 {
 	int i;
 	u32 value;
+
 	for (i = 0; i < qdev->intr_count; i++) {
 		ql_write32(qdev, INTR_EN, qdev->intr_context[i].intr_read_mask);
 		value = ql_read32(qdev, INTR_EN);
@@ -1415,6 +1418,7 @@ void ql_dump_routing_entries(struct ql_adapter *qdev)
 {
 	int i;
 	u32 value;
+
 	i = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
 	if (i)
 		return;
@@ -1565,6 +1569,7 @@ void ql_dump_stat(struct ql_adapter *qdev)
 void ql_dump_qdev(struct ql_adapter *qdev)
 {
 	int i;
+
 	DUMP_QDEV_FIELD(qdev, "%lx", flags);
 	DUMP_QDEV_FIELD(qdev, "%p", vlgrp);
 	DUMP_QDEV_FIELD(qdev, "%p", pdev);
@@ -1650,6 +1655,7 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
 void ql_dump_ricb(struct ricb *ricb)
 {
 	int i;
+
 	pr_err("===================== Dumping ricb ===============\n");
 	pr_err("Dumping ricb stuff...\n");
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 12 lines · Sam Muhammed

Cleanup checkpatch.pl WARNING: Missing a blank line after declarations.

---
 drivers/staging/qlge/qlge_dbg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/qlge/qlge_dbg.c +0 -0
index 737d6abd8076..8bf592812518 100644

drivers/staging/qlge/qlge_dbg.c static int ql_get_mpi_shadow_regs(struct ql_adapter *qdev, u32 *buf) · line 501

Quoted 7 lines
drivers/staging/qlge/qlge_dbg.c +3 -1
@@ -496,7 +496,9 @@ static int ql_get_mpi_shadow_regs(struct ql_adapter *qdev, u32 *buf)
 static int ql_get_mpi_regs(struct ql_adapter *qdev, u32 *buf,
 			   u32 offset, u32 count)
 {
-	int i, status = 0;
+	int i;
+	int status = 0;
+

This does more than add a blank line.

Actually, it's fine to declare several variables at once.

julia

Quoted 43 lines
drivers/staging/qlge/qlge_dbg.c +4 -1
 	for (i = 0; i < count; i++, buf++) {
 		status = ql_read_mpi_reg(qdev, offset + i, buf);
 		if (status)
@@ -1330,6 +1332,7 @@ static void ql_dump_intr_states(struct ql_adapter *qdev)
 {
 	int i;
 	u32 value;
+
 	for (i = 0; i < qdev->intr_count; i++) {
 		ql_write32(qdev, INTR_EN, qdev->intr_context[i].intr_read_mask);
 		value = ql_read32(qdev, INTR_EN);
@@ -1415,6 +1418,7 @@ void ql_dump_routing_entries(struct ql_adapter *qdev)
 {
 	int i;
 	u32 value;
+
 	i = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
 	if (i)
 		return;
@@ -1565,6 +1569,7 @@ void ql_dump_stat(struct ql_adapter *qdev)
 void ql_dump_qdev(struct ql_adapter *qdev)
 {
 	int i;
+
 	DUMP_QDEV_FIELD(qdev, "%lx", flags);
 	DUMP_QDEV_FIELD(qdev, "%p", vlgrp);
 	DUMP_QDEV_FIELD(qdev, "%p", pdev);
@@ -1650,6 +1655,7 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
 void ql_dump_ricb(struct ricb *ricb)
 {
 	int i;
+
 	pr_err("===================== Dumping ricb ===============\n");
 	pr_err("Dumping ricb stuff...\n");
 
--

2.20.1

--
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/20200318170713.3886-1-jane.pnx9%40gmail.com.

#2 lore raw

-----Original Message-----
From: Julia Lawall <[email protected]>
To: Sam Muhammed <[email protected]>
Cc: [email protected], Manish Chopra < [email protected]>, [email protected], Greg Kroah-Hartman <[email protected]>
Subject: Re: [Outreachy kernel] [PATCH] Staging: qlge: Add blank line after variable declarations.
Date: Wed, 18 Mar 2020 18:10:17 +0100 (CET)

Quoted 14 lines · Sam Muhammed

Cleanup checkpatch.pl WARNING: Missing a blank line after declarations.

---
 drivers/staging/qlge/qlge_dbg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/qlge/qlge_dbg.c +0 -0
index 737d6abd8076..8bf592812518 100644

drivers/staging/qlge/qlge_dbg.c static int ql_get_mpi_shadow_regs(struct · line 502

Quoted 8 lines
drivers/staging/qlge/qlge_dbg.c +3 -1
@@ -496,7 +496,9 @@ static int ql_get_mpi_shadow_regs(struct
 ql_adapter *qdev, u32 *buf)
 static int ql_get_mpi_regs(struct ql_adapter *qdev, u32 *buf,
 			   u32 offset, u32 count)
 {
-	int i, status = 0;
+	int i;
+	int status = 0;
+

This does more than add a blank line.

Actually, it's fine to declare several variables at once.

julia

Quoted 41 lines
drivers/staging/qlge/qlge_dbg.c +0 -0
 	for (i = 0; i < count; i++, buf++) {
 		status = ql_read_mpi_reg(qdev, offset + i, buf);
drivers/staging/qlge/qlge_dbg.c +1 -0
 		if (status)
@@ -1330,6 +1332,7 @@ static void ql_dump_intr_states(struct
 ql_adapter *qdev)
 {
 	int i;
 	u32 value;
+
 	for (i = 0; i < qdev->intr_count; i++) {
 		ql_write32(qdev, INTR_EN, qdev-
Quoted 1 line

intr_context[i].intr_read_mask);

drivers/staging/qlge/qlge_dbg.c +1 -0
 		value = ql_read32(qdev, INTR_EN);
@@ -1415,6 +1418,7 @@ void ql_dump_routing_entries(struct ql_adapter
 *qdev)
 {
 	int i;
 	u32 value;
+
 	i = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
 	if (i)
drivers/staging/qlge/qlge_dbg.c +2 -1
 		return;
@@ -1565,6 +1569,7 @@ void ql_dump_stat(struct ql_adapter *qdev)
 void ql_dump_qdev(struct ql_adapter *qdev)
 {
 	int i;
+
 	DUMP_QDEV_FIELD(qdev, "%lx", flags);
 	DUMP_QDEV_FIELD(qdev, "%p", vlgrp);
 	DUMP_QDEV_FIELD(qdev, "%p", pdev);
@@ -1650,6 +1655,7 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
 void ql_dump_ricb(struct ricb *ricb)
 {
 	int i;
+
 	pr_err("===================== Dumping ricb ===============\n");
 	pr_err("Dumping ricb stuff...\n");
 
--

2.20.1

Quoted 9 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/20200318170713.3886-1-jane.pnx9%40gmail.com
.

By this i maintaned the developer's style; declaring more than one variable was okay, but that was the only occurrence of declaring more than one variable and assigning a value to one of them in the same line.

This is an instance where two variables of the same type declared in different lines since one of them was assigned a value:

	int status = 0;
	int i;

	for (i = PAUSE_SRC_LO; i < XGMAC_REGISTER_END; i += 4, buf++) {
		/* We're reading 400 xgmac registers, but we filter out
		 * several locations that are non-responsive to reads.
		 */

plus a TODO note to fix checkpatch issues; i choose it as a starter. :)

Sam

#3 lore raw

I am afraid my reply wasn't inline :(

Sam

⁣Get BlueMail for Android ​

Quoted 114 lines · Sam Muhammed

-----Original Message-----
From: Julia Lawall <[email protected]>
To: Sam Muhammed <[email protected]>
Cc: [email protected], Manish Chopra < [email protected]>, [email protected], Greg Kroah-Hartman <[email protected]>
Subject: Re: [Outreachy kernel] [PATCH] Staging: qlge: Add blank line after variable declarations.
Date: Wed, 18 Mar 2020 18:10:17 +0100 (CET)

Quoted 14 lines · Sam Muhammed

Cleanup checkpatch.pl WARNING: Missing a blank line after declarations.

---
 drivers/staging/qlge/qlge_dbg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/qlge/qlge_dbg.c +0 -0
index 737d6abd8076..8bf592812518 100644

drivers/staging/qlge/qlge_dbg.c static int ql_get_mpi_shadow_regs(struct · line 502

Quoted 8 lines
drivers/staging/qlge/qlge_dbg.c +3 -1
@@ -496,7 +496,9 @@ static int ql_get_mpi_shadow_regs(struct
 ql_adapter *qdev, u32 *buf)
 static int ql_get_mpi_regs(struct ql_adapter *qdev, u32 *buf,
 			   u32 offset, u32 count)
 {
-	int i, status = 0;
+	int i;
+	int status = 0;
+

This does more than add a blank line.

Actually, it's fine to declare several variables at once.

julia

Quoted 41 lines
drivers/staging/qlge/qlge_dbg.c +0 -0
 	for (i = 0; i < count; i++, buf++) {
 		status = ql_read_mpi_reg(qdev, offset + i, buf);
drivers/staging/qlge/qlge_dbg.c +1 -0
 		if (status)
@@ -1330,6 +1332,7 @@ static void ql_dump_intr_states(struct
 ql_adapter *qdev)
 {
 	int i;
 	u32 value;
+
 	for (i = 0; i < qdev->intr_count; i++) {
 		ql_write32(qdev, INTR_EN, qdev-
Quoted 1 line

intr_context[i].intr_read_mask);

drivers/staging/qlge/qlge_dbg.c +1 -0
 		value = ql_read32(qdev, INTR_EN);
@@ -1415,6 +1418,7 @@ void ql_dump_routing_entries(struct ql_adapter
 *qdev)
 {
 	int i;
 	u32 value;
+
 	i = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
 	if (i)
drivers/staging/qlge/qlge_dbg.c +2 -1
 		return;
@@ -1565,6 +1569,7 @@ void ql_dump_stat(struct ql_adapter *qdev)
 void ql_dump_qdev(struct ql_adapter *qdev)
 {
 	int i;
+
 	DUMP_QDEV_FIELD(qdev, "%lx", flags);
 	DUMP_QDEV_FIELD(qdev, "%p", vlgrp);
 	DUMP_QDEV_FIELD(qdev, "%p", pdev);
@@ -1650,6 +1655,7 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
 void ql_dump_ricb(struct ricb *ricb)
 {
 	int i;
+
 	pr_err("===================== Dumping ricb ===============\n");
 	pr_err("Dumping ricb stuff...\n");
 
--

2.20.1

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/20200318170713.3886-1-jane.pnx9%40gmail.com

Quoted 2 lines

.

By this i maintaned the developer's style; declaring more than one variable was okay, but that was the only occurrence of declaring more than one variable and assigning a value to one of them in the same line.

This is an instance where two variables of the same type declared in different lines since one of them was assigned a value:

	int status = 0;
	int i;

	for (i = PAUSE_SRC_LO; i < XGMAC_REGISTER_END; i += 4, buf++) {
		/* We're reading 400 xgmac registers, but we filter out
		 * several locations that are non-responsive to reads.
		 */

plus a TODO note to fix checkpatch issues; i choose it as a starter. :)

Sam

#4 lore raw
Quoted 93 lines · Sam Muhammad

I am afraid my reply wasn't inline :(

Sam

Get BlueMail for Android
On Mar 18, 2020, at 7:30 PM, Sam Muhammed <[email protected]> wrote:

-----Original Message-----
From: Julia Lawall <[email protected]>
To: Sam Muhammed <[email protected]>
Cc: [email protected], Manish Chopra < [email protected]>, [email protected], Greg Kroah-Hartman <[email protected]>
Subject: Re: [Outreachy kernel] [PATCH] Staging: qlge: Add blank line after variable declarations.
Date: Wed, 18 Mar 2020 18:10:17 +0100 (CET)
On Wed, 18 Mar 2020, Sam Muhammed wrote:
Cleanup checkpatch.pl WARNING: Missing a blank line after declarations.

---

  drivers/staging/qlge/qlge_dbg.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
index 737d6abd8076..8bf592812518 100644
--- a/drivers/staging/qlge/qlge_dbg.c
+++ b/drivers/staging/qlge/qlge_dbg.c
@@ -496,7 +496,9 @@ static int ql_get_mpi_shadow_regs(struct ql_adapter *qdev, u32 *buf)
static int ql_get_mpi_regs(struct ql_adapter *qdev, u32 *buf,

        u32 offset, u32 count)

{
- int i, status = 0;
+ int i;
+ int status = 0;
+
This does more than add a blank line.
Actually, it's fine to declare several variables at once. julia

   for (i = 0; i < count; i++, buf++) {
    status = ql_read_mpi_reg(qdev, offset + i, buf);
    if (status)
 @@ -1330,6 +1332,7 @@ static void ql_dump_intr_states(struct
 ql_adapter *qdev)
  {
   int i;
   u32 value;
 +
   for (i = 0; i < qdev->intr_count; i++) {
    ql_write32(qdev, INTR_EN, qdev-
intr_context[i].intr_read_mask);
    value = ql_read32(qdev, INTR_EN);
 @@ -1415,6 +1418,7 @@ void ql_dump_routing_entries(struct ql_adapter
 *qdev)
  {
   int i;
   u32 value;
 +
   i = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
   if (i)
    return;
 @@ -1565,6 +1569,7 @@ void ql_dump_stat(struct ql_adapter *qdev)
  void ql_dump_qdev(struct ql_adapter *qdev)
  {
   int i;
 +
   DUMP_QDEV_FIELD(qdev, "%lx", flags);
   DUMP_QDEV_FIELD(qdev, "%p", vlgrp);
   DUMP_QDEV_FIELD(qdev, "%p", pdev);
 @@ -1650,6 +1655,7 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
  void ql_dump_ricb(struct ricb *ricb)
  {
   int i;
 +
   pr_err("===================== Dumping ricb ===============\n");
   pr_err("Dumping ricb stuff...\n");

--
2.20.1

--
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/20200318170713.3886-1-ja
ne.pnx9%40gmail.com
.

Quoted 4 lines

By this i maintaned the developer's style; declaring more than one variable was okay, but that was the only occurrence of declaring more than one variable and assigning a value to one of them in the same line.

OK, if the rest of the code seems to have a strong preference for declaring only one variable at a time, I guess that is OK. But the main problem is that a patch should only do one thing at a time. So a patch about adding blank lines after declarations should not also rearrange the declarations. If you want to submit both changes, you can send a series. But it could be better to do just one thing to start with.

While it is good to not be top posting, it would be better to put your reply next to the text it refers to, rather than completely at the bottom of the message.

julia

Quoted 13 lines

This is an instance where two variables of the same type declared in different lines since one of them was assigned a value:
int status = 0;
int i;
for (i = PAUSE_SRC_LO; i < XGMAC_REGISTER_END; i += 4, buf++) {
/* We're reading 400 xgmac registers, but we filter out
* several locations that are non-responsive to reads.
*/
plus a TODO note to fix checkpatch issues; i choose it as a starter. :) Sam

#5 lore raw
Quoted 102 lines · Julia Lawall
Quoted 93 lines · Sam Muhammad

I am afraid my reply wasn't inline :(

Sam

Get BlueMail for Android
On Mar 18, 2020, at 7:30 PM, Sam Muhammed <[email protected]> wrote:

-----Original Message-----
From: Julia Lawall <[email protected]>
To: Sam Muhammed <[email protected]>
Cc: [email protected], Manish Chopra < [email protected]>, [email protected], Greg Kroah-Hartman <[email protected]>
Subject: Re: [Outreachy kernel] [PATCH] Staging: qlge: Add blank line after variable declarations.
Date: Wed, 18 Mar 2020 18:10:17 +0100 (CET)
On Wed, 18 Mar 2020, Sam Muhammed wrote:
Cleanup checkpatch.pl WARNING: Missing a blank line after declarations.

---

  drivers/staging/qlge/qlge_dbg.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
index 737d6abd8076..8bf592812518 100644
--- a/drivers/staging/qlge/qlge_dbg.c
+++ b/drivers/staging/qlge/qlge_dbg.c
@@ -496,7 +496,9 @@ static int ql_get_mpi_shadow_regs(struct ql_adapter *qdev, u32 *buf)
static int ql_get_mpi_regs(struct ql_adapter *qdev, u32 *buf,

        u32 offset, u32 count)

{
- int i, status = 0;
+ int i;
+ int status = 0;
+
This does more than add a blank line.
Actually, it's fine to declare several variables at once. julia

   for (i = 0; i < count; i++, buf++) {
    status = ql_read_mpi_reg(qdev, offset + i, buf);
    if (status)
 @@ -1330,6 +1332,7 @@ static void ql_dump_intr_states(struct
 ql_adapter *qdev)
  {
   int i;
   u32 value;
 +
   for (i = 0; i < qdev->intr_count; i++) {
    ql_write32(qdev, INTR_EN, qdev-
intr_context[i].intr_read_mask);
    value = ql_read32(qdev, INTR_EN);
 @@ -1415,6 +1418,7 @@ void ql_dump_routing_entries(struct ql_adapter
 *qdev)
  {
   int i;
   u32 value;
 +
   i = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
   if (i)
    return;
 @@ -1565,6 +1569,7 @@ void ql_dump_stat(struct ql_adapter *qdev)
  void ql_dump_qdev(struct ql_adapter *qdev)
  {
   int i;
 +
   DUMP_QDEV_FIELD(qdev, "%lx", flags);
   DUMP_QDEV_FIELD(qdev, "%p", vlgrp);
   DUMP_QDEV_FIELD(qdev, "%p", pdev);
 @@ -1650,6 +1655,7 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
  void ql_dump_ricb(struct ricb *ricb)
  {
   int i;
 +
   pr_err("===================== Dumping ricb ===============\n");
   pr_err("Dumping ricb stuff...\n");

--
2.20.1

--
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/20200318170713.3886-1-ja
ne.pnx9%40gmail.com
.

Quoted 4 lines

By this i maintaned the developer's style; declaring more than one variable was okay, but that was the only occurrence of declaring more than one variable and assigning a value to one of them in the same line.

Quoted 6 lines

OK, if the rest of the code seems to have a strong preference for declaring only one variable at a time, I guess that is OK. But the main problem is that a patch should only do one thing at a time. So a patch about adding blank lines after declarations should not also rearrange the declarations. If you want to submit both changes, you can send a series. But it could be better to do just one thing to start with.

Great, Thank You.

Sam

Quoted 20 lines

While it is good to not be top posting, it would be better to put your reply next to the text it refers to, rather than completely at the bottom of the message.

julia

Quoted 13 lines

This is an instance where two variables of the same type declared in different lines since one of them was assigned a value:
int status = 0;
int i;
for (i = PAUSE_SRC_LO; i < XGMAC_REGISTER_END; i += 4, buf++) {
/* We're reading 400 xgmac registers, but we filter out
* several locations that are non-responsive to reads.
*/
plus a TODO note to fix checkpatch issues; i choose it as a starter. :) Sam