Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <nbowler@draconx.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Nick Bowler and committed by
David S. Miller
b11e5f6a 057cc8c9

+12 -31
+12 -31
drivers/net/ethernet/sun/sunhme.c
··· 545 545 546 546 static void display_link_mode(struct happy_meal *hp, void __iomem *tregs) 547 547 { 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 "); 554 548 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"); 566 555 } 567 556 568 557 static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs) 569 558 { 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 "); 576 559 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"); 585 566 } 586 567 587 568 static int set_happy_link_modes(struct happy_meal *hp, void __iomem *tregs)