Skip to content

Commit cc26dc6

Browse files
montjoiedavem330
authored andcommitted
net: stmmac: reduce indentation by adding a continue
As suggested by Joe Perches, replacing the "if phydev" logic permit to reduce indentation in the for loop. Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9beae26 commit cc26dc6

File tree

1 file changed

+40
-42
lines changed

1 file changed

+40
-42
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -247,50 +247,48 @@ int stmmac_mdio_register(struct net_device *ndev)
247247
found = 0;
248248
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
249249
struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
250+
int act = 0;
251+
char irq_num[4];
252+
char *irq_str;
253+
254+
if (!phydev)
255+
continue;
256+
257+
/*
258+
* If an IRQ was provided to be assigned after
259+
* the bus probe, do it here.
260+
*/
261+
if (!mdio_bus_data->irqs &&
262+
(mdio_bus_data->probed_phy_irq > 0)) {
263+
new_bus->irq[addr] = mdio_bus_data->probed_phy_irq;
264+
phydev->irq = mdio_bus_data->probed_phy_irq;
265+
}
250266

251-
if (phydev) {
252-
int act = 0;
253-
char irq_num[4];
254-
char *irq_str;
255-
256-
/*
257-
* If an IRQ was provided to be assigned after
258-
* the bus probe, do it here.
259-
*/
260-
if (!mdio_bus_data->irqs &&
261-
(mdio_bus_data->probed_phy_irq > 0)) {
262-
new_bus->irq[addr] =
263-
mdio_bus_data->probed_phy_irq;
264-
phydev->irq = mdio_bus_data->probed_phy_irq;
265-
}
266-
267-
/*
268-
* If we're going to bind the MAC to this PHY bus,
269-
* and no PHY number was provided to the MAC,
270-
* use the one probed here.
271-
*/
272-
if (priv->plat->phy_addr == -1)
273-
priv->plat->phy_addr = addr;
274-
275-
act = (priv->plat->phy_addr == addr);
276-
switch (phydev->irq) {
277-
case PHY_POLL:
278-
irq_str = "POLL";
279-
break;
280-
case PHY_IGNORE_INTERRUPT:
281-
irq_str = "IGNORE";
282-
break;
283-
default:
284-
sprintf(irq_num, "%d", phydev->irq);
285-
irq_str = irq_num;
286-
break;
287-
}
288-
netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
289-
phydev->phy_id, addr,
290-
irq_str, phydev_name(phydev),
291-
act ? " active" : "");
292-
found = 1;
267+
/*
268+
* If we're going to bind the MAC to this PHY bus,
269+
* and no PHY number was provided to the MAC,
270+
* use the one probed here.
271+
*/
272+
if (priv->plat->phy_addr == -1)
273+
priv->plat->phy_addr = addr;
274+
275+
act = (priv->plat->phy_addr == addr);
276+
switch (phydev->irq) {
277+
case PHY_POLL:
278+
irq_str = "POLL";
279+
break;
280+
case PHY_IGNORE_INTERRUPT:
281+
irq_str = "IGNORE";
282+
break;
283+
default:
284+
sprintf(irq_num, "%d", phydev->irq);
285+
irq_str = irq_num;
286+
break;
293287
}
288+
netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
289+
phydev->phy_id, addr, irq_str, phydev_name(phydev),
290+
act ? " active" : "");
291+
found = 1;
294292
}
295293

296294
if (!found && !mdio_node) {

0 commit comments

Comments
 (0)