Skip to content

Commit 64ec42f

Browse files
Moritz Fischerdavem330
authored andcommitted
net: macb: Fix coding style warnings
This commit takes care of the coding style warnings that are mostly due to a different comment style and lines over 80 chars, as well as a dangling else. Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Moritz Fischer <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 96ec631 commit 64ec42f

File tree

1 file changed

+42
-58
lines changed
  • drivers/net/ethernet/cadence

1 file changed

+42
-58
lines changed

drivers/net/ethernet/cadence/macb.c

Lines changed: 42 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@
6161
#define MACB_WOL_HAS_MAGIC_PACKET (0x1 << 0)
6262
#define MACB_WOL_ENABLED (0x1 << 1)
6363

64-
/*
65-
* Graceful stop timeouts in us. We should allow up to
64+
/* Graceful stop timeouts in us. We should allow up to
6665
* 1 frame time (10 Mbits/s, full-duplex, ignoring collisions)
6766
*/
6867
#define MACB_HALT_TIMEOUT 1230
@@ -130,8 +129,7 @@ static void hw_writel(struct macb *bp, int offset, u32 value)
130129
writel_relaxed(value, bp->regs + offset);
131130
}
132131

133-
/*
134-
* Find the CPU endianness by using the loopback bit of NCR register. When the
132+
/* Find the CPU endianness by using the loopback bit of NCR register. When the
135133
* CPU is in big endian we need to program swaped mode for management
136134
* descriptor access.
137135
*/
@@ -386,7 +384,8 @@ static int macb_mii_probe(struct net_device *dev)
386384

387385
pdata = dev_get_platdata(&bp->pdev->dev);
388386
if (pdata && gpio_is_valid(pdata->phy_irq_pin)) {
389-
ret = devm_gpio_request(&bp->pdev->dev, pdata->phy_irq_pin, "phy int");
387+
ret = devm_gpio_request(&bp->pdev->dev, pdata->phy_irq_pin,
388+
"phy int");
390389
if (!ret) {
391390
phy_irq = gpio_to_irq(pdata->phy_irq_pin);
392391
phydev->irq = (phy_irq < 0) ? PHY_POLL : phy_irq;
@@ -452,7 +451,8 @@ static int macb_mii_init(struct macb *bp)
452451
err = of_mdiobus_register(bp->mii_bus, np);
453452

454453
/* fallback to standard phy registration if no phy were
455-
found during dt phy registration */
454+
* found during dt phy registration
455+
*/
456456
if (!err && !phy_find_first(bp->mii_bus)) {
457457
for (i = 0; i < PHY_MAX_ADDR; i++) {
458458
struct phy_device *phydev;
@@ -567,17 +567,15 @@ static void macb_tx_error_task(struct work_struct *work)
567567
/* Make sure nobody is trying to queue up new packets */
568568
netif_tx_stop_all_queues(bp->dev);
569569

570-
/*
571-
* Stop transmission now
570+
/* Stop transmission now
572571
* (in case we have just queued new packets)
573572
* macb/gem must be halted to write TBQP register
574573
*/
575574
if (macb_halt_tx(bp))
576575
/* Just complain for now, reinitializing TX path can be good */
577576
netdev_err(bp->dev, "BUG: halt tx timed out\n");
578577

579-
/*
580-
* Treat frames in TX queue including the ones that caused the error.
578+
/* Treat frames in TX queue including the ones that caused the error.
581579
* Free transmit buffers in upper layer.
582580
*/
583581
for (tail = queue->tx_tail; tail != queue->tx_head; tail++) {
@@ -607,10 +605,9 @@ static void macb_tx_error_task(struct work_struct *work)
607605
bp->stats.tx_bytes += skb->len;
608606
}
609607
} else {
610-
/*
611-
* "Buffers exhausted mid-frame" errors may only happen
612-
* if the driver is buggy, so complain loudly about those.
613-
* Statistics are updated by hardware.
608+
/* "Buffers exhausted mid-frame" errors may only happen
609+
* if the driver is buggy, so complain loudly about
610+
* those. Statistics are updated by hardware.
614611
*/
615612
if (ctrl & MACB_BIT(TX_BUF_EXHAUSTED))
616613
netdev_err(bp->dev,
@@ -722,7 +719,8 @@ static void gem_rx_refill(struct macb *bp)
722719
struct sk_buff *skb;
723720
dma_addr_t paddr;
724721

725-
while (CIRC_SPACE(bp->rx_prepared_head, bp->rx_tail, RX_RING_SIZE) > 0) {
722+
while (CIRC_SPACE(bp->rx_prepared_head, bp->rx_tail,
723+
RX_RING_SIZE) > 0) {
726724
entry = macb_rx_ring_wrap(bp->rx_prepared_head);
727725

728726
/* Make hw descriptor updates visible to CPU */
@@ -741,7 +739,8 @@ static void gem_rx_refill(struct macb *bp)
741739

742740
/* now fill corresponding descriptor entry */
743741
paddr = dma_map_single(&bp->pdev->dev, skb->data,
744-
bp->rx_buffer_size, DMA_FROM_DEVICE);
742+
bp->rx_buffer_size,
743+
DMA_FROM_DEVICE);
745744
if (dma_mapping_error(&bp->pdev->dev, paddr)) {
746745
dev_kfree_skb(skb);
747746
break;
@@ -777,14 +776,14 @@ static void discard_partial_frame(struct macb *bp, unsigned int begin,
777776

778777
for (frag = begin; frag != end; frag++) {
779778
struct macb_dma_desc *desc = macb_rx_desc(bp, frag);
779+
780780
desc->addr &= ~MACB_BIT(RX_USED);
781781
}
782782

783783
/* Make descriptor updates visible to hardware */
784784
wmb();
785785

786-
/*
787-
* When this happens, the hardware stats registers for
786+
/* When this happens, the hardware stats registers for
788787
* whatever caused this is updated, so we don't have to record
789788
* anything.
790789
*/
@@ -883,8 +882,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
883882
macb_rx_ring_wrap(first_frag),
884883
macb_rx_ring_wrap(last_frag), len);
885884

886-
/*
887-
* The ethernet header starts NET_IP_ALIGN bytes into the
885+
/* The ethernet header starts NET_IP_ALIGN bytes into the
888886
* first buffer. Since the header is 14 bytes, this makes the
889887
* payload word-aligned.
890888
*
@@ -1099,8 +1097,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
10991097
(unsigned long)status);
11001098

11011099
if (status & MACB_RX_INT_FLAGS) {
1102-
/*
1103-
* There's no point taking any more interrupts
1100+
/* There's no point taking any more interrupts
11041101
* until we have processed the buffers. The
11051102
* scheduling call may fail if the poll routine
11061103
* is already scheduled, so disable interrupts
@@ -1129,8 +1126,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
11291126
if (status & MACB_BIT(TCOMP))
11301127
macb_tx_interrupt(queue);
11311128

1132-
/*
1133-
* Link change detection isn't possible with RMII, so we'll
1129+
/* Link change detection isn't possible with RMII, so we'll
11341130
* add that if/when we get our hands on a full-blown MII PHY.
11351131
*/
11361132

@@ -1161,8 +1157,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
11611157
}
11621158

11631159
if (status & MACB_BIT(HRESP)) {
1164-
/*
1165-
* TODO: Reset the hardware, and maybe move the
1160+
/* TODO: Reset the hardware, and maybe move the
11661161
* netdev_err to a lower-priority context as well
11671162
* (work queue?)
11681163
*/
@@ -1181,8 +1176,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
11811176
}
11821177

11831178
#ifdef CONFIG_NET_POLL_CONTROLLER
1184-
/*
1185-
* Polling receive - used by netconsole and other diagnostic tools
1179+
/* Polling receive - used by netconsole and other diagnostic tools
11861180
* to allow network i/o with interrupts disabled.
11871181
*/
11881182
static void macb_poll_controller(struct net_device *dev)
@@ -1478,10 +1472,10 @@ static int gem_alloc_rx_buffers(struct macb *bp)
14781472
bp->rx_skbuff = kzalloc(size, GFP_KERNEL);
14791473
if (!bp->rx_skbuff)
14801474
return -ENOMEM;
1481-
else
1482-
netdev_dbg(bp->dev,
1483-
"Allocated %d RX struct sk_buff entries at %p\n",
1484-
RX_RING_SIZE, bp->rx_skbuff);
1475+
1476+
netdev_dbg(bp->dev,
1477+
"Allocated %d RX struct sk_buff entries at %p\n",
1478+
RX_RING_SIZE, bp->rx_skbuff);
14851479
return 0;
14861480
}
14871481

@@ -1494,10 +1488,10 @@ static int macb_alloc_rx_buffers(struct macb *bp)
14941488
&bp->rx_buffers_dma, GFP_KERNEL);
14951489
if (!bp->rx_buffers)
14961490
return -ENOMEM;
1497-
else
1498-
netdev_dbg(bp->dev,
1499-
"Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
1500-
size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
1491+
1492+
netdev_dbg(bp->dev,
1493+
"Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
1494+
size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
15011495
return 0;
15021496
}
15031497

@@ -1588,8 +1582,7 @@ static void macb_reset_hw(struct macb *bp)
15881582
struct macb_queue *queue;
15891583
unsigned int q;
15901584

1591-
/*
1592-
* Disable RX and TX (XXX: Should we halt the transmission
1585+
/* Disable RX and TX (XXX: Should we halt the transmission
15931586
* more gracefully?)
15941587
*/
15951588
macb_writel(bp, NCR, 0);
@@ -1652,8 +1645,7 @@ static u32 macb_mdc_clk_div(struct macb *bp)
16521645
return config;
16531646
}
16541647

1655-
/*
1656-
* Get the DMA bus width field of the network configuration register that we
1648+
/* Get the DMA bus width field of the network configuration register that we
16571649
* should program. We find the width from decoding the design configuration
16581650
* register to find the maximum supported data bus width.
16591651
*/
@@ -1673,8 +1665,7 @@ static u32 macb_dbw(struct macb *bp)
16731665
}
16741666
}
16751667

1676-
/*
1677-
* Configure the receive DMA engine
1668+
/* Configure the receive DMA engine
16781669
* - use the correct receive buffer size
16791670
* - set best burst length for DMA operations
16801671
* (if not supported by FIFO, it will fallback to default)
@@ -1762,8 +1753,7 @@ static void macb_init_hw(struct macb *bp)
17621753
macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE));
17631754
}
17641755

1765-
/*
1766-
* The hash address register is 64 bits long and takes up two
1756+
/* The hash address register is 64 bits long and takes up two
17671757
* locations in the memory map. The least significant bits are stored
17681758
* in EMAC_HSL and the most significant bits in EMAC_HSH.
17691759
*
@@ -1803,9 +1793,7 @@ static inline int hash_bit_value(int bitnr, __u8 *addr)
18031793
return 0;
18041794
}
18051795

1806-
/*
1807-
* Return the hash index value for the specified address.
1808-
*/
1796+
/* Return the hash index value for the specified address. */
18091797
static int hash_get_index(__u8 *addr)
18101798
{
18111799
int i, j, bitval;
@@ -1821,9 +1809,7 @@ static int hash_get_index(__u8 *addr)
18211809
return hash_index;
18221810
}
18231811

1824-
/*
1825-
* Add multicast addresses to the internal multicast-hash table.
1826-
*/
1812+
/* Add multicast addresses to the internal multicast-hash table. */
18271813
static void macb_sethashtable(struct net_device *dev)
18281814
{
18291815
struct netdev_hw_addr *ha;
@@ -1842,9 +1828,7 @@ static void macb_sethashtable(struct net_device *dev)
18421828
macb_or_gem_writel(bp, HRT, mc_filter[1]);
18431829
}
18441830

1845-
/*
1846-
* Enable/Disable promiscuous and multicast modes.
1847-
*/
1831+
/* Enable/Disable promiscuous and multicast modes. */
18481832
static void macb_set_rx_mode(struct net_device *dev)
18491833
{
18501834
unsigned long cfg;
@@ -2161,9 +2145,8 @@ static void macb_get_regs(struct net_device *dev, struct ethtool_regs *regs,
21612145

21622146
if (!(bp->caps & MACB_CAPS_USRIO_DISABLED))
21632147
regs_buff[12] = macb_or_gem_readl(bp, USRIO);
2164-
if (macb_is_gem(bp)) {
2148+
if (macb_is_gem(bp))
21652149
regs_buff[13] = gem_readl(bp, DMACFG);
2166-
}
21672150
}
21682151

21692152
static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
@@ -2286,11 +2269,11 @@ static const struct net_device_ops macb_netdev_ops = {
22862269
.ndo_set_features = macb_set_features,
22872270
};
22882271

2289-
/*
2290-
* Configure peripheral capabilities according to device tree
2272+
/* Configure peripheral capabilities according to device tree
22912273
* and integration options used
22922274
*/
2293-
static void macb_configure_caps(struct macb *bp, const struct macb_config *dt_conf)
2275+
static void macb_configure_caps(struct macb *bp,
2276+
const struct macb_config *dt_conf)
22942277
{
22952278
u32 dcfg;
22962279

@@ -2996,6 +2979,7 @@ static int macb_probe(struct platform_device *pdev)
29962979
phy_node = of_get_next_available_child(np, NULL);
29972980
if (phy_node) {
29982981
int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);
2982+
29992983
if (gpio_is_valid(gpio)) {
30002984
bp->reset_gpio = gpio_to_desc(gpio);
30012985
gpiod_direction_output(bp->reset_gpio, 1);

0 commit comments

Comments
 (0)