linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] net: moxa: Fix style issues
@ 2017-07-29 10:42 SZ Lin
  2017-07-29 10:42 ` [PATCH 1/6] net: moxa: Remove braces from single-line body SZ Lin
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: SZ Lin @ 2017-07-29 10:42 UTC (permalink / raw)
  To: davem
  Cc: jarod, jonas.jensen, edumazet, bhumirks, tklauser, netdev,
	linux-kernel, SZ Lin

This patch set fixs the WARNINGs found by the checkpatch.pl tool

SZ Lin (6):
  net: moxa: Remove braces from single-line body
  net: moxa: Prefer 'unsigned int' to bare use of 'unsigned'
  net: moxa: Fix comparison to NULL could be written with !
  net: moxa: Remove extra space after a cast
  net: moxa: Fix for typo in comment to function
    moxart_mac_setup_desc_ring()
  net: moxa: Add spaces preferred around that '{+,-}'

 drivers/net/ethernet/moxa/moxart_ether.c | 15 +++++++--------
 drivers/net/ethernet/moxa/moxart_ether.h |  8 ++++----
 2 files changed, 11 insertions(+), 12 deletions(-)

-- 
2.13.3

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

* [PATCH 1/6] net: moxa: Remove braces from single-line body
  2017-07-29 10:42 [PATCH 0/6] net: moxa: Fix style issues SZ Lin
@ 2017-07-29 10:42 ` SZ Lin
  2017-07-29 10:42 ` [PATCH 2/6] net: moxa: Prefer 'unsigned int' to bare use of 'unsigned' SZ Lin
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: SZ Lin @ 2017-07-29 10:42 UTC (permalink / raw)
  To: davem
  Cc: jarod, jonas.jensen, edumazet, bhumirks, tklauser, netdev,
	linux-kernel, SZ Lin

Remove unnecessary braces from single-line if statement
This warning is found using checkpatch.pl

Signed-off-by: SZ Lin <sz.lin@moxa.com>
---
 drivers/net/ethernet/moxa/moxart_ether.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index c0d7d5eec7e7..105215862949 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -269,9 +269,8 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget)
 		priv->rx_head = rx_head;
 	}
 
-	if (rx < budget) {
+	if (rx < budget)
 		napi_complete_done(napi, rx);
-	}
 
 	priv->reg_imr |= RPKT_FINISH_M;
 	writel(priv->reg_imr, priv->base + REG_INTERRUPT_MASK);
-- 
2.13.3

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

* [PATCH 2/6] net: moxa: Prefer 'unsigned int' to bare use of 'unsigned'
  2017-07-29 10:42 [PATCH 0/6] net: moxa: Fix style issues SZ Lin
  2017-07-29 10:42 ` [PATCH 1/6] net: moxa: Remove braces from single-line body SZ Lin
@ 2017-07-29 10:42 ` SZ Lin
  2017-07-29 10:42 ` [PATCH 3/6] net: moxa: Fix comparison to NULL could be written with ! SZ Lin
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: SZ Lin @ 2017-07-29 10:42 UTC (permalink / raw)
  To: davem
  Cc: jarod, jonas.jensen, edumazet, bhumirks, tklauser, netdev,
	linux-kernel, SZ Lin

Use 'unsigned int' instead of 'unsigned'
This warning is found using checkpatch.pl

Signed-off-by: SZ Lin <sz.lin@moxa.com>
---
 drivers/net/ethernet/moxa/moxart_ether.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index 105215862949..9997e72103d5 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -288,8 +288,8 @@ static int moxart_tx_queue_space(struct net_device *ndev)
 static void moxart_tx_finished(struct net_device *ndev)
 {
 	struct moxart_mac_priv_t *priv = netdev_priv(ndev);
-	unsigned tx_head = priv->tx_head;
-	unsigned tx_tail = priv->tx_tail;
+	unsigned int tx_head = priv->tx_head;
+	unsigned int tx_tail = priv->tx_tail;
 
 	while (tx_tail != tx_head) {
 		dma_unmap_single(&ndev->dev, priv->tx_mapping[tx_tail],
-- 
2.13.3

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

* [PATCH 3/6] net: moxa: Fix comparison to NULL could be written with !
  2017-07-29 10:42 [PATCH 0/6] net: moxa: Fix style issues SZ Lin
  2017-07-29 10:42 ` [PATCH 1/6] net: moxa: Remove braces from single-line body SZ Lin
  2017-07-29 10:42 ` [PATCH 2/6] net: moxa: Prefer 'unsigned int' to bare use of 'unsigned' SZ Lin
@ 2017-07-29 10:42 ` SZ Lin
  2017-07-29 10:42 ` [PATCH 4/6] net: moxa: Remove extra space after a cast SZ Lin
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: SZ Lin @ 2017-07-29 10:42 UTC (permalink / raw)
  To: davem
  Cc: jarod, jonas.jensen, edumazet, bhumirks, tklauser, netdev,
	linux-kernel, SZ Lin

Fixed coding style for null comparisons in moxart_ether driver
to be more consistent with the rest of the kernel coding style

Signed-off-by: SZ Lin <sz.lin@moxa.com>
---
 drivers/net/ethernet/moxa/moxart_ether.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index 9997e72103d5..1d6384873393 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -494,7 +494,7 @@ static int moxart_mac_probe(struct platform_device *pdev)
 	priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE *
 						TX_DESC_NUM, &priv->tx_base,
 						GFP_DMA | GFP_KERNEL);
-	if (priv->tx_desc_base == NULL) {
+	if (!priv->tx_desc_base) {
 		ret = -ENOMEM;
 		goto init_fail;
 	}
@@ -502,7 +502,7 @@ static int moxart_mac_probe(struct platform_device *pdev)
 	priv->rx_desc_base = dma_alloc_coherent(NULL, RX_REG_DESC_SIZE *
 						RX_DESC_NUM, &priv->rx_base,
 						GFP_DMA | GFP_KERNEL);
-	if (priv->rx_desc_base == NULL) {
+	if (!priv->rx_desc_base) {
 		ret = -ENOMEM;
 		goto init_fail;
 	}
-- 
2.13.3

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

* [PATCH 4/6] net: moxa: Remove extra space after a cast
  2017-07-29 10:42 [PATCH 0/6] net: moxa: Fix style issues SZ Lin
                   ` (2 preceding siblings ...)
  2017-07-29 10:42 ` [PATCH 3/6] net: moxa: Fix comparison to NULL could be written with ! SZ Lin
@ 2017-07-29 10:42 ` SZ Lin
  2017-07-29 10:42 ` [PATCH 5/6] net: moxa: Fix for typo in comment to function moxart_mac_setup_desc_ring() SZ Lin
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: SZ Lin @ 2017-07-29 10:42 UTC (permalink / raw)
  To: davem
  Cc: jarod, jonas.jensen, edumazet, bhumirks, tklauser, netdev,
	linux-kernel, SZ Lin

No space is necessary after a cast
This warning is found using checkpatch.pl

Signed-off-by: SZ Lin <sz.lin@moxa.com>
---
 drivers/net/ethernet/moxa/moxart_ether.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index 1d6384873393..31e179a651ae 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -311,7 +311,7 @@ static void moxart_tx_finished(struct net_device *ndev)
 
 static irqreturn_t moxart_mac_interrupt(int irq, void *dev_id)
 {
-	struct net_device *ndev = (struct net_device *) dev_id;
+	struct net_device *ndev = (struct net_device *)dev_id;
 	struct moxart_mac_priv_t *priv = netdev_priv(ndev);
 	unsigned int ists = readl(priv->base + REG_INTERRUPT_STATUS);
 
-- 
2.13.3

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

* [PATCH 5/6] net: moxa: Fix for typo in comment to function moxart_mac_setup_desc_ring()
  2017-07-29 10:42 [PATCH 0/6] net: moxa: Fix style issues SZ Lin
                   ` (3 preceding siblings ...)
  2017-07-29 10:42 ` [PATCH 4/6] net: moxa: Remove extra space after a cast SZ Lin
@ 2017-07-29 10:42 ` SZ Lin
  2017-07-29 10:42 ` [PATCH 6/6] net: moxa: Add spaces preferred around that '{+,-}' SZ Lin
  2017-07-29 21:02 ` [PATCH 0/6] net: moxa: Fix style issues David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: SZ Lin @ 2017-07-29 10:42 UTC (permalink / raw)
  To: davem
  Cc: jarod, jonas.jensen, edumazet, bhumirks, tklauser, netdev,
	linux-kernel, SZ Lin

Signed-off-by: SZ Lin <sz.lin@moxa.com>
---
 drivers/net/ethernet/moxa/moxart_ether.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index 31e179a651ae..2e4effa9fe45 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -161,7 +161,7 @@ static void moxart_mac_setup_desc_ring(struct net_device *ndev)
 
 	priv->rx_head = 0;
 
-	/* reset the MAC controller TX/RX desciptor base address */
+	/* reset the MAC controller TX/RX descriptor base address */
 	writel(priv->tx_base, priv->base + REG_TXR_BASE_ADDRESS);
 	writel(priv->rx_base, priv->base + REG_RXR_BASE_ADDRESS);
 }
-- 
2.13.3

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

* [PATCH 6/6] net: moxa: Add spaces preferred around that '{+,-}'
  2017-07-29 10:42 [PATCH 0/6] net: moxa: Fix style issues SZ Lin
                   ` (4 preceding siblings ...)
  2017-07-29 10:42 ` [PATCH 5/6] net: moxa: Fix for typo in comment to function moxart_mac_setup_desc_ring() SZ Lin
@ 2017-07-29 10:42 ` SZ Lin
  2017-07-29 21:02 ` [PATCH 0/6] net: moxa: Fix style issues David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: SZ Lin @ 2017-07-29 10:42 UTC (permalink / raw)
  To: davem
  Cc: jarod, jonas.jensen, edumazet, bhumirks, tklauser, netdev,
	linux-kernel, SZ Lin

This patch fixes all checkpatch occurences of
"CHECK: spaces preferred around that '{+,-}' (ctx:VxV)"
in moxart_ether code.

Signed-off-by: SZ Lin <sz.lin@moxa.com>
---
 drivers/net/ethernet/moxa/moxart_ether.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.h b/drivers/net/ethernet/moxa/moxart_ether.h
index 686b8957d5cf..bee608b547d1 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.h
+++ b/drivers/net/ethernet/moxa/moxart_ether.h
@@ -55,17 +55,17 @@
 #define RX_DESC2_ADDRESS_VIRT	4
 
 #define TX_DESC_NUM		64
-#define TX_DESC_NUM_MASK	(TX_DESC_NUM-1)
+#define TX_DESC_NUM_MASK	(TX_DESC_NUM - 1)
 #define TX_NEXT(N)		(((N) + 1) & (TX_DESC_NUM_MASK))
 #define TX_BUF_SIZE		1600
-#define TX_BUF_SIZE_MAX		(TX_DESC1_BUF_SIZE_MASK+1)
+#define TX_BUF_SIZE_MAX		(TX_DESC1_BUF_SIZE_MASK + 1)
 #define TX_WAKE_THRESHOLD	16
 
 #define RX_DESC_NUM		64
-#define RX_DESC_NUM_MASK	(RX_DESC_NUM-1)
+#define RX_DESC_NUM_MASK	(RX_DESC_NUM - 1)
 #define RX_NEXT(N)		(((N) + 1) & (RX_DESC_NUM_MASK))
 #define RX_BUF_SIZE		1600
-#define RX_BUF_SIZE_MAX		(RX_DESC1_BUF_SIZE_MASK+1)
+#define RX_BUF_SIZE_MAX		(RX_DESC1_BUF_SIZE_MASK + 1)
 
 #define REG_INTERRUPT_STATUS	0
 #define REG_INTERRUPT_MASK	4
-- 
2.13.3

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

* Re: [PATCH 0/6] net: moxa: Fix style issues
  2017-07-29 10:42 [PATCH 0/6] net: moxa: Fix style issues SZ Lin
                   ` (5 preceding siblings ...)
  2017-07-29 10:42 ` [PATCH 6/6] net: moxa: Add spaces preferred around that '{+,-}' SZ Lin
@ 2017-07-29 21:02 ` David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-07-29 21:02 UTC (permalink / raw)
  To: sz.lin
  Cc: jarod, jonas.jensen, edumazet, bhumirks, tklauser, netdev, linux-kernel

From: SZ Lin <sz.lin@moxa.com>
Date: Sat, 29 Jul 2017 18:42:33 +0800

> This patch set fixs the WARNINGs found by the checkpatch.pl tool

Series applied, thanks.

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

end of thread, other threads:[~2017-07-29 21:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-29 10:42 [PATCH 0/6] net: moxa: Fix style issues SZ Lin
2017-07-29 10:42 ` [PATCH 1/6] net: moxa: Remove braces from single-line body SZ Lin
2017-07-29 10:42 ` [PATCH 2/6] net: moxa: Prefer 'unsigned int' to bare use of 'unsigned' SZ Lin
2017-07-29 10:42 ` [PATCH 3/6] net: moxa: Fix comparison to NULL could be written with ! SZ Lin
2017-07-29 10:42 ` [PATCH 4/6] net: moxa: Remove extra space after a cast SZ Lin
2017-07-29 10:42 ` [PATCH 5/6] net: moxa: Fix for typo in comment to function moxart_mac_setup_desc_ring() SZ Lin
2017-07-29 10:42 ` [PATCH 6/6] net: moxa: Add spaces preferred around that '{+,-}' SZ Lin
2017-07-29 21:02 ` [PATCH 0/6] net: moxa: Fix style issues David Miller

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).