net: pc300too: clean up some code style issues
cover net: pc300too: clean up some code style issues
From: Peng Li <[email protected]>
This patchset clean up some code style issues.
Peng Li (8):
net: pc300too: remove redundant blank lines
net: pc300too: add blank line after declarations
net: pc300too: fix the code style issue about "foo * bar"
net: pc300too: move out assignment in if condition
net: pc300too: remove redundant initialization for statics
net: pc300too: replace comparison to NULL with "!card->plxbase"
net: pc300too: add some required spaces
net: pc300too: fix the comments style issue
drivers/net/wan/pc300too.c | 52 +++++++++++++--------------------------------- 1 file changed, 15 insertions(+), 37 deletions(-)
Signature · 1 line
2.8.1
PATCH 1/8 net: pc300too: remove redundant blank lines
From: Peng Li <[email protected]>
This patch removes some redundant blank lines.
--- drivers/net/wan/pc300too.c | 22 ---------------------- 1 file changed, 22 deletions(-)
drivers/net/wan/pc300too.c +0 -22
@@ -52,7 +52,6 @@ static unsigned int CLOCK_BASE;#define PC300_CHMEDIA_MASK (port) (0x00000020UL << ((port) * 3))#define PC300_CTYPE_MASK (0x00000800UL) -enum {PC300_RSV =1 ,PC300_X21 ,PC300_TE };/* card types */ /*
@@ -71,8 +70,6 @@ typedef struct {u32 init_ctrl;/* 50h : EEPROM ctrl, Init Ctrl, etc */ }plx9050; - - typedef struct port_s { struct napi_struct napi; struct net_device *netdev;
@@ -90,8 +87,6 @@ typedef struct port_s {u8 chan;/* physical port # - 0 or 1 */ }port_t; - - typedef struct card_s { int type; /* RSV, X21, etc. */ int n_ports; /* 1 or 2 ports */
@@ -107,13 +102,11 @@ typedef struct card_s {port_t ports[2 ]; }card_t; -#define get_port (card, port) ((port) < (card)->n_ports ? \ (&(card)->ports[port]) : (NULL))#include "hd64572.c" -static void pc300_set_iface (port_t *port) {card_t *card = port->card;
@@ -162,8 +155,6 @@ static void pc300_set_iface(port_t *port) } } - -static int pc300_open (struct net_device *dev) {port_t *port =dev_to_port (dev);
@@ -177,8 +168,6 @@ static int pc300_open(struct net_device *dev)return 0 ; } - -static int pc300_close (struct net_device *dev) {sca_close (dev);
@@ -186,8 +175,6 @@ static int pc300_close(struct net_device *dev)return 0 ; } - -static int pc300_ioctl (struct net_device *dev,struct ifreq *ifr,int cmd) {const size_t size =sizeof (sync_serial_settings);
@@ -214,7 +201,6 @@ static int pc300_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)if (copy_to_user (line, &port->settings, size))return -EFAULT ;return 0 ; - } if (port->card->type == PC300_X21 &&
@@ -255,8 +241,6 @@ static int pc300_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)return 0 ; } - -static void pc300_pci_remove_one (struct pci_dev *pdev) {int i;
@@ -472,8 +456,6 @@ static int pc300_pci_init_one(struct pci_dev *pdev,return 0 ; } - -static const struct pci_device_id pc300_pci_tbl[] = { {PCI_VENDOR_ID_CYCLADES ,PCI_DEVICE_ID_PC300_RX_1 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 },
@@ -486,7 +468,6 @@ static const struct pci_device_id pc300_pci_tbl[] = { { 0, } }; -static struct pci_driver pc300_pci_driver = { .name ="PC300" , .id_table = pc300_pci_tbl,
@@ -494,7 +475,6 @@ static struct pci_driver pc300_pci_driver = { .remove = pc300_pci_remove_one, }; -static int __init pc300_init_module (void ) {if (pci_clock_freq <1000000 || pci_clock_freq >80000000 ) {
@@ -511,8 +491,6 @@ static int __init pc300_init_module(void)return pci_register_driver (&pc300_pci_driver); } - - static void __exit pc300_cleanup_module(void) {pci_unregister_driver (&pc300_pci_driver);
Signature · 1 line
2.8.1
PATCH 2/8 net: pc300too: add blank line after declarations
In reply to Guangbin HuangFrom: Peng Li <[email protected]>
This patch fixes the checkpatch error about missing a blank line after declarations.
--- drivers/net/wan/pc300too.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wan/pc300too.c +2 -1
@@ -158,8 +158,8 @@ static void pc300_set_iface(port_t *port)static int pc300_open (struct net_device *dev) {port_t *port =dev_to_port (dev); -int result =hdlc_open (dev); +if (result)return result;
@@ -426,6 +426,7 @@ static int pc300_pci_init_one(struct pci_dev *pdev,port_t *port = &card->ports[i];struct net_device *dev = port->netdev;hdlc_device *hdlc =dev_to_hdlc (dev); + port->chan = i;spin_lock_init (&port->lock);
Signature · 1 line
2.8.1
PATCH 3/8 net: pc300too: fix the code style issue about "foo * bar"
In reply to Guangbin HuangFrom: Peng Li <[email protected]>
Fix the checkpatch error as "foo * bar" and should be "foo *bar".
--- drivers/net/wan/pc300too.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wan/pc300too.c +1 -1
@@ -110,7 +110,7 @@ typedef struct card_s {static void pc300_set_iface (port_t *port) {card_t *card = port->card; -u32 __iomem * init_ctrl = &card->plxbase->init_ctrl; +u32 __iomem *init_ctrl = &card->plxbase->init_ctrl;u16 msci =get_msci (port);u8 rxs = port->rxs &CLK_BRG_MASK ;u8 txs = port->txs &CLK_BRG_MASK ;
Signature · 1 line
2.8.1
PATCH 4/8 net: pc300too: move out assignment in if condition
In reply to Guangbin HuangFrom: Peng Li <[email protected]>
Should not use assignment in if condition.
--- drivers/net/wan/pc300too.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wan/pc300too.c +4 -2
@@ -349,12 +349,14 @@ static int pc300_pci_init_one(struct pci_dev *pdev,else card->n_ports =2 ; -for (i =0 ; i < card->n_ports; i++) -if (!(card->ports[i].netdev =alloc_hdlcdev (&card->ports[i]))) { +for (i =0 ; i < card->n_ports; i++) { + card->ports[i].netdev =alloc_hdlcdev (&card->ports[i]); +if (!card->ports[i].netdev) {pr_err ("unable to allocate memory\n" );pc300_pci_remove_one (pdev);return -ENOMEM ; } + }/* Reset PLX */ p = &card->plxbase->init_ctrl;
Signature · 1 line
2.8.1
PATCH 5/8 net: pc300too: remove redundant initialization for statics
In reply to Guangbin HuangFrom: Peng Li <[email protected]>
Should not initialise statics to 0.
--- drivers/net/wan/pc300too.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wan/pc300too.c +1 -1
@@ -44,7 +44,7 @@#define MAX_TX_BUFFERS 10static int pci_clock_freq =33000000 ; -static int use_crystal_clock =0 ; +static int use_crystal_clock;static unsigned int CLOCK_BASE ;/* Masks to access the init_ctrl PLX register */
Signature · 1 line
2.8.1
PATCH 6/8 net: pc300too: replace comparison to NULL with "!card->plxbase"
In reply to Guangbin HuangFrom: Peng Li <[email protected]>
According to the chackpatch.pl, comparison to NULL could be written "!card->plxbase".
--- drivers/net/wan/pc300too.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/wan/pc300too.c +2 -4
@@ -298,7 +298,7 @@ static int pc300_pci_init_one(struct pci_dev *pdev, } card =kzalloc (sizeof (card_t),GFP_KERNEL ); -if (card ==NULL ) { +if (!card) {pci_release_regions (pdev);pci_disable_device (pdev);return -ENOBUFS ;
@@ -322,9 +322,7 @@ static int pc300_pci_init_one(struct pci_dev *pdev, ramphys =pci_resource_start (pdev,3 ) &PCI_BASE_ADDRESS_MEM_MASK ; card->rambase =pci_ioremap_bar (pdev,3 ); -if (card->plxbase ==NULL || - card->scabase ==NULL || - card->rambase ==NULL ) { +if (!card->plxbase || !card->scabase || !card->rambase) {pr_err ("ioremap() failed\n" );pc300_pci_remove_one (pdev);return -ENOMEM ;
Signature · 1 line
2.8.1
PATCH 7/8 net: pc300too: add some required spaces
In reply to Guangbin HuangFrom: Peng Li <[email protected]>
Add spaces required before the open parenthesis '('. Add spaces required after that close brace '}'.
--- drivers/net/wan/pc300too.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wan/pc300too.c +4 -4
@@ -68,7 +68,7 @@ typedef struct {u32 cs_base[4 ];/* 3C-48h : Chip Select Base Addrs */ u32 intr_ctrl_stat;/* 4Ch : Interrupt Control/Status */ u32 init_ctrl;/* 50h : EEPROM ctrl, Init Ctrl, etc */ -}plx9050; +} plx9050; typedef struct port_s { struct napi_struct napi;
@@ -85,7 +85,7 @@ typedef struct port_s {u16 txlast;u8 rxs, txs, tmc;/* SCA registers */ u8 chan;/* physical port # - 0 or 1 */ -}port_t; +} port_t; typedef struct card_s { int type; /* RSV, X21, etc. */
@@ -100,7 +100,7 @@ typedef struct card_s {u8 irq;/* interrupt request level */ port_t ports[2 ]; -}card_t; +} card_t;#define get_port (card, port) ((port) < (card)->n_ports ? \ (&(card)->ports[port]) : (NULL))
@@ -117,7 +117,7 @@ static void pc300_set_iface(port_t *port)sca_out (EXS_TES1 , (port->chan ?MSCI1_OFFSET :MSCI0_OFFSET ) +EXS , port->card); -switch (port->settings.clock_type) { +switch (port->settings.clock_type) {case CLOCK_INT : rxs |=CLK_BRG ;/* BRG output */ txs |=CLK_PIN_OUT |CLK_TX_RXCLK ;/* RX clock */
Signature · 1 line
2.8.1
PATCH 8/8 net: pc300too: fix the comments style issue
In reply to Guangbin HuangFrom: Peng Li <[email protected]>
Networking block comments don't use an empty /* line, use /* Comment...
This patch fixes the comments style issues.
--- drivers/net/wan/pc300too.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wan/pc300too.c +1 -2
@@ -54,8 +54,7 @@ static unsigned int CLOCK_BASE;enum {PC300_RSV =1 ,PC300_X21 ,PC300_TE };/* card types */ -/* -* PLX PCI9050-1 local configuration and shared runtime registers. +/* PLX PCI9050-1 local configuration and shared runtime registers. * This structure can be used to access 9050 registers (memory mapped). */ typedef struct {
Signature · 1 line
2.8.1
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 14 lines · On Fri, 11 Jun 2021 11:36:14 +0800 you wrote:
From: Peng Li <[email protected]>
This patchset clean up some code style issues.
Peng Li (8):
net: pc300too: remove redundant blank lines
net: pc300too: add blank line after declarations
net: pc300too: fix the code style issue about "foo * bar"
net: pc300too: move out assignment in if condition
net: pc300too: remove redundant initialization for statics
net: pc300too: replace comparison to NULL with "!card->plxbase"
net: pc300too: add some required spaces
net: pc300too: fix the comments style issue
Quoted 1 line
[...]
Here is the summary with links:
- [net-next,1/8] net: pc300too: remove redundant blank lines
https://git.kernel.org/netdev/net-next/c/93f764371c45 - [net-next,2/8] net: pc300too: add blank line after declarations https://git.kernel.org/netdev/net-next/c/a657c8b4d50d - [net-next,3/8] net: pc300too: fix the code style issue about "foo * bar" https://git.kernel.org/netdev/net-next/c/f8864e26d311 - [net-next,4/8] net: pc300too: move out assignment in if condition https://git.kernel.org/netdev/net-next/c/d72f78db55d6 - [net-next,5/8] net: pc300too: remove redundant initialization for statics https://git.kernel.org/netdev/net-next/c/ae6440483b54 - [net-next,6/8] net: pc300too: replace comparison to NULL with "!card->plxbase" https://git.kernel.org/netdev/net-next/c/0cd2135cf83d - [net-next,7/8] net: pc300too: add some required spaces https://git.kernel.org/netdev/net-next/c/eed00311659f - [net-next,8/8] net: pc300too: fix the comments style issue https://git.kernel.org/netdev/net-next/c/ef1806a8b961
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html