Skip to content

Commit aa50b55

Browse files
Moritz Fischerdavem330
authored andcommitted
net: macb: Fix coding style suggestions
This commit deals with a bunch of checkpatch suggestions that without changing behavior make checkpatch happier. Acked-by: Michal Simek <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Moritz Fischer <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 64ec42f commit aa50b55

File tree

1 file changed

+24
-22
lines changed
  • drivers/net/ethernet/cadence

1 file changed

+24
-22
lines changed

drivers/net/ethernet/cadence/macb.c

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void macb_get_hwaddr(struct macb *bp)
187187

188188
pdata = dev_get_platdata(&bp->pdev->dev);
189189

190-
/* Check all 4 address register for vaild address */
190+
/* Check all 4 address register for valid address */
191191
for (i = 0; i < 4; i++) {
192192
bottom = macb_or_gem_readl(bp, SA1B + i * 8);
193193
top = macb_or_gem_readl(bp, SA1T + i * 8);
@@ -295,7 +295,7 @@ static void macb_set_tx_clk(struct clk *clk, int speed, struct net_device *dev)
295295
ferr = DIV_ROUND_UP(ferr, rate / 100000);
296296
if (ferr > 5)
297297
netdev_warn(dev, "unable to generate target frequency: %ld Hz\n",
298-
rate);
298+
rate);
299299

300300
if (clk_set_rate(clk, rate_rounded))
301301
netdev_err(dev, "adjusting tx_clk failed.\n");
@@ -429,7 +429,7 @@ static int macb_mii_init(struct macb *bp)
429429
macb_writel(bp, NCR, MACB_BIT(MPE));
430430

431431
bp->mii_bus = mdiobus_alloc();
432-
if (bp->mii_bus == NULL) {
432+
if (!bp->mii_bus) {
433433
err = -ENOMEM;
434434
goto err_out;
435435
}
@@ -438,7 +438,7 @@ static int macb_mii_init(struct macb *bp)
438438
bp->mii_bus->read = &macb_mdio_read;
439439
bp->mii_bus->write = &macb_mdio_write;
440440
snprintf(bp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
441-
bp->pdev->name, bp->pdev->id);
441+
bp->pdev->name, bp->pdev->id);
442442
bp->mii_bus->priv = bp;
443443
bp->mii_bus->parent = &bp->dev->dev;
444444
pdata = dev_get_platdata(&bp->pdev->dev);
@@ -659,7 +659,7 @@ static void macb_tx_interrupt(struct macb_queue *queue)
659659
queue_writel(queue, ISR, MACB_BIT(TCOMP));
660660

661661
netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n",
662-
(unsigned long)status);
662+
(unsigned long)status);
663663

664664
head = queue->tx_head;
665665
for (tail = queue->tx_tail; tail != head; tail++) {
@@ -728,10 +728,10 @@ static void gem_rx_refill(struct macb *bp)
728728

729729
bp->rx_prepared_head++;
730730

731-
if (bp->rx_skbuff[entry] == NULL) {
731+
if (!bp->rx_skbuff[entry]) {
732732
/* allocate sk_buff for this free entry in ring */
733733
skb = netdev_alloc_skb(bp->dev, bp->rx_buffer_size);
734-
if (unlikely(skb == NULL)) {
734+
if (unlikely(!skb)) {
735735
netdev_err(bp->dev,
736736
"Unable to allocate sk_buff\n");
737737
break;
@@ -765,7 +765,7 @@ static void gem_rx_refill(struct macb *bp)
765765
wmb();
766766

767767
netdev_vdbg(bp->dev, "rx ring: prepared head %d, tail %d\n",
768-
bp->rx_prepared_head, bp->rx_tail);
768+
bp->rx_prepared_head, bp->rx_tail);
769769
}
770770

771771
/* Mark DMA descriptors from begin up to and not including end as unused */
@@ -879,8 +879,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
879879
len = desc->ctrl & bp->rx_frm_len_mask;
880880

881881
netdev_vdbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n",
882-
macb_rx_ring_wrap(first_frag),
883-
macb_rx_ring_wrap(last_frag), len);
882+
macb_rx_ring_wrap(first_frag),
883+
macb_rx_ring_wrap(last_frag), len);
884884

885885
/* The ethernet header starts NET_IP_ALIGN bytes into the
886886
* first buffer. Since the header is 14 bytes, this makes the
@@ -922,7 +922,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
922922
frag_len = len - offset;
923923
}
924924
skb_copy_to_linear_data_offset(skb, offset,
925-
macb_rx_buffer(bp, frag), frag_len);
925+
macb_rx_buffer(bp, frag),
926+
frag_len);
926927
offset += bp->rx_buffer_size;
927928
desc = macb_rx_desc(bp, frag);
928929
desc->addr &= ~MACB_BIT(RX_USED);
@@ -940,7 +941,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
940941
bp->stats.rx_packets++;
941942
bp->stats.rx_bytes += skb->len;
942943
netdev_vdbg(bp->dev, "received skb of length %u, csum: %08x\n",
943-
skb->len, skb->csum);
944+
skb->len, skb->csum);
944945
netif_receive_skb(skb);
945946

946947
return 0;
@@ -1047,7 +1048,7 @@ static int macb_poll(struct napi_struct *napi, int budget)
10471048
work_done = 0;
10481049

10491050
netdev_vdbg(bp->dev, "poll: status = %08lx, budget = %d\n",
1050-
(unsigned long)status, budget);
1051+
(unsigned long)status, budget);
10511052

10521053
work_done = bp->macbgem_ops.mog_rx(bp, budget);
10531054
if (work_done < budget) {
@@ -1262,7 +1263,7 @@ static unsigned int macb_tx_map(struct macb *bp,
12621263
}
12631264

12641265
/* Should never happen */
1265-
if (unlikely(tx_skb == NULL)) {
1266+
if (unlikely(!tx_skb)) {
12661267
netdev_err(bp->dev, "BUG! empty skb!\n");
12671268
return 0;
12681269
}
@@ -1332,16 +1333,16 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
13321333

13331334
#if defined(DEBUG) && defined(VERBOSE_DEBUG)
13341335
netdev_vdbg(bp->dev,
1335-
"start_xmit: queue %hu len %u head %p data %p tail %p end %p\n",
1336-
queue_index, skb->len, skb->head, skb->data,
1337-
skb_tail_pointer(skb), skb_end_pointer(skb));
1336+
"start_xmit: queue %hu len %u head %p data %p tail %p end %p\n",
1337+
queue_index, skb->len, skb->head, skb->data,
1338+
skb_tail_pointer(skb), skb_end_pointer(skb));
13381339
print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_OFFSET, 16, 1,
13391340
skb->data, 16, true);
13401341
#endif
13411342

13421343
/* Count how many TX buffer descriptors are needed to send this
13431344
* socket buffer: skb fragments of jumbo frames may need to be
1344-
* splitted into many buffer descriptors.
1345+
* split into many buffer descriptors.
13451346
*/
13461347
count = DIV_ROUND_UP(skb_headlen(skb), bp->max_tx_length);
13471348
nr_frags = skb_shinfo(skb)->nr_frags;
@@ -1392,8 +1393,8 @@ static void macb_init_rx_buffer_size(struct macb *bp, size_t size)
13921393

13931394
if (bp->rx_buffer_size % RX_BUFFER_MULTIPLE) {
13941395
netdev_dbg(bp->dev,
1395-
"RX buffer must be multiple of %d bytes, expanding\n",
1396-
RX_BUFFER_MULTIPLE);
1396+
"RX buffer must be multiple of %d bytes, expanding\n",
1397+
RX_BUFFER_MULTIPLE);
13971398
bp->rx_buffer_size =
13981399
roundup(bp->rx_buffer_size, RX_BUFFER_MULTIPLE);
13991400
}
@@ -1416,7 +1417,7 @@ static void gem_free_rx_buffers(struct macb *bp)
14161417
for (i = 0; i < RX_RING_SIZE; i++) {
14171418
skb = bp->rx_skbuff[i];
14181419

1419-
if (skb == NULL)
1420+
if (!skb)
14201421
continue;
14211422

14221423
desc = &bp->rx_ring[i];
@@ -1817,7 +1818,8 @@ static void macb_sethashtable(struct net_device *dev)
18171818
unsigned int bitnr;
18181819
struct macb *bp = netdev_priv(dev);
18191820

1820-
mc_filter[0] = mc_filter[1] = 0;
1821+
mc_filter[0] = 0;
1822+
mc_filter[1] = 0;
18211823

18221824
netdev_for_each_mc_addr(ha, dev) {
18231825
bitnr = hash_get_index(ha->addr);

0 commit comments

Comments
 (0)