linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 00/10] net: wan: clean up some code style issues
@ 2021-05-24 14:47 Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 01/10] net: wan: remove redundant blank lines Guangbin Huang
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

This patchset clean up some code style issues.

Peng Li (10):
  net: wan: remove redundant blank lines
  net: wan: fix an code style issue about "foo* bar"
  net: wan: add blank line after declarations
  net: wan: code indent use tabs where possible
  net: wan: fix the code style issue about trailing statements
  net: wan: add some required spaces
  net: wan: move out assignment in if condition
  net: wan: replace comparison to NULL with "!card"
  net: wan: fix the comments style issue
  net: wan: add braces {} to all arms of the statement

 drivers/net/wan/wanxl.c | 186 ++++++++++++++++++++++++------------------------
 1 file changed, 94 insertions(+), 92 deletions(-)

-- 
2.8.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH net-next 01/10] net: wan: remove redundant blank lines
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 02/10] net: wan: fix an code style issue about "foo* bar" Guangbin Huang
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

This patch removes some redundant blank lines.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 38 --------------------------------------
 1 file changed, 38 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index f393684f203a..676dd813d36d 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -50,7 +50,6 @@ static const char* version = "wanXL serial card driver version: 0.48";
 /* MAILBOX #2 - DRAM SIZE */
 #define MBX2_MEMSZ_MASK 0xFFFF0000 /* PUTS Memory Size Register mask */
 
-
 struct port {
 	struct net_device *dev;
 	struct card *card;
@@ -61,13 +60,11 @@ struct port {
 	struct sk_buff *tx_skbs[TX_BUFFERS];
 };
 
-
 struct card_status {
 	desc_t rx_descs[RX_QUEUE_LENGTH];
 	port_status_t port_status[4];
 };
 
-
 struct card {
 	int n_ports;		/* 1, 2 or 4 ports */
 	u8 irq;
@@ -81,20 +78,16 @@ struct card {
 	struct port ports[];	/* 1 - 4 port structures follow */
 };
 
-
-
 static inline struct port *dev_to_port(struct net_device *dev)
 {
 	return (struct port *)dev_to_hdlc(dev)->priv;
 }
 
-
 static inline port_status_t *get_status(struct port *port)
 {
 	return &port->card->status->port_status[port->node];
 }
 
-
 #ifdef DEBUG_PCI
 static inline dma_addr_t pci_map_single_debug(struct pci_dev *pdev, void *ptr,
 					      size_t size, int direction)
@@ -110,7 +103,6 @@ static inline dma_addr_t pci_map_single_debug(struct pci_dev *pdev, void *ptr,
 #define pci_map_single pci_map_single_debug
 #endif
 
-
 /* Cable and/or personality module change interrupt service */
 static inline void wanxl_cable_intr(struct port *port)
 {
@@ -154,8 +146,6 @@ static inline void wanxl_cable_intr(struct port *port)
 		netif_carrier_off(port->dev);
 }
 
-
-
 /* Transmit complete interrupt service */
 static inline void wanxl_tx_intr(struct port *port)
 {
@@ -187,8 +177,6 @@ static inline void wanxl_tx_intr(struct port *port)
         }
 }
 
-
-
 /* Receive complete interrupt service */
 static inline void wanxl_rx_intr(struct card *card)
 {
@@ -239,8 +227,6 @@ static inline void wanxl_rx_intr(struct card *card)
 	}
 }
 
-
-
 static irqreturn_t wanxl_intr(int irq, void* dev_id)
 {
 	struct card *card = dev_id;
@@ -248,7 +234,6 @@ static irqreturn_t wanxl_intr(int irq, void* dev_id)
         u32 stat;
         int handled = 0;
 
-
         while((stat = readl(card->plx + PLX_DOORBELL_FROM_CARD)) != 0) {
                 handled = 1;
 		writel(stat, card->plx + PLX_DOORBELL_FROM_CARD);
@@ -266,8 +251,6 @@ static irqreturn_t wanxl_intr(int irq, void* dev_id)
         return IRQ_RETVAL(handled);
 }
 
-
-
 static netdev_tx_t wanxl_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct port *port = dev_to_port(dev);
@@ -312,8 +295,6 @@ static netdev_tx_t wanxl_xmit(struct sk_buff *skb, struct net_device *dev)
 	return NETDEV_TX_OK;
 }
 
-
-
 static int wanxl_attach(struct net_device *dev, unsigned short encoding,
 			unsigned short parity)
 {
@@ -335,8 +316,6 @@ static int wanxl_attach(struct net_device *dev, unsigned short encoding,
 	return 0;
 }
 
-
-
 static int wanxl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
 	const size_t size = sizeof(sync_serial_settings);
@@ -387,8 +366,6 @@ static int wanxl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
         }
 }
 
-
-
 static int wanxl_open(struct net_device *dev)
 {
 	struct port *port = dev_to_port(dev);
@@ -423,8 +400,6 @@ static int wanxl_open(struct net_device *dev)
 	return -EFAULT;
 }
 
-
-
 static int wanxl_close(struct net_device *dev)
 {
 	struct port *port = dev_to_port(dev);
@@ -461,8 +436,6 @@ static int wanxl_close(struct net_device *dev)
 	return 0;
 }
 
-
-
 static struct net_device_stats *wanxl_get_stats(struct net_device *dev)
 {
 	struct port *port = dev_to_port(dev);
@@ -474,8 +447,6 @@ static struct net_device_stats *wanxl_get_stats(struct net_device *dev)
 	return &dev->stats;
 }
 
-
-
 static int wanxl_puts_command(struct card *card, u32 cmd)
 {
 	unsigned long timeout = jiffies + 5 * HZ;
@@ -491,8 +462,6 @@ static int wanxl_puts_command(struct card *card, u32 cmd)
 	return -1;
 }
 
-
-
 static void wanxl_reset(struct card *card)
 {
 	u32 old_value = readl(card->plx + PLX_CONTROL) & ~PLX_CTL_RESET;
@@ -505,8 +474,6 @@ static void wanxl_reset(struct card *card)
 	readl(card->plx + PLX_CONTROL); /* wait for posted write */
 }
 
-
-
 static void wanxl_pci_remove_one(struct pci_dev *pdev)
 {
 	struct card *card = pci_get_drvdata(pdev);
@@ -543,7 +510,6 @@ static void wanxl_pci_remove_one(struct pci_dev *pdev)
 	kfree(card);
 }
 
-
 #include "wanxlfw.inc"
 
 static const struct net_device_ops wanxl_ops = {
@@ -677,7 +643,6 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 	/* set up on-board RAM mapping */
 	mem_phy = pci_resource_start(pdev, 2);
 
-
 	/* sanity check the board's reported memory size */
 	if (ramsize < BUFFERS_ADDR +
 	    (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports) {
@@ -813,7 +778,6 @@ static const struct pci_device_id wanxl_pci_tbl[] = {
 	{ 0, }
 };
 
-
 static struct pci_driver wanxl_pci_driver = {
 	.name		= "wanXL",
 	.id_table	= wanxl_pci_tbl,
@@ -821,7 +785,6 @@ static struct pci_driver wanxl_pci_driver = {
 	.remove		= wanxl_pci_remove_one,
 };
 
-
 static int __init wanxl_init_module(void)
 {
 #ifdef MODULE
@@ -835,7 +798,6 @@ static void __exit wanxl_cleanup_module(void)
 	pci_unregister_driver(&wanxl_pci_driver);
 }
 
-
 MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
 MODULE_DESCRIPTION("SBE Inc. wanXL serial port driver");
 MODULE_LICENSE("GPL v2");
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 02/10] net: wan: fix an code style issue about "foo* bar"
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 01/10] net: wan: remove redundant blank lines Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 03/10] net: wan: add blank line after declarations Guangbin Huang
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

Fix the checkpatch error as "foo* bar" and should be "foo *bar",
and "(foo*)" should be "(foo *)".

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 676dd813d36d..afca54cf3e82 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -32,7 +32,7 @@
 
 #include "wanxl.h"
 
-static const char* version = "wanXL serial card driver version: 0.48";
+static const char *version = "wanXL serial card driver version: 0.48";
 
 #define PLX_CTL_RESET   0x40000000 /* adapter reset */
 
@@ -227,7 +227,7 @@ static inline void wanxl_rx_intr(struct card *card)
 	}
 }
 
-static irqreturn_t wanxl_intr(int irq, void* dev_id)
+static irqreturn_t wanxl_intr(int irq, void *dev_id)
 {
 	struct card *card = dev_id;
         int i;
@@ -677,7 +677,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 	}
 
 	for (i = 0; i < sizeof(firmware); i += 4)
-		writel(ntohl(*(__be32*)(firmware + i)), mem + PDM_OFFSET + i);
+		writel(ntohl(*(__be32 *)(firmware + i)), mem + PDM_OFFSET + i);
 
 	for (i = 0; i < ports; i++)
 		writel(card->status_address +
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 03/10] net: wan: add blank line after declarations
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 01/10] net: wan: remove redundant blank lines Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 02/10] net: wan: fix an code style issue about "foo* bar" Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 04/10] net: wan: code indent use tabs where possible Guangbin Huang
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

This patch fixes the checkpatch error about missing a blank line
after declarations.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index afca54cf3e82..566c519c6f65 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -93,6 +93,7 @@ static inline dma_addr_t pci_map_single_debug(struct pci_dev *pdev, void *ptr,
 					      size_t size, int direction)
 {
 	dma_addr_t addr = dma_map_single(&pdev->dev, ptr, size, direction);
+
 	if (addr + size > 0x100000000LL)
 		pr_crit("%s: pci_map_single() returned memory at 0x%llx!\n",
 			pci_name(pdev), (unsigned long long)addr);
@@ -150,6 +151,7 @@ static inline void wanxl_cable_intr(struct port *port)
 static inline void wanxl_tx_intr(struct port *port)
 {
 	struct net_device *dev = port->dev;
+
 	while (1) {
                 desc_t *desc = &get_status(port)->tx_descs[port->tx_in];
 		struct sk_buff *skb = port->tx_skbs[port->tx_in];
@@ -181,6 +183,7 @@ static inline void wanxl_tx_intr(struct port *port)
 static inline void wanxl_rx_intr(struct card *card)
 {
 	desc_t *desc;
+
 	while (desc = &card->status->rx_descs[card->rx_in],
 	       desc->stat != PACKET_EMPTY) {
 		if ((desc->stat & PACKET_PORT_MASK) > card->n_ports)
@@ -662,6 +665,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 
 	for (i = 0; i < RX_QUEUE_LENGTH; i++) {
 		struct sk_buff *skb = dev_alloc_skb(BUFFER_LENGTH);
+
 		card->rx_skbs[i] = skb;
 		if (skb)
 			card->status->rx_descs[i].address =
@@ -729,6 +733,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 		hdlc_device *hdlc;
 		struct port *port = &card->ports[i];
 		struct net_device *dev = alloc_hdlcdev(port);
+
 		if (!dev) {
 			pr_err("%s: unable to allocate memory\n",
 			       pci_name(pdev));
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 04/10] net: wan: code indent use tabs where possible
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
                   ` (2 preceding siblings ...)
  2021-05-24 14:47 ` [PATCH net-next 03/10] net: wan: add blank line after declarations Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 05/10] net: wan: fix the code style issue about trailing statements Guangbin Huang
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

Code indent should use tabs where possible.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 566c519c6f65..0bcb21ddcc62 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -54,7 +54,7 @@ struct port {
 	struct net_device *dev;
 	struct card *card;
 	spinlock_t lock;	/* for wanxl_xmit */
-        int node;		/* physical port #0 - 3 */
+	int node;		/* physical port #0 - 3 */
 	unsigned int clock_type;
 	int tx_in, tx_out;
 	struct sk_buff *tx_skbs[TX_BUFFERS];
@@ -153,7 +153,7 @@ static inline void wanxl_tx_intr(struct port *port)
 	struct net_device *dev = port->dev;
 
 	while (1) {
-                desc_t *desc = &get_status(port)->tx_descs[port->tx_in];
+		desc_t *desc = &get_status(port)->tx_descs[port->tx_in];
 		struct sk_buff *skb = port->tx_skbs[port->tx_in];
 
 		switch (desc->stat) {
@@ -171,12 +171,12 @@ static inline void wanxl_tx_intr(struct port *port)
 			dev->stats.tx_packets++;
 			dev->stats.tx_bytes += skb->len;
 		}
-                desc->stat = PACKET_EMPTY; /* Free descriptor */
+		desc->stat = PACKET_EMPTY; /* Free descriptor */
 		dma_unmap_single(&port->card->pdev->dev, desc->address,
 				 skb->len, DMA_TO_DEVICE);
 		dev_consume_skb_irq(skb);
-                port->tx_in = (port->tx_in + 1) % TX_BUFFERS;
-        }
+		port->tx_in = (port->tx_in + 1) % TX_BUFFERS;
+	}
 }
 
 /* Receive complete interrupt service */
@@ -233,15 +233,15 @@ static inline void wanxl_rx_intr(struct card *card)
 static irqreturn_t wanxl_intr(int irq, void *dev_id)
 {
 	struct card *card = dev_id;
-        int i;
-        u32 stat;
-        int handled = 0;
+	int i;
+	u32 stat;
+	int handled = 0;
 
-        while((stat = readl(card->plx + PLX_DOORBELL_FROM_CARD)) != 0) {
-                handled = 1;
+	while ((stat = readl(card->plx + PLX_DOORBELL_FROM_CARD)) != 0) {
+		handled = 1;
 		writel(stat, card->plx + PLX_DOORBELL_FROM_CARD);
 
-                for (i = 0; i < card->n_ports; i++) {
+		for (i = 0; i < card->n_ports; i++) {
 			if (stat & (1 << (DOORBELL_FROM_CARD_TX_0 + i)))
 				wanxl_tx_intr(&card->ports[i]);
 			if (stat & (1 << (DOORBELL_FROM_CARD_CABLE_0 + i)))
@@ -249,9 +249,9 @@ static irqreturn_t wanxl_intr(int irq, void *dev_id)
 		}
 		if (stat & (1 << DOORBELL_FROM_CARD_RX))
 			wanxl_rx_intr(card);
-        }
+	}
 
-        return IRQ_RETVAL(handled);
+	return IRQ_RETVAL(handled);
 }
 
 static netdev_tx_t wanxl_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -259,11 +259,11 @@ static netdev_tx_t wanxl_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct port *port = dev_to_port(dev);
 	desc_t *desc;
 
-        spin_lock(&port->lock);
+	spin_lock(&port->lock);
 
 	desc = &get_status(port)->tx_descs[port->tx_out];
-        if (desc->stat != PACKET_EMPTY) {
-                /* should never happen - previous xmit should stop queue */
+	if (desc->stat != PACKET_EMPTY) {
+		/* should never happen - previous xmit should stop queue */
 #ifdef DEBUG_PKT
                 printk(KERN_DEBUG "%s: transmitter buffer full\n", dev->name);
 #endif
@@ -366,7 +366,7 @@ static int wanxl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
 	default:
 		return hdlc_ioctl(dev, ifr, cmd);
-        }
+	}
 }
 
 static int wanxl_open(struct net_device *dev)
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 05/10] net: wan: fix the code style issue about trailing statements
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
                   ` (3 preceding siblings ...)
  2021-05-24 14:47 ` [PATCH net-next 04/10] net: wan: code indent use tabs where possible Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 06/10] net: wan: add some required spaces Guangbin Huang
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

Trailing statements should be on next line.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 59 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 0bcb21ddcc62..7e5bf207a142 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -112,21 +112,45 @@ static inline void wanxl_cable_intr(struct port *port)
 	const char *cable, *pm, *dte = "", *dsr = "", *dcd = "";
 
 	switch(value & 0x7) {
-	case STATUS_CABLE_V35: cable = "V.35"; break;
-	case STATUS_CABLE_X21: cable = "X.21"; break;
-	case STATUS_CABLE_V24: cable = "V.24"; break;
-	case STATUS_CABLE_EIA530: cable = "EIA530"; break;
-	case STATUS_CABLE_NONE: cable = "no"; break;
-	default: cable = "invalid";
+	case STATUS_CABLE_V35:
+		cable = "V.35";
+		break;
+	case STATUS_CABLE_X21:
+		cable = "X.21";
+		break;
+	case STATUS_CABLE_V24:
+		cable = "V.24";
+		break;
+	case STATUS_CABLE_EIA530:
+		cable = "EIA530";
+		break;
+	case STATUS_CABLE_NONE:
+		cable = "no";
+		break;
+	default:
+		cable = "invalid";
 	}
 
 	switch((value >> STATUS_CABLE_PM_SHIFT) & 0x7) {
-	case STATUS_CABLE_V35: pm = "V.35"; break;
-	case STATUS_CABLE_X21: pm = "X.21"; break;
-	case STATUS_CABLE_V24: pm = "V.24"; break;
-	case STATUS_CABLE_EIA530: pm = "EIA530"; break;
-	case STATUS_CABLE_NONE: pm = "no personality"; valid = 0; break;
-	default: pm = "invalid personality"; valid = 0;
+	case STATUS_CABLE_V35:
+		pm = "V.35";
+		break;
+	case STATUS_CABLE_X21:
+		pm = "X.21";
+		break;
+	case STATUS_CABLE_V24:
+		pm = "V.24";
+		break;
+	case STATUS_CABLE_EIA530:
+		pm = "EIA530";
+		break;
+	case STATUS_CABLE_NONE:
+		pm = "no personality";
+		valid = 0;
+		break;
+	default:
+		pm = "invalid personality";
+		valid = 0;
 	}
 
 	if (valid) {
@@ -563,9 +587,14 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 	}
 
 	switch (pdev->device) {
-	case PCI_DEVICE_ID_SBE_WANXL100: ports = 1; break;
-	case PCI_DEVICE_ID_SBE_WANXL200: ports = 2; break;
-	default: ports = 4;
+	case PCI_DEVICE_ID_SBE_WANXL100:
+		ports = 1;
+		break;
+	case PCI_DEVICE_ID_SBE_WANXL200:
+		ports = 2;
+		break;
+	default:
+		ports = 4;
 	}
 
 	card = kzalloc(struct_size(card, ports, ports), GFP_KERNEL);
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 06/10] net: wan: add some required spaces
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
                   ` (4 preceding siblings ...)
  2021-05-24 14:47 ` [PATCH net-next 05/10] net: wan: fix the code style issue about trailing statements Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 07/10] net: wan: move out assignment in if condition Guangbin Huang
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

Add space required after that close brace '}'.
Add space required before the open parenthesis '('.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 7e5bf207a142..7965c648f3eb 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -111,7 +111,7 @@ static inline void wanxl_cable_intr(struct port *port)
 	int valid = 1;
 	const char *cable, *pm, *dte = "", *dsr = "", *dcd = "";
 
-	switch(value & 0x7) {
+	switch (value & 0x7) {
 	case STATUS_CABLE_V35:
 		cable = "V.35";
 		break;
@@ -131,7 +131,7 @@ static inline void wanxl_cable_intr(struct port *port)
 		cable = "invalid";
 	}
 
-	switch((value >> STATUS_CABLE_PM_SHIFT) & 0x7) {
+	switch ((value >> STATUS_CABLE_PM_SHIFT) & 0x7) {
 	case STATUS_CABLE_V35:
 		pm = "V.35";
 		break;
@@ -484,7 +484,7 @@ static int wanxl_puts_command(struct card *card, u32 cmd)
 			return 0;
 
 		schedule();
-	}while (time_after(timeout, jiffies));
+	} while (time_after(timeout, jiffies));
 
 	return -1;
 }
@@ -654,7 +654,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 			return -ENODEV;
 		}
 
-		switch(stat & 0xC0) {
+		switch (stat & 0xC0) {
 		case 0x00:	/* hmm - PUTS completed with non-zero code? */
 		case 0x80:	/* PUTS still testing the hardware */
 			break;
@@ -733,7 +733,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 		if ((stat = readl(card->plx + PLX_MAILBOX_5)) != 0)
 			break;
 		schedule();
-	}while (time_after(timeout, jiffies));
+	} while (time_after(timeout, jiffies));
 
 	if (!stat) {
 		pr_warn("%s: timeout while initializing card firmware\n",
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 07/10] net: wan: move out assignment in if condition
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
                   ` (5 preceding siblings ...)
  2021-05-24 14:47 ` [PATCH net-next 06/10] net: wan: add some required spaces Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 08/10] net: wan: replace comparison to NULL with "!card" Guangbin Huang
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

Should not use assignment in if condition.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 7965c648f3eb..a5f0aae30e0c 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -404,7 +404,9 @@ static int wanxl_open(struct net_device *dev)
 		netdev_err(dev, "port already open\n");
 		return -EIO;
 	}
-	if ((i = hdlc_open(dev)) != 0)
+
+	i = hdlc_open(dev);
+	if (i)
 		return i;
 
 	port->tx_in = port->tx_out = 0;
@@ -730,7 +732,8 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 
 	timeout = jiffies + 5 * HZ;
 	do {
-		if ((stat = readl(card->plx + PLX_MAILBOX_5)) != 0)
+		stat = readl(card->plx + PLX_MAILBOX_5);
+		if (stat)
 			break;
 		schedule();
 	} while (time_after(timeout, jiffies));
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 08/10] net: wan: replace comparison to NULL with "!card"
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
                   ` (6 preceding siblings ...)
  2021-05-24 14:47 ` [PATCH net-next 07/10] net: wan: move out assignment in if condition Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 09/10] net: wan: fix the comments style issue Guangbin Huang
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

According to the chackpatch.pl, comparison to NULL could
be written "!card".

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index a5f0aae30e0c..5a89b6d4d92e 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -600,7 +600,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 	}
 
 	card = kzalloc(struct_size(card, ports, ports), GFP_KERNEL);
-	if (card == NULL) {
+	if (!card) {
 		pci_release_regions(pdev);
 		pci_disable_device(pdev);
 		return -ENOBUFS;
@@ -612,7 +612,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 	card->status = dma_alloc_coherent(&pdev->dev,
 					  sizeof(struct card_status),
 					  &card->status_address, GFP_KERNEL);
-	if (card->status == NULL) {
+	if (!card->status) {
 		wanxl_pci_remove_one(pdev);
 		return -ENOBUFS;
 	}
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 09/10] net: wan: fix the comments style issue
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
                   ` (7 preceding siblings ...)
  2021-05-24 14:47 ` [PATCH net-next 08/10] net: wan: replace comparison to NULL with "!card" Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 14:47 ` [PATCH net-next 10/10] net: wan: add braces {} to all arms of the statement Guangbin Huang
  2021-05-24 21:10 ` [PATCH net-next 00/10] net: wan: clean up some code style issues patchwork-bot+netdevbpf
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

Block comments use * on subsequent lines.
Block comments use a trailing */ on a separate line.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 5a89b6d4d92e..18de5f1bb0ed 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -569,12 +569,14 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 		return i;
 
 	/* QUICC can only access first 256 MB of host RAM directly,
-	   but PLX9060 DMA does 32-bits for actual packet data transfers */
+	 * but PLX9060 DMA does 32-bits for actual packet data transfers
+	 */
 
 	/* FIXME when PCI/DMA subsystems are fixed.
-	   We set both dma_mask and consistent_dma_mask to 28 bits
-	   and pray pci_alloc_consistent() will use this info. It should
-	   work on most platforms */
+	 * We set both dma_mask and consistent_dma_mask to 28 bits
+	 * and pray pci_alloc_consistent() will use this info. It should
+	 * work on most platforms
+	 */
 	if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(28)) ||
 	    dma_set_mask(&pdev->dev, DMA_BIT_MASK(28))) {
 		pr_err("No usable DMA configuration\n");
@@ -624,8 +626,9 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 #endif
 
 	/* FIXME when PCI/DMA subsystems are fixed.
-	   We set both dma_mask and consistent_dma_mask back to 32 bits
-	   to indicate the card can do 32-bit DMA addressing */
+	 * We set both dma_mask and consistent_dma_mask back to 32 bits
+	 * to indicate the card can do 32-bit DMA addressing
+	 */
 	if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)) ||
 	    dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
 		pr_err("No usable DMA configuration\n");
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH net-next 10/10] net: wan: add braces {} to all arms of the statement
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
                   ` (8 preceding siblings ...)
  2021-05-24 14:47 ` [PATCH net-next 09/10] net: wan: fix the comments style issue Guangbin Huang
@ 2021-05-24 14:47 ` Guangbin Huang
  2021-05-24 21:10 ` [PATCH net-next 00/10] net: wan: clean up some code style issues patchwork-bot+netdevbpf
  10 siblings, 0 replies; 12+ messages in thread
From: Guangbin Huang @ 2021-05-24 14:47 UTC (permalink / raw)
  To: davem, kuba, xie.he.0141, ms, willemb
  Cc: netdev, linux-kernel, lipeng321, tanhuazhong, huangguangbin2

From: Peng Li <lipeng321@huawei.com>

Braces {} should be used on all arms of this statement.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/wan/wanxl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 18de5f1bb0ed..f22e48415e6f 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -210,18 +210,18 @@ static inline void wanxl_rx_intr(struct card *card)
 
 	while (desc = &card->status->rx_descs[card->rx_in],
 	       desc->stat != PACKET_EMPTY) {
-		if ((desc->stat & PACKET_PORT_MASK) > card->n_ports)
+		if ((desc->stat & PACKET_PORT_MASK) > card->n_ports) {
 			pr_crit("%s: received packet for nonexistent port\n",
 				pci_name(card->pdev));
-		else {
+		} else {
 			struct sk_buff *skb = card->rx_skbs[card->rx_in];
 			struct port *port = &card->ports[desc->stat &
 						    PACKET_PORT_MASK];
 			struct net_device *dev = port->dev;
 
-			if (!skb)
+			if (!skb) {
 				dev->stats.rx_dropped++;
-			else {
+			} else {
 				dma_unmap_single(&card->pdev->dev,
 						 desc->address, BUFFER_LENGTH,
 						 DMA_FROM_DEVICE);
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH net-next 00/10] net: wan: clean up some code style issues
  2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
                   ` (9 preceding siblings ...)
  2021-05-24 14:47 ` [PATCH net-next 10/10] net: wan: add braces {} to all arms of the statement Guangbin Huang
@ 2021-05-24 21:10 ` patchwork-bot+netdevbpf
  10 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-24 21:10 UTC (permalink / raw)
  To: Guangbin Huang
  Cc: davem, kuba, xie.he.0141, ms, willemb, netdev, linux-kernel,
	lipeng321, tanhuazhong

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Mon, 24 May 2021 22:47:07 +0800 you wrote:
> This patchset clean up some code style issues.
> 
> Peng Li (10):
>   net: wan: remove redundant blank lines
>   net: wan: fix an code style issue about "foo* bar"
>   net: wan: add blank line after declarations
>   net: wan: code indent use tabs where possible
>   net: wan: fix the code style issue about trailing statements
>   net: wan: add some required spaces
>   net: wan: move out assignment in if condition
>   net: wan: replace comparison to NULL with "!card"
>   net: wan: fix the comments style issue
>   net: wan: add braces {} to all arms of the statement
> 
> [...]

Here is the summary with links:
  - [net-next,01/10] net: wan: remove redundant blank lines
    https://git.kernel.org/netdev/net-next/c/8890d0a1891a
  - [net-next,02/10] net: wan: fix an code style issue about "foo* bar"
    https://git.kernel.org/netdev/net-next/c/b32db030b96e
  - [net-next,03/10] net: wan: add blank line after declarations
    https://git.kernel.org/netdev/net-next/c/f0328a192290
  - [net-next,04/10] net: wan: code indent use tabs where possible
    https://git.kernel.org/netdev/net-next/c/261795f4113b
  - [net-next,05/10] net: wan: fix the code style issue about trailing statements
    https://git.kernel.org/netdev/net-next/c/e5877104b5ec
  - [net-next,06/10] net: wan: add some required spaces
    https://git.kernel.org/netdev/net-next/c/c3b6b5c64f39
  - [net-next,07/10] net: wan: move out assignment in if condition
    https://git.kernel.org/netdev/net-next/c/87feef1cfbbe
  - [net-next,08/10] net: wan: replace comparison to NULL with "!card"
    https://git.kernel.org/netdev/net-next/c/336d781bd952
  - [net-next,09/10] net: wan: fix the comments style issue
    https://git.kernel.org/netdev/net-next/c/80d67b95d1fe
  - [net-next,10/10] net: wan: add braces {} to all arms of the statement
    https://git.kernel.org/netdev/net-next/c/d1406175f968

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-05-24 21:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 14:47 [PATCH net-next 00/10] net: wan: clean up some code style issues Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 01/10] net: wan: remove redundant blank lines Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 02/10] net: wan: fix an code style issue about "foo* bar" Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 03/10] net: wan: add blank line after declarations Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 04/10] net: wan: code indent use tabs where possible Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 05/10] net: wan: fix the code style issue about trailing statements Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 06/10] net: wan: add some required spaces Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 07/10] net: wan: move out assignment in if condition Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 08/10] net: wan: replace comparison to NULL with "!card" Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 09/10] net: wan: fix the comments style issue Guangbin Huang
2021-05-24 14:47 ` [PATCH net-next 10/10] net: wan: add braces {} to all arms of the statement Guangbin Huang
2021-05-24 21:10 ` [PATCH net-next 00/10] net: wan: clean up some code style issues patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).