* [PATCH net-next 1/8] net: pc300too: remove redundant blank lines
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
@ 2021-06-11 3:36 ` Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 2/8] net: pc300too: add blank line after declarations Guangbin Huang
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Guangbin Huang @ 2021-06-11 3:36 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, lipeng321, 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/pc300too.c | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index 001fd37..5ccaec9 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -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);
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 2/8] net: pc300too: add blank line after declarations
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 1/8] net: pc300too: remove redundant blank lines Guangbin Huang
@ 2021-06-11 3:36 ` Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 3/8] net: pc300too: fix the code style issue about "foo * bar" Guangbin Huang
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Guangbin Huang @ 2021-06-11 3:36 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, lipeng321, 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/pc300too.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index 5ccaec9..8f592ff 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -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);
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 3/8] net: pc300too: fix the code style issue about "foo * bar"
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 1/8] net: pc300too: remove redundant blank lines Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 2/8] net: pc300too: add blank line after declarations Guangbin Huang
@ 2021-06-11 3:36 ` Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 4/8] net: pc300too: move out assignment in if condition Guangbin Huang
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Guangbin Huang @ 2021-06-11 3:36 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, lipeng321, huangguangbin2
From: Peng Li <lipeng321@huawei.com>
Fix the checkpatch error as "foo * bar" and should be "foo *bar".
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/pc300too.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index 8f592ff..17d5cb8 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -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;
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 4/8] net: pc300too: move out assignment in if condition
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
` (2 preceding siblings ...)
2021-06-11 3:36 ` [PATCH net-next 3/8] net: pc300too: fix the code style issue about "foo * bar" Guangbin Huang
@ 2021-06-11 3:36 ` Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 5/8] net: pc300too: remove redundant initialization for statics Guangbin Huang
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Guangbin Huang @ 2021-06-11 3:36 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, lipeng321, huangguangbin2
From: Peng Li <lipeng321@huawei.com>
Should not use assignment in if condition.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/pc300too.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index 17d5cb8..7d8eae5 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -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;
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 5/8] net: pc300too: remove redundant initialization for statics
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
` (3 preceding siblings ...)
2021-06-11 3:36 ` [PATCH net-next 4/8] net: pc300too: move out assignment in if condition Guangbin Huang
@ 2021-06-11 3:36 ` Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 6/8] net: pc300too: replace comparison to NULL with "!card->plxbase" Guangbin Huang
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Guangbin Huang @ 2021-06-11 3:36 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, lipeng321, huangguangbin2
From: Peng Li <lipeng321@huawei.com>
Should not initialise statics to 0.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/pc300too.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index 7d8eae5..56f7d96 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -44,7 +44,7 @@
#define MAX_TX_BUFFERS 10
static 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 */
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 6/8] net: pc300too: replace comparison to NULL with "!card->plxbase"
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
` (4 preceding siblings ...)
2021-06-11 3:36 ` [PATCH net-next 5/8] net: pc300too: remove redundant initialization for statics Guangbin Huang
@ 2021-06-11 3:36 ` Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 7/8] net: pc300too: add some required spaces Guangbin Huang
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Guangbin Huang @ 2021-06-11 3:36 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, lipeng321, huangguangbin2
From: Peng Li <lipeng321@huawei.com>
According to the chackpatch.pl, comparison to NULL could
be written "!card->plxbase".
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
drivers/net/wan/pc300too.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index 56f7d96..ecce999 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -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;
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 7/8] net: pc300too: add some required spaces
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
` (5 preceding siblings ...)
2021-06-11 3:36 ` [PATCH net-next 6/8] net: pc300too: replace comparison to NULL with "!card->plxbase" Guangbin Huang
@ 2021-06-11 3:36 ` Guangbin Huang
2021-06-11 3:36 ` [PATCH net-next 8/8] net: pc300too: fix the comments style issue Guangbin Huang
2021-06-11 20:00 ` [PATCH net-next 0/8] net: pc300too: clean up some code style issues patchwork-bot+netdevbpf
8 siblings, 0 replies; 10+ messages in thread
From: Guangbin Huang @ 2021-06-11 3:36 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, lipeng321, huangguangbin2
From: Peng Li <lipeng321@huawei.com>
Add spaces required before the open parenthesis '('.
Add spaces required after that close brace '}'.
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
drivers/net/wan/pc300too.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index ecce999..885dcc5 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -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 */
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 8/8] net: pc300too: fix the comments style issue
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
` (6 preceding siblings ...)
2021-06-11 3:36 ` [PATCH net-next 7/8] net: pc300too: add some required spaces Guangbin Huang
@ 2021-06-11 3:36 ` Guangbin Huang
2021-06-11 20:00 ` [PATCH net-next 0/8] net: pc300too: clean up some code style issues patchwork-bot+netdevbpf
8 siblings, 0 replies; 10+ messages in thread
From: Guangbin Huang @ 2021-06-11 3:36 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, lipeng321, huangguangbin2
From: Peng Li <lipeng321@huawei.com>
Networking block comments don't use an empty /* line,
use /* Comment...
This patch fixes the comments style issues.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/pc300too.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index 885dcc5..7b123a7 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -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 {
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 0/8] net: pc300too: clean up some code style issues
2021-06-11 3:36 [PATCH net-next 0/8] net: pc300too: clean up some code style issues Guangbin Huang
` (7 preceding siblings ...)
2021-06-11 3:36 ` [PATCH net-next 8/8] net: pc300too: fix the comments style issue Guangbin Huang
@ 2021-06-11 20:00 ` patchwork-bot+netdevbpf
8 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-11 20:00 UTC (permalink / raw)
To: Guangbin Huang
Cc: davem, kuba, xie.he.0141, ms, willemb, netdev, linux-kernel, lipeng321
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
On Fri, 11 Jun 2021 11:36:14 +0800 you wrote:
> From: Peng Li <lipeng321@huawei.com>
>
> 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
>
> [...]
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
^ permalink raw reply [flat|nested] 10+ messages in thread