* [PATCH net-next 0/6] net: hostess_sv11: clean up some code style issues
@ 2021-06-17 14:53 Peng Li
2021-06-17 14:53 ` [PATCH net-next 1/6] net: hostess_sv11: fix the code style issue about "foo* bar" Peng Li
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Peng Li @ 2021-06-17 14:53 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, huangguangbin2
This patchset clean up some code style issues.
Peng Li (6):
net: hostess_sv11: fix the code style issue about "foo* bar"
net: hostess_sv11: move out assignment in if condition
net: hostess_sv11: remove trailing whitespace
net: hostess_sv11: fix the code style issue about switch and case
net: hostess_sv11: fix the comments style issue
net: hostess_sv11: fix the alignment issue
drivers/net/wan/hostess_sv11.c | 111 +++++++++++++++++++----------------------
1 file changed, 51 insertions(+), 60 deletions(-)
--
2.8.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next 1/6] net: hostess_sv11: fix the code style issue about "foo* bar"
2021-06-17 14:53 [PATCH net-next 0/6] net: hostess_sv11: clean up some code style issues Peng Li
@ 2021-06-17 14:53 ` Peng Li
2021-06-17 14:53 ` [PATCH net-next 2/6] net: hostess_sv11: move out assignment in if condition Peng Li
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Peng Li @ 2021-06-17 14:53 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, huangguangbin2
Fix the checkpatch error as "foo* bar" should be "foo *bar".
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/hostess_sv11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index 6c05c4c..a18c09d 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -48,7 +48,7 @@ static int dma;
* Network driver support routines
*/
-static inline struct z8530_dev* dev_to_sv(struct net_device *dev)
+static inline struct z8530_dev *dev_to_sv(struct net_device *dev)
{
return (struct z8530_dev *)dev_to_hdlc(dev)->priv;
}
--
2.8.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 2/6] net: hostess_sv11: move out assignment in if condition
2021-06-17 14:53 [PATCH net-next 0/6] net: hostess_sv11: clean up some code style issues Peng Li
2021-06-17 14:53 ` [PATCH net-next 1/6] net: hostess_sv11: fix the code style issue about "foo* bar" Peng Li
@ 2021-06-17 14:53 ` Peng Li
2021-06-17 14:53 ` [PATCH net-next 3/6] net: hostess_sv11: remove trailing whitespace Peng Li
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Peng Li @ 2021-06-17 14:53 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, huangguangbin2
Should not use assignment in if condition.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/hostess_sv11.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index a18c09d..8dce8b1 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -340,7 +340,8 @@ static struct z8530_dev *sv11_unit;
int init_module(void)
{
- if ((sv11_unit = sv11_init(io, irq)) == NULL)
+ sv11_unit = sv11_init(io, irq);
+ if (!sv11_unit)
return -ENODEV;
return 0;
}
--
2.8.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 3/6] net: hostess_sv11: remove trailing whitespace
2021-06-17 14:53 [PATCH net-next 0/6] net: hostess_sv11: clean up some code style issues Peng Li
2021-06-17 14:53 ` [PATCH net-next 1/6] net: hostess_sv11: fix the code style issue about "foo* bar" Peng Li
2021-06-17 14:53 ` [PATCH net-next 2/6] net: hostess_sv11: move out assignment in if condition Peng Li
@ 2021-06-17 14:53 ` Peng Li
2021-06-17 14:53 ` [PATCH net-next 4/6] net: hostess_sv11: fix the code style issue about switch and case Peng Li
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Peng Li @ 2021-06-17 14:53 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, huangguangbin2
This patch removes trailing whitespace.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/hostess_sv11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index 8dce8b1..8914cdd 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -9,7 +9,7 @@
*
* It supports DMA using two DMA channels in SYNC mode. The driver doesn't
* use these facilities
- *
+ *
* The control port is at io+1, the data at io+3 and turning off the DMA
* is done by writing 0 to io+4
*
--
2.8.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 4/6] net: hostess_sv11: fix the code style issue about switch and case
2021-06-17 14:53 [PATCH net-next 0/6] net: hostess_sv11: clean up some code style issues Peng Li
` (2 preceding siblings ...)
2021-06-17 14:53 ` [PATCH net-next 3/6] net: hostess_sv11: remove trailing whitespace Peng Li
@ 2021-06-17 14:53 ` Peng Li
2021-06-17 14:53 ` [PATCH net-next 5/6] net: hostess_sv11: fix the comments style issue Peng Li
2021-06-17 14:53 ` [PATCH net-next 6/6] net: hostess_sv11: fix the alignment issue Peng Li
5 siblings, 0 replies; 9+ messages in thread
From: Peng Li @ 2021-06-17 14:53 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, huangguangbin2
According to the chackpatch.pl,
switch and case should be at the same indent.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/hostess_sv11.c | 54 +++++++++++++++++++++---------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index 8914cdd..7a59d7e 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -85,15 +85,15 @@ static int hostess_open(struct net_device *d)
* Link layer up
*/
switch (dma) {
- case 0:
- err = z8530_sync_open(d, &sv11->chanA);
- break;
- case 1:
- err = z8530_sync_dma_open(d, &sv11->chanA);
- break;
- case 2:
- err = z8530_sync_txdma_open(d, &sv11->chanA);
- break;
+ case 0:
+ err = z8530_sync_open(d, &sv11->chanA);
+ break;
+ case 1:
+ err = z8530_sync_dma_open(d, &sv11->chanA);
+ break;
+ case 2:
+ err = z8530_sync_txdma_open(d, &sv11->chanA);
+ break;
}
if (err)
@@ -102,15 +102,15 @@ static int hostess_open(struct net_device *d)
err = hdlc_open(d);
if (err) {
switch (dma) {
- case 0:
- z8530_sync_close(d, &sv11->chanA);
- break;
- case 1:
- z8530_sync_dma_close(d, &sv11->chanA);
- break;
- case 2:
- z8530_sync_txdma_close(d, &sv11->chanA);
- break;
+ case 0:
+ z8530_sync_close(d, &sv11->chanA);
+ break;
+ case 1:
+ z8530_sync_dma_close(d, &sv11->chanA);
+ break;
+ case 2:
+ z8530_sync_txdma_close(d, &sv11->chanA);
+ break;
}
return err;
}
@@ -136,15 +136,15 @@ static int hostess_close(struct net_device *d)
netif_stop_queue(d);
switch (dma) {
- case 0:
- z8530_sync_close(d, &sv11->chanA);
- break;
- case 1:
- z8530_sync_dma_close(d, &sv11->chanA);
- break;
- case 2:
- z8530_sync_txdma_close(d, &sv11->chanA);
- break;
+ case 0:
+ z8530_sync_close(d, &sv11->chanA);
+ break;
+ case 1:
+ z8530_sync_dma_close(d, &sv11->chanA);
+ break;
+ case 2:
+ z8530_sync_txdma_close(d, &sv11->chanA);
+ break;
}
return 0;
}
--
2.8.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 5/6] net: hostess_sv11: fix the comments style issue
2021-06-17 14:53 [PATCH net-next 0/6] net: hostess_sv11: clean up some code style issues Peng Li
` (3 preceding siblings ...)
2021-06-17 14:53 ` [PATCH net-next 4/6] net: hostess_sv11: fix the code style issue about switch and case Peng Li
@ 2021-06-17 14:53 ` Peng Li
2021-06-17 16:29 ` Andrew Lunn
2021-06-17 14:53 ` [PATCH net-next 6/6] net: hostess_sv11: fix the alignment issue Peng Li
5 siblings, 1 reply; 9+ messages in thread
From: Peng Li @ 2021-06-17 14:53 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, huangguangbin2
Networking block comments don't use an empty /* line,
use /* Comment...
Block comments use * on subsequent lines.
Block comments use a trailing */ on a separate line.
This patch fixes the comments style issues.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/hostess_sv11.c | 48 +++++++++++++++++-------------------------
1 file changed, 19 insertions(+), 29 deletions(-)
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index 7a59d7e..4085590 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -44,8 +44,7 @@
static int dma;
-/*
- * Network driver support routines
+/* Network driver support routines
*/
static inline struct z8530_dev *dev_to_sv(struct net_device *dev)
@@ -53,8 +52,7 @@ static inline struct z8530_dev *dev_to_sv(struct net_device *dev)
return (struct z8530_dev *)dev_to_hdlc(dev)->priv;
}
-/*
- * Frame receive. Simple for our card as we do HDLC and there
+/* Frame receive. Simple for our card as we do HDLC and there
* is no funny garbage involved
*/
@@ -65,15 +63,13 @@ static void hostess_input(struct z8530_channel *c, struct sk_buff *skb)
skb->protocol = hdlc_type_trans(skb, c->netdevice);
skb_reset_mac_header(skb);
skb->dev = c->netdevice;
- /*
- * Send it to the PPP layer. We don't have time to process
+ /* Send it to the PPP layer. We don't have time to process
* it right now.
*/
netif_rx(skb);
}
-/*
- * We've been placed in the UP state
+/* We've been placed in the UP state
*/
static int hostess_open(struct net_device *d)
@@ -81,8 +77,7 @@ static int hostess_open(struct net_device *d)
struct z8530_dev *sv11 = dev_to_sv(d);
int err = -1;
- /*
- * Link layer up
+ /* Link layer up
*/
switch (dma) {
case 0:
@@ -127,8 +122,7 @@ static int hostess_open(struct net_device *d)
static int hostess_close(struct net_device *d)
{
struct z8530_dev *sv11 = dev_to_sv(d);
- /*
- * Discard new frames
+ /* Discard new frames
*/
sv11->chanA.rx_function = z8530_null_rx;
@@ -152,12 +146,12 @@ static int hostess_close(struct net_device *d)
static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
{
/* struct z8530_dev *sv11=dev_to_sv(d);
- z8530_ioctl(d,&sv11->chanA,ifr,cmd) */
+ * z8530_ioctl(d,&sv11->chanA,ifr,cmd)
+ */
return hdlc_ioctl(d, ifr, cmd);
}
-/*
- * Passed network frames, fire them downwind.
+/* Passed network frames, fire them downwind.
*/
static netdev_tx_t hostess_queue_xmit(struct sk_buff *skb,
@@ -174,8 +168,7 @@ static int hostess_attach(struct net_device *dev, unsigned short encoding,
return -EINVAL;
}
-/*
- * Description block for a Comtrol Hostess SV11 card
+/* Description block for a Comtrol Hostess SV11 card
*/
static const struct net_device_ops hostess_ops = {
@@ -189,8 +182,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
{
struct z8530_dev *sv;
struct net_device *netdev;
- /*
- * Get the needed I/O space
+ /* Get the needed I/O space
*/
if (!request_region(iobase, 8, "Comtrol SV11")) {
@@ -202,8 +194,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
if (!sv)
goto err_kzalloc;
- /*
- * Stuff in the I/O addressing
+ /* Stuff in the I/O addressing
*/
sv->active = 0;
@@ -218,7 +209,8 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
outb(0, iobase + 4); /* DMA off */
/* We want a fast IRQ for this device. Actually we'd like an even faster
- IRQ ;) - This is one driver RtLinux is made for */
+ * IRQ ;) - This is one driver RtLinux is made for
+ */
if (request_irq(irq, z8530_interrupt, 0,
"Hostess SV11", sv) < 0) {
@@ -232,8 +224,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
sv->chanB.dev = sv;
if (dma) {
- /*
- * You can have DMA off or 1 and 3 thats the lot
+ /* You can have DMA off or 1 and 3 thats the lot
* on the Comtrol.
*/
sv->chanA.txdma = 3;
@@ -248,11 +239,11 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
}
/* Kill our private IRQ line the hostess can end up chattering
- until the configuration is set */
+ * until the configuration is set
+ */
disable_irq(irq);
- /*
- * Begin normal initialise
+ /* Begin normal initialise
*/
if (z8530_init(sv)) {
@@ -268,8 +259,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
enable_irq(irq);
- /*
- * Now we can take the IRQ
+ /* Now we can take the IRQ
*/
sv->chanA.netdevice = netdev = alloc_hdlcdev(sv);
--
2.8.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 6/6] net: hostess_sv11: fix the alignment issue
2021-06-17 14:53 [PATCH net-next 0/6] net: hostess_sv11: clean up some code style issues Peng Li
` (4 preceding siblings ...)
2021-06-17 14:53 ` [PATCH net-next 5/6] net: hostess_sv11: fix the comments style issue Peng Li
@ 2021-06-17 14:53 ` Peng Li
5 siblings, 0 replies; 9+ messages in thread
From: Peng Li @ 2021-06-17 14:53 UTC (permalink / raw)
To: davem, kuba, xie.he.0141, ms, willemb
Cc: netdev, linux-kernel, huangguangbin2
Alignment should match open parenthesis.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/wan/hostess_sv11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index 4085590..38c1a91 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -155,7 +155,7 @@ static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
*/
static netdev_tx_t hostess_queue_xmit(struct sk_buff *skb,
- struct net_device *d)
+ struct net_device *d)
{
return z8530_queue_xmit(&dev_to_sv(d)->chanA, skb);
}
--
2.8.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 5/6] net: hostess_sv11: fix the comments style issue
2021-06-17 14:53 ` [PATCH net-next 5/6] net: hostess_sv11: fix the comments style issue Peng Li
@ 2021-06-17 16:29 ` Andrew Lunn
2021-06-18 0:45 ` lipeng (Y)
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2021-06-17 16:29 UTC (permalink / raw)
To: Peng Li
Cc: davem, kuba, xie.he.0141, ms, willemb, netdev, linux-kernel,
huangguangbin2
> @@ -152,12 +146,12 @@ static int hostess_close(struct net_device *d)
> static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
> {
> /* struct z8530_dev *sv11=dev_to_sv(d);
> - z8530_ioctl(d,&sv11->chanA,ifr,cmd) */
> + * z8530_ioctl(d,&sv11->chanA,ifr,cmd)
> + */
> return hdlc_ioctl(d, ifr, cmd);
> }
That looks more like dead code than anything else. I would suggest you
do a git blame to see if there is anything interesting about this, and
if not, remove it.
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 5/6] net: hostess_sv11: fix the comments style issue
2021-06-17 16:29 ` Andrew Lunn
@ 2021-06-18 0:45 ` lipeng (Y)
0 siblings, 0 replies; 9+ messages in thread
From: lipeng (Y) @ 2021-06-18 0:45 UTC (permalink / raw)
To: Andrew Lunn
Cc: davem, kuba, xie.he.0141, ms, willemb, netdev, linux-kernel,
huangguangbin2
在 2021/6/18 0:29, Andrew Lunn 写道:
>> @@ -152,12 +146,12 @@ static int hostess_close(struct net_device *d)
>> static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
>> {
>> /* struct z8530_dev *sv11=dev_to_sv(d);
>> - z8530_ioctl(d,&sv11->chanA,ifr,cmd) */
>> + * z8530_ioctl(d,&sv11->chanA,ifr,cmd)
>> + */
>> return hdlc_ioctl(d, ifr, cmd);
>> }
> That looks more like dead code than anything else. I would suggest you
> do a git blame to see if there is anything interesting about this, and
> if not, remove it.
>
> Andrew
> .
Hi, Andrew
It's dead code, will remove it.
Thanks for your advice.
Peng Li
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-06-18 0:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 14:53 [PATCH net-next 0/6] net: hostess_sv11: clean up some code style issues Peng Li
2021-06-17 14:53 ` [PATCH net-next 1/6] net: hostess_sv11: fix the code style issue about "foo* bar" Peng Li
2021-06-17 14:53 ` [PATCH net-next 2/6] net: hostess_sv11: move out assignment in if condition Peng Li
2021-06-17 14:53 ` [PATCH net-next 3/6] net: hostess_sv11: remove trailing whitespace Peng Li
2021-06-17 14:53 ` [PATCH net-next 4/6] net: hostess_sv11: fix the code style issue about switch and case Peng Li
2021-06-17 14:53 ` [PATCH net-next 5/6] net: hostess_sv11: fix the comments style issue Peng Li
2021-06-17 16:29 ` Andrew Lunn
2021-06-18 0:45 ` lipeng (Y)
2021-06-17 14:53 ` [PATCH net-next 6/6] net: hostess_sv11: fix the alignment issue Peng Li
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).