staging: netlogic: Fix several checkpatch issues
v3 cover staging: netlogic: Fix several checkpatch issues
This patchset updates the netlogic driver in order to clean up completely the driver source code.
Laura Garcia Liebana (7):
staging: netlogic: Fix several parentheses alignments
staging: netlogic: Remove blank spaces after a cast
staging: netlogic: Fix multiple assignments
staging: netlogic: Fix CamelCase for constants
staging: netlogic: Fix comparison to NULL
staging: netlogic: Insert spaces around operator
staging: netlogic: Fix indent for conditional statement
Changes in v2:
- Patch 2/7 Include parentheses for pointers
- Patch 5/7 Avoid to change comparison for devm_ioremap_resource value
Changes in v3:
- Patch 2/7 Change parenthesis position
drivers/staging/netlogic/platform_net.c | 6 +- drivers/staging/netlogic/xlr_net.c | 174 +++--- drivers/staging/netlogic/xlr_net.h | 978 ++++++++++++++++---------------- 3 files changed, 581 insertions(+), 577 deletions(-)
Signature · 1 line
2.7.0
PATCH v3 1/7 staging: netlogic: Fix several parentheses alignments
Align arguments with the open parenthesis. Checkpatch found these issues.
--- drivers/staging/netlogic/platform_net.c | 6 +- drivers/staging/netlogic/xlr_net.c | 155 ++++++++++++++++---------------- 2 files changed, 82 insertions(+), 79 deletions(-)
drivers/staging/netlogic/platform_net.c +3 -3
@@ -170,7 +170,7 @@ static void xls_gmac_init(void) xlr_net_dev0.num_resources =2 ;xlr_resource_init (&xlr_net0_res[0 ], xlr_gmac_offsets[0 ], - xlr_gmac_irqs[0 ]); + xlr_gmac_irqs[0 ]);platform_device_register (&xlr_net_dev0);/* second block is XAUI, not supported yet */
@@ -183,7 +183,7 @@ static void xls_gmac_init(void) ndata0.phy_addr[mac] = mac +0x10 ;xlr_resource_init (&xlr_net0_res[mac *2 ], - xlr_gmac_offsets[mac], + xlr_gmac_offsets[mac], xlr_gmac_irqs[mac]); } xlr_net_dev0.num_resources =8 ;
@@ -223,7 +223,7 @@ static void xlr_gmac_init(void) ndata0.tx_stnid[mac] =FMN_STNID_GMAC0_TX0 + mac; ndata0.phy_addr[mac] = mac;xlr_resource_init (&xlr_net0_res[mac *2 ], xlr_gmac_offsets[mac], - xlr_gmac_irqs[mac]); + xlr_gmac_irqs[mac]); } xlr_net_dev0.num_resources =8 ; xlr_net_dev0.resource = xlr_net0_res;
drivers/staging/netlogic/xlr_net.c +79 -76
371 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH v3 2/7 staging: netlogic: Remove blank spaces after a cast
In reply to Laura Garcia LiebanaRemove uneeded blank spaces after a cast. Checkpatch found these issues.
---
v2: Include parentheses for pointers, as Julia suggested
v3: Change parenthesis position, as Sudip suggested
drivers/staging/netlogic/xlr_net.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/netlogic/xlr_net.c +5 -5
@@ -130,13 +130,13 @@ static void xlr_net_fmn_handler(int bkt, int src_stnid, int size, int code,struct xlr_net_priv *priv;u32 port, length;unsigned char *addr; -struct xlr_adapter *adapter = (struct xlr_adapter *) arg; +struct xlr_adapter *adapter = (struct xlr_adapter *)arg; length = (msg->msg0 >>40 ) &0x3fff ;if (length ==0 ) { addr =bus_to_virt (msg->msg0 &0xffffffffffULL ); addr = addr -MAC_SKB_BACK_PTR_SIZE ; - skb = (struct sk_buff *) *(unsigned long *)addr; + skb = (struct sk_buff *)(*(unsigned long *)addr);dev_kfree_skb_any ((struct sk_buff *)addr); }else { addr = (unsigned char *)
@@ -144,7 +144,7 @@ static void xlr_net_fmn_handler(int bkt, int src_stnid, int size, int code, length = length -BYTE_OFFSET -MAC_CRC_LEN ; port = ((int )msg->msg0) &0x0f ; addr = addr -MAC_SKB_BACK_PTR_SIZE ; - skb = (struct sk_buff *) *(unsigned long *)addr; + skb = (struct sk_buff *)(*(unsigned long *)addr); skb->dev = adapter->netdev[port];if (skb->dev ==NULL )return ;
@@ -270,7 +270,7 @@ static void xlr_make_tx_desc(struct nlm_fmn_msg *msg, unsigned long addr,static void __maybe_unused xlr_wakeup_queue (unsigned long dev) { -struct net_device *ndev = (struct net_device *) dev; +struct net_device *ndev = (struct net_device *)dev;struct xlr_net_priv *priv =netdev_priv (ndev);struct phy_device *phydev =xlr_get_phydev (priv);
@@ -663,7 +663,7 @@ static int xlr_phy_write(u32 *base_addr, int phy_addr, int regnum, u16 val)xlr_nae_wreg (base_addr,R_MII_MGMT_ADDRESS , (phy_addr <<8 ) | regnum);/* Write the data which starts the write cycle */ -xlr_nae_wreg (base_addr,R_MII_MGMT_WRITE_DATA , (u32 ) val); +xlr_nae_wreg (base_addr,R_MII_MGMT_WRITE_DATA , (u32 )val);/* poll for the read cycle to complete */ while (!timedout) {
Signature · 1 line
2.7.0
PATCH v3 3/7 staging: netlogic: Fix multiple assignments
In reply to Laura Garcia LiebanaAvoid the use of multiple assignments in a single line. Checkpatch found this issue.
--- drivers/staging/netlogic/xlr_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/netlogic/xlr_net.c +2 -1
@@ -265,7 +265,8 @@ static void xlr_make_tx_desc(struct nlm_fmn_msg *msg, unsigned long addr, ((u64 )fr_stn_id <<54 ) |/* Free back id */ (u64 )0 <<40 |/* Set len to 0 */ ((u64)physkb & 0xffffffff)); /* 32bit address */ - msg->msg2 = msg->msg3 =0 ; + msg->msg2 =0 ; + msg->msg3 =0 ; }static void __maybe_unused xlr_wakeup_queue (unsigned long dev)
Signature · 1 line
2.7.0
PATCH v3 4/7 staging: netlogic: Fix CamelCase for constants
In reply to Laura Garcia LiebanaAvoid the use of CamelCase for constants. Checkpatch detected these issues.
--- drivers/staging/netlogic/xlr_net.c | 30 +- drivers/staging/netlogic/xlr_net.h | 978 ++++++++++++++++++------------------- 2 files changed, 504 insertions(+), 504 deletions(-)
drivers/staging/netlogic/xlr_net.c +15 -15
@@ -932,13 +932,13 @@ static void xlr_port_enable(struct xlr_net_priv *priv)/* Setup tx control reg */ xlr_reg_update (priv->base_addr,R_TX_CONTROL , - ((1 << O_TX_CONTROL__TxEnable) | - (512 << O_TX_CONTROL__TxThreshold)),0x3fff ); + ((1 <<O_TX_CONTROL__TXENABLE ) | + (512 <<O_TX_CONTROL__TXTHRESHOLD )),0x3fff );/* Setup rx control reg */ xlr_reg_update (priv->base_addr,R_RX_CONTROL , -1 << O_RX_CONTROL__RxEnable, -1 << O_RX_CONTROL__RxEnable); +1 <<O_RX_CONTROL__RXENABLE , +1 <<O_RX_CONTROL__RXENABLE ); }static void xlr_port_disable (struct xlr_net_priv *priv)
@@ -953,12 +953,12 @@ static void xlr_port_disable(struct xlr_net_priv *priv)/* Setup tx control reg */ xlr_reg_update (priv->base_addr,R_TX_CONTROL , - ((1 << O_TX_CONTROL__TxEnable) | - (512 << O_TX_CONTROL__TxThreshold)),0 ); + ((1 <<O_TX_CONTROL__TXENABLE ) | + (512 <<O_TX_CONTROL__TXTHRESHOLD )),0 );/* Setup rx control reg */ xlr_reg_update (priv->base_addr,R_RX_CONTROL , -1 << O_RX_CONTROL__RxEnable,0 ); +1 <<O_RX_CONTROL__RXENABLE ,0 ); }/*
@@ -974,9 +974,9 @@ static int xlr_gmac_init(struct xlr_net_priv *priv,xlr_port_disable (priv);xlr_nae_wreg (priv->base_addr,R_DESC_PACK_CTRL , - (1 << O_DESC_PACK_CTRL__MaxEntry) | - (BYTE_OFFSET << O_DESC_PACK_CTRL__ByteOffset) | - (1600 << O_DESC_PACK_CTRL__RegularSize)); + (1 <<O_DESC_PACK_CTRL__MAXENTRY ) | + (BYTE_OFFSET <<O_DESC_PACK_CTRL__BYTEOFFSET ) | + (1600 <<O_DESC_PACK_CTRL__REGULARSIZE )); ret =xlr_setup_mdio (priv, pdev);if (ret)
@@ -988,13 +988,13 @@ static int xlr_gmac_init(struct xlr_net_priv *priv,/* speed 2.5Mhz */ xlr_nae_wreg (priv->base_addr,R_CORECONTROL ,0x02 );/* Setup Interrupt mask reg */ -xlr_nae_wreg (priv->base_addr,R_INTMASK , (1 << O_INTMASK__TxIllegal) | - (1 << O_INTMASK__MDInt) | (1 << O_INTMASK__TxFetchError) | - (1 << O_INTMASK__P2PSpillEcc) | (1 << O_INTMASK__TagFull) | - (1 << O_INTMASK__Underrun) | (1 << O_INTMASK__Abort)); +xlr_nae_wreg (priv->base_addr,R_INTMASK , (1 <<O_INTMASK__TXILLEGAL ) | + (1 <<O_INTMASK__MDINT ) | (1 <<O_INTMASK__TXFETCHERROR ) | + (1 <<O_INTMASK__P2PSPILLECC ) | (1 <<O_INTMASK__TAGFULL ) | + (1 <<O_INTMASK__UNDERRUN ) | (1 <<O_INTMASK__ABORT ));/* Clear all stats */ -xlr_reg_update (priv->base_addr,R_STATCTRL ,0 ,1 << O_STATCTRL__ClrCnt); +xlr_reg_update (priv->base_addr,R_STATCTRL ,0 ,1 <<O_STATCTRL__CLRCNT );xlr_reg_update (priv->base_addr,R_STATCTRL ,1 <<2 ,1 <<2 );return 0 ; }
drivers/staging/netlogic/xlr_net.h +489 -489
1,065 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH v3 5/7 staging: netlogic: Fix comparison to NULL
In reply to Laura Garcia LiebanaAvoid the use of comparison to NULL, use !<variable> instead. Checkpatch detected these issues.
---
v2: Avoid to change comparison for devm_ioremap_resource value, as Julia suggested
drivers/staging/netlogic/xlr_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/netlogic/xlr_net.c +2 -2
@@ -146,7 +146,7 @@ static void xlr_net_fmn_handler(int bkt, int src_stnid, int size, int code, addr = addr -MAC_SKB_BACK_PTR_SIZE ; skb = (struct sk_buff *)(*(unsigned long *)addr); skb->dev = adapter->netdev[port]; -if (skb->dev ==NULL ) +if (!skb->dev)return ; ndev = skb->dev; priv =netdev_priv (ndev);
@@ -1052,7 +1052,7 @@ static int xlr_net_probe(struct platform_device *pdev) adapter->netdev[port] = ndev; res =platform_get_resource (pdev,IORESOURCE_IRQ , port); -if (res ==NULL ) { +if (!res) {pr_err ("No irq resource for MAC %d\n" , priv->port_id); err = -ENODEV ; goto err_gmac;
Signature · 1 line
2.7.0
PATCH v3 6/7 staging: netlogic: Insert spaces around operator
In reply to Laura Garcia LiebanaSpaces preferred around that '/' (ctx:VxV). Checkpatch detected these issues.
--- drivers/staging/netlogic/xlr_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/netlogic/xlr_net.c +2 -2
@@ -206,7 +206,7 @@ static int xlr_net_fill_rx_ring(struct net_device *ndev)struct xlr_net_priv *priv =netdev_priv (ndev);int i; -for (i =0 ; i <MAX_FRIN_SPILL /4 ; i++) { +for (i =0 ; i <MAX_FRIN_SPILL /4 ; i++) { skb_data =xlr_alloc_skb ();if (!skb_data) {pr_err ("SKB allocation failed\n" );
@@ -1023,7 +1023,7 @@ static int xlr_net_probe(struct platform_device *pdev)* Each controller has 4 gmac ports, mapping each controller * under one parent device, 4 gmac ports under one device. */ -for (port =0 ; port < pdev->num_resources/2 ; port++) { +for (port =0 ; port < pdev->num_resources /2 ; port++) { ndev =alloc_etherdev_mq (sizeof (struct xlr_net_priv ),32 );if (!ndev) {pr_err ("Allocation of Ethernet device failed\n" );
Signature · 1 line
2.7.0
PATCH v3 7/7 staging: netlogic: Fix indent for conditional statement
In reply to Laura Garcia LiebanaInsert code indent for conditional statements. Checkpatch detected this issue.
--- drivers/staging/netlogic/xlr_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/netlogic/xlr_net.c +1 -1
@@ -326,7 +326,7 @@ static void xlr_hw_set_mac_addr(struct net_device *ndev)if (priv->nd->phy_interface ==PHY_INTERFACE_MODE_RGMII || priv->nd->phy_interface ==PHY_INTERFACE_MODE_SGMII ) -xlr_reg_update (priv->base_addr,R_IPG_IFG ,MAC_B2B_IPG ,0x7f ); +xlr_reg_update (priv->base_addr,R_IPG_IFG ,MAC_B2B_IPG ,0x7f ); }static int xlr_net_set_mac_addr (struct net_device *ndev,void *data)
Signature · 1 line
2.7.0