net: systemport: checkpatch fixes
Subsystems (3)
cover net: systemport: checkpatch fixes
Hi David,
These two patches fixes "CHECK" warnings issued by checkpatch.pl.
Thanks!
Florian Fainelli (2):
net: systemport: align multiple lines correctly
net: systemport: use kcalloc instead of kzalloc
drivers/net/ethernet/broadcom/bcmsysport.c | 113 ++++++++++++++--------------- 1 file changed, 56 insertions(+), 57 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 net: systemport: align multiple lines correctly
checkpatch.pl flagged a bunch of: "CHECK: Alignment should match open parenthesis" problems, fix all of them.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 107 ++++++++++++++--------------- 1 file changed, 53 insertions(+), 54 deletions(-)
drivers/net/ethernet/broadcom/bcmsysport.c +53 -54
@@ -81,14 +81,14 @@ static inline void dma_desc_set_addr(struct bcm_sysport_priv *priv, {#ifdef CONFIG_PHYS_ADDR_T_64BIT __raw_writel (upper_32_bits (addr) &DESC_ADDR_HI_MASK , - d +DESC_ADDR_HI_STATUS_LEN ); + d +DESC_ADDR_HI_STATUS_LEN );#endif __raw_writel (lower_32_bits (addr), d +DESC_ADDR_LO ); }static inline void tdma_port_write_desc_addr (struct bcm_sysport_priv *priv, -struct dma_desc *desc, -unsigned int port) +struct dma_desc *desc, +unsigned int port) {/* Ports are latched, so write upper address first */ tdma_writel (priv, desc->addr_status_len,TDMA_WRITE_PORT_HI (port));
@@ -108,7 +108,7 @@ static int bcm_sysport_set_settings(struct net_device *dev, }static int bcm_sysport_get_settings (struct net_device *dev, -struct ethtool_cmd *cmd) +struct ethtool_cmd *cmd) {struct bcm_sysport_priv *priv =netdev_priv (dev);
@@ -119,7 +119,7 @@ static int bcm_sysport_get_settings(struct net_device *dev, }static int bcm_sysport_set_rx_csum (struct net_device *dev, -netdev_features_t wanted) +netdev_features_t wanted) {struct bcm_sysport_priv *priv =netdev_priv (dev);u32 reg;
@@ -145,7 +145,7 @@ static int bcm_sysport_set_rx_csum(struct net_device *dev, }static int bcm_sysport_set_tx_csum (struct net_device *dev, -netdev_features_t wanted) +netdev_features_t wanted) {struct bcm_sysport_priv *priv =netdev_priv (dev);u32 reg;
@@ -165,7 +165,7 @@ static int bcm_sysport_set_tx_csum(struct net_device *dev, }static int bcm_sysport_set_features (struct net_device *dev, -netdev_features_t features) +netdev_features_t features) {netdev_features_t changed = features ^ dev->features;netdev_features_t wanted = dev->wanted_features;
@@ -261,7 +261,7 @@ static const struct bcm_sysport_stats bcm_sysport_gstrings_stats[] = {/* RXCHK misc statistics */ STAT_RXCHK ("rxchk_bad_csum" , mib.rxchk_bad_csum,RXCHK_BAD_CSUM_CNTR ),STAT_RXCHK ("rxchk_other_pkt_disc" , mib.rxchk_other_pkt_disc, -RXCHK_OTHER_DISC_CNTR ), +RXCHK_OTHER_DISC_CNTR ),/* RBUF misc statistics */ STAT_RBUF ("rbuf_ovflow_cnt" , mib.rbuf_ovflow_cnt,RBUF_OVFL_DISC_CNTR ), STAT_RBUF("rbuf_err_cnt", mib.rbuf_err_cnt, RBUF_ERR_PKT_CNTR),
@@ -270,7 +270,7 @@ static const struct bcm_sysport_stats bcm_sysport_gstrings_stats[] = {#define BCM_SYSPORT_STATS_LEN ARRAY_SIZE(bcm_sysport_gstrings_stats)static void bcm_sysport_get_drvinfo (struct net_device *dev, -struct ethtool_drvinfo *info) +struct ethtool_drvinfo *info) {strlcpy (info->driver,KBUILD_MODNAME ,sizeof (info->driver));strlcpy (info->version,"0.1" ,sizeof (info->version));
@@ -303,7 +303,7 @@ static int bcm_sysport_get_sset_count(struct net_device *dev, int string_set) }static void bcm_sysport_get_strings (struct net_device *dev, -u32 stringset,u8 *data) +u32 stringset,u8 *data) {int i;
@@ -311,8 +311,8 @@ static void bcm_sysport_get_strings(struct net_device *dev,case ETH_SS_STATS :for (i =0 ; i <BCM_SYSPORT_STATS_LEN ; i++) {memcpy (data + i *ETH_GSTRING_LEN , - bcm_sysport_gstrings_stats[i].stat_string, -ETH_GSTRING_LEN ); + bcm_sysport_gstrings_stats[i].stat_string, +ETH_GSTRING_LEN ); }break ;default :
@@ -362,7 +362,7 @@ static void bcm_sysport_update_mib_counters(struct bcm_sysport_priv *priv) }static void bcm_sysport_get_stats (struct net_device *dev, -struct ethtool_stats *stats,u64 *data) +struct ethtool_stats *stats,u64 *data) {struct bcm_sysport_priv *priv =netdev_priv (dev);int i;
@@ -406,7 +406,7 @@ static int bcm_sysport_rx_refill(struct bcm_sysport_priv *priv, } mapping =dma_map_single (kdev, cb->skb->data, -RX_BUF_LENGTH ,DMA_FROM_DEVICE ); +RX_BUF_LENGTH ,DMA_FROM_DEVICE ); ret =dma_mapping_error (kdev, mapping);if (ret) {bcm_sysport_free_cb (cb);
@@ -470,22 +470,20 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, to_process = p_index - priv->rx_c_index;netif_dbg (priv, rx_status, ndev, -"p_index=%d rx_c_index=%d to_process=%d\n" , - p_index, priv->rx_c_index, to_process); - -while ((processed < to_process) && - (processed < budget)) { +"p_index=%d rx_c_index=%d to_process=%d\n" , + p_index, priv->rx_c_index, to_process); +while ((processed < to_process) && (processed < budget)) { cb = &priv->rx_cbs[priv->rx_read_ptr]; skb = cb->skb;dma_unmap_single (kdev,dma_unmap_addr (cb, dma_addr), -RX_BUF_LENGTH ,DMA_FROM_DEVICE ); +RX_BUF_LENGTH ,DMA_FROM_DEVICE );/* Extract the Receive Status Block prepended */ rsb = (struct bcm_rsb *)skb->data; len = (rsb->rx_status_len >>DESC_LEN_SHIFT ) &DESC_LEN_MASK ; status = (rsb->rx_status_len >>DESC_STATUS_SHIFT ) & -DESC_STATUS_MASK ; +DESC_STATUS_MASK ; processed++; priv->rx_read_ptr++;
@@ -493,9 +491,9 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, priv->rx_read_ptr =0 ;netif_dbg (priv, rx_status, ndev, -"p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n" , - p_index, priv->rx_c_index, priv->rx_read_ptr, - len, status); +"p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n" , + p_index, priv->rx_c_index, priv->rx_read_ptr, + len, status);if (unlikely (!skb)) {netif_err (priv, rx_err, ndev,"out of memory!\n" );
@@ -554,9 +552,9 @@ refill: }static void bcm_sysport_tx_reclaim_one (struct bcm_sysport_priv *priv, -struct bcm_sysport_cb *cb, -unsigned int *bytes_compl, -unsigned int *pkts_compl) +struct bcm_sysport_cb *cb, +unsigned int *bytes_compl, +unsigned int *pkts_compl) {struct device *kdev = &priv->pdev->dev;struct net_device *ndev = priv->netdev;
@@ -565,8 +563,8 @@ static void bcm_sysport_tx_reclaim_one(struct bcm_sysport_priv *priv, ndev->stats.tx_bytes += cb->skb->len; *bytes_compl += cb->skb->len;dma_unmap_single (kdev,dma_unmap_addr (cb, dma_addr), -dma_unmap_len (cb, dma_len), -DMA_TO_DEVICE ); +dma_unmap_len (cb, dma_len), +DMA_TO_DEVICE ); ndev->stats.tx_packets++; (*pkts_compl)++;bcm_sysport_free_cb (cb);
@@ -574,7 +572,7 @@ static void bcm_sysport_tx_reclaim_one(struct bcm_sysport_priv *priv, }else if (dma_unmap_addr (cb, dma_addr)) { ndev->stats.tx_bytes +=dma_unmap_len (cb, dma_len);dma_unmap_page (kdev,dma_unmap_addr (cb, dma_addr), -dma_unmap_len (cb, dma_len),DMA_TO_DEVICE ); +dma_unmap_len (cb, dma_len),DMA_TO_DEVICE );dma_unmap_addr_set (cb, dma_addr,0 ); } }
@@ -608,8 +606,8 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv, last_tx_cn = num_tx_cbs - last_c_index + c_index;netif_dbg (priv, tx_done, ndev, -"ring=%d c_index=%d last_tx_cn=%d last_c_index=%d\n" , - ring->index, c_index, last_tx_cn, last_c_index); +"ring=%d c_index=%d last_tx_cn=%d last_c_index=%d\n" , + ring->index, c_index, last_tx_cn, last_c_index);while (last_tx_cn-- >0 ) { cb = ring->cbs + last_c_index;
@@ -626,8 +624,8 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,netif_tx_wake_queue (txq);netif_dbg (priv, tx_done, ndev, -"ring=%d c_index=%d pkts_compl=%d, bytes_compl=%d\n" , - ring->index, ring->c_index, pkts_compl, bytes_compl); +"ring=%d c_index=%d pkts_compl=%d, bytes_compl=%d\n" , + ring->index, ring->c_index, pkts_compl, bytes_compl);return pkts_compl; }
@@ -804,8 +802,9 @@ static int bcm_sysport_insert_tsb(struct sk_buff *skb, struct net_device *dev) csum_info |=L4_LENGTH_VALID ;if (ip_proto ==IPPROTO_UDP && ip_ver ==ETH_P_IP ) csum_info |=L4_UDP ; - }else + }else { csum_info =0 ; + } tsb->l4_ptr_dest_map = csum_info; }
@@ -869,7 +868,7 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, mapping =dma_map_single (kdev, skb->data, skb_len,DMA_TO_DEVICE );if (dma_mapping_error (kdev, mapping)) {netif_err (priv, tx_err, dev,"DMA map failed at %p (len=%d)\n" , - skb->data, skb_len); + skb->data, skb_len); ret =NETDEV_TX_OK ; goto out; }
@@ -887,7 +886,7 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, len_status =upper_32_bits (mapping) &DESC_ADDR_HI_MASK ; len_status |= (skb_len <<DESC_LEN_SHIFT ); len_status |= (DESC_SOP |DESC_EOP |TX_STATUS_APP_CRC ) << -DESC_STATUS_SHIFT ; +DESC_STATUS_SHIFT ;if (skb->ip_summed ==CHECKSUM_PARTIAL ) len_status |= (DESC_L4_CSUM <<DESC_STATUS_SHIFT );
@@ -912,7 +911,7 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,netif_tx_stop_queue (txq);netif_dbg (priv, tx_queued, dev,"ring=%d desc_count=%d, curr_desc=%d\n" , - ring->index, ring->desc_count, ring->curr_desc); + ring->index, ring->desc_count, ring->curr_desc); ret =NETDEV_TX_OK ; out:
@@ -1050,14 +1049,14 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,napi_enable (&ring->napi);netif_dbg (priv, hw, priv->netdev, -"TDMA cfg, size=%d, desc_cpu=%p\n" , - ring->size, ring->desc_cpu); +"TDMA cfg, size=%d, desc_cpu=%p\n" , + ring->size, ring->desc_cpu);return 0 ; }static void bcm_sysport_fini_tx_ring (struct bcm_sysport_priv *priv, -unsigned int index) +unsigned int index) {struct bcm_sysport_tx_ring *ring = &priv->tx_rings[index];struct device *kdev = &priv->pdev->dev;
@@ -1088,7 +1087,7 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv,/* RDMA helper */ static inline int rdma_enable_set (struct bcm_sysport_priv *priv, -unsigned int enable) +unsigned int enable) {unsigned int timeout =1000 ;u32 reg;
@@ -1115,7 +1114,7 @@ static inline int rdma_enable_set(struct bcm_sysport_priv *priv,/* TDMA helper */ static inline int tdma_enable_set (struct bcm_sysport_priv *priv, -unsigned int enable) +unsigned int enable) {unsigned int timeout =1000 ;u32 reg;
@@ -1186,8 +1185,8 @@ static int bcm_sysport_init_rx_ring(struct bcm_sysport_priv *priv)rdma_writel (priv,1 ,RDMA_MBDONE_INTR );netif_dbg (priv, hw, priv->netdev, -"RDMA cfg, num_rx_bds=%d, rx_bds=%p\n" , - priv->num_rx_bds, priv->rx_bds); +"RDMA cfg, num_rx_bds=%d, rx_bds=%p\n" , + priv->num_rx_bds, priv->rx_bds);return 0 ; }
@@ -1207,8 +1206,8 @@ static void bcm_sysport_fini_rx_ring(struct bcm_sysport_priv *priv) cb = &priv->rx_cbs[i];if (dma_unmap_addr (cb, dma_addr))dma_unmap_single (&priv->pdev->dev, -dma_unmap_addr (cb, dma_addr), -RX_BUF_LENGTH ,DMA_FROM_DEVICE ); +dma_unmap_addr (cb, dma_addr), +RX_BUF_LENGTH ,DMA_FROM_DEVICE );bcm_sysport_free_cb (cb); }
@@ -1236,7 +1235,7 @@ static void bcm_sysport_set_rx_mode(struct net_device *dev) }static inline void umac_enable_set (struct bcm_sysport_priv *priv, -unsigned int enable) +unsigned int enable) {u32 reg;
@@ -1279,7 +1278,7 @@ static inline int umac_reset(struct bcm_sysport_priv *priv) }static void umac_set_hw_addr (struct bcm_sysport_priv *priv, -unsigned char *addr) +unsigned char *addr) {umac_writel (priv, (addr[0 ] <<24 ) | (addr[1 ] <<16 ) | (addr[2 ] <<8 ) | addr[3 ],UMAC_MAC0 );
@@ -1366,7 +1365,7 @@ static int bcm_sysport_open(struct net_device *dev) ret =bcm_sysport_init_tx_ring (priv, i);if (ret) {netdev_err (dev,"failed to initialize TX ring %d\n" , - i); + i); goto out_free_tx_ring; } }
@@ -1606,10 +1605,10 @@ static int bcm_sysport_probe(struct platform_device *pdev) priv->rev =topctrl_readl (priv,REV_CNTL ) &REV_MASK ;dev_info (&pdev->dev, -"Broadcom SYSTEMPORT" REV_FMT -" at 0x%p (irqs: %d, %d, TXQs: %d, RXQs: %d)\n" , - (priv->rev >>8 ) &0xff , priv->rev &0xff , - priv->base, priv->irq0, priv->irq1, txq, rxq); +"Broadcom SYSTEMPORT" REV_FMT +" at 0x%p (irqs: %d, %d, TXQs: %d, RXQs: %d)\n" , + (priv->rev >>8 ) &0xff , priv->rev &0xff , + priv->base, priv->irq0, priv->irq1, txq, rxq);return 0 ; err:
Signature · 1 line
1.9.1
PATCH 2/2 net: systemport: use kcalloc instead of kzalloc
In reply to Florian Fainellicheckpatch.pl flagged two uses of kzalloc() for allocating and zeroing arrays, use kcalloc() instead as recommended.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bcmsysport.c +3 -3
@@ -1009,7 +1009,7 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,return -ENOMEM ; } - ring->cbs =kzalloc (sizeof (struct bcm_sysport_cb ) * size,GFP_KERNEL ); + ring->cbs =kcalloc (size,sizeof (struct bcm_sysport_cb ),GFP_KERNEL );if (!ring->cbs) {netif_err (priv, hw, priv->netdev,"CB allocation failed\n" );return -ENOMEM ;
@@ -1152,8 +1152,8 @@ static int bcm_sysport_init_rx_ring(struct bcm_sysport_priv *priv) priv->rx_bd_assign_index =0 ; priv->rx_c_index =0 ; priv->rx_read_ptr =0 ; - priv->rx_cbs =kzalloc (priv->num_rx_bds * -sizeof (struct bcm_sysport_cb ),GFP_KERNEL ); + priv->rx_cbs =kcalloc (priv->num_rx_bds,sizeof (struct bcm_sysport_cb ), +GFP_KERNEL );if (!priv->rx_cbs) {netif_err (priv, hw, priv->netdev,"CB allocation failed\n" );return -ENOMEM ;
Signature · 1 line
1.9.1
David Miller
maintainerFrom: Florian Fainelli <[email protected]>
Date: Wed, 2 Jul 2014 10:54:57 -0700
Quoted 1 line
These two patches fixes "CHECK" warnings issued by checkpatch.pl.
Because of your other systemport series, these two patches no longer apply to net-next.
Please respin and resubmit, thanks.