Commit b11e5f6a authored by Nick Bowler's avatar Nick Bowler Committed by David S. Miller
Browse files

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: default avatarNick Bowler <nbowler@draconx.ca>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 057cc8c9
Loading
Loading
Loading
Loading
+12 −31
Original line number Original line Diff line number Diff line
@@ -545,43 +545,24 @@ static int try_next_permutation(struct happy_meal *hp, void __iomem *tregs)


static void display_link_mode(struct happy_meal *hp, void __iomem *tregs)
static void display_link_mode(struct happy_meal *hp, void __iomem *tregs)
{
{
	printk(KERN_INFO "%s: Link is up using ", hp->dev->name);
	if (hp->tcvr_type == external)
		printk("external ");
	else
		printk("internal ");
	printk("transceiver at ");
	hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA);
	hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA);
	if (hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) {

		if (hp->sw_lpa & LPA_100FULL)
	netdev_info(hp->dev,
			printk("100Mb/s, Full Duplex.\n");
		    "Link is up using %s transceiver at %dMb/s, %s Duplex.\n",
		else
		    hp->tcvr_type == external ? "external" : "internal",
			printk("100Mb/s, Half Duplex.\n");
		    hp->sw_lpa & (LPA_100HALF | LPA_100FULL) ? 100 : 10,
	} else {
		    hp->sw_lpa & (LPA_100FULL | LPA_10FULL) ? "Full" : "Half");
		if (hp->sw_lpa & LPA_10FULL)
			printk("10Mb/s, Full Duplex.\n");
		else
			printk("10Mb/s, Half Duplex.\n");
	}
}
}


static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs)
static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs)
{
{
	printk(KERN_INFO "%s: Link has been forced up using ", hp->dev->name);
	if (hp->tcvr_type == external)
		printk("external ");
	else
		printk("internal ");
	printk("transceiver at ");
	hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR);
	hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR);
	if (hp->sw_bmcr & BMCR_SPEED100)

		printk("100Mb/s, ");
	netdev_info(hp->dev,
	else
		    "Link has been forced up using %s transceiver at %dMb/s, %s Duplex.\n",
		printk("10Mb/s, ");
		    hp->tcvr_type == external ? "external" : "internal",
	if (hp->sw_bmcr & BMCR_FULLDPLX)
		    hp->sw_bmcr & BMCR_SPEED100 ? 100 : 10,
		printk("Full Duplex.\n");
		    hp->sw_bmcr & BMCR_FULLDPLX ? "Full" : "Half");
	else
		printk("Half Duplex.\n");
}
}


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