Skip to content

Commit b11e5f6

Browse files
draconxdavem330
authored andcommitted
net: sunhme: output link status with a single print.
This driver currently prints the link status using four separate printk calls, which these days gets presented to the user as four distinct messages, not exactly ideal: [ 32.582778] eth0: Link is up using [ 32.582828] internal [ 32.582837] transceiver at [ 32.582888] 100Mb/s, Full Duplex. Restructure the display_link_mode function to use a single netdev_info call to present all this information as a single message, which is much nicer: [ 33.640143] hme 0000:00:01.1 eth0: Link is up using internal transceiver at 100Mb/s, Full Duplex. The display_forced_link_mode function has a similar structure, so adjust it in a similar fashion. Signed-off-by: Nick Bowler <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 057cc8c commit b11e5f6

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

drivers/net/ethernet/sun/sunhme.c

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -545,43 +545,24 @@ static int try_next_permutation(struct happy_meal *hp, void __iomem *tregs)
545545

546546
static void display_link_mode(struct happy_meal *hp, void __iomem *tregs)
547547
{
548-
printk(KERN_INFO "%s: Link is up using ", hp->dev->name);
549-
if (hp->tcvr_type == external)
550-
printk("external ");
551-
else
552-
printk("internal ");
553-
printk("transceiver at ");
554548
hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA);
555-
if (hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) {
556-
if (hp->sw_lpa & LPA_100FULL)
557-
printk("100Mb/s, Full Duplex.\n");
558-
else
559-
printk("100Mb/s, Half Duplex.\n");
560-
} else {
561-
if (hp->sw_lpa & LPA_10FULL)
562-
printk("10Mb/s, Full Duplex.\n");
563-
else
564-
printk("10Mb/s, Half Duplex.\n");
565-
}
549+
550+
netdev_info(hp->dev,
551+
"Link is up using %s transceiver at %dMb/s, %s Duplex.\n",
552+
hp->tcvr_type == external ? "external" : "internal",
553+
hp->sw_lpa & (LPA_100HALF | LPA_100FULL) ? 100 : 10,
554+
hp->sw_lpa & (LPA_100FULL | LPA_10FULL) ? "Full" : "Half");
566555
}
567556

568557
static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs)
569558
{
570-
printk(KERN_INFO "%s: Link has been forced up using ", hp->dev->name);
571-
if (hp->tcvr_type == external)
572-
printk("external ");
573-
else
574-
printk("internal ");
575-
printk("transceiver at ");
576559
hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR);
577-
if (hp->sw_bmcr & BMCR_SPEED100)
578-
printk("100Mb/s, ");
579-
else
580-
printk("10Mb/s, ");
581-
if (hp->sw_bmcr & BMCR_FULLDPLX)
582-
printk("Full Duplex.\n");
583-
else
584-
printk("Half Duplex.\n");
560+
561+
netdev_info(hp->dev,
562+
"Link has been forced up using %s transceiver at %dMb/s, %s Duplex.\n",
563+
hp->tcvr_type == external ? "external" : "internal",
564+
hp->sw_bmcr & BMCR_SPEED100 ? 100 : 10,
565+
hp->sw_bmcr & BMCR_FULLDPLX ? "Full" : "Half");
585566
}
586567

587568
static int set_happy_link_modes(struct happy_meal *hp, void __iomem *tregs)

0 commit comments

Comments
 (0)