lkml.org 
[lkml]   [2010]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] net: phy: Fixed some checkpatch errors
From
Date
On Sat, 2010-12-18 at 19:41 +0100, Jean-Michel Hautbois wrote:
> Fixes some coding style issues (errors and warnings).

Hi Jean-Michel.

> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
[]
> @@ -47,11 +47,11 @@ void phy_print_status(struct phy_device *phydev)
> pr_info("PHY: %s - Link is %s", dev_name(&phydev->dev),
> phydev->link ? "Up" : "Down");
> if (phydev->link)
> - printk(" - %d/%s", phydev->speed,
> + pr_info(" - %d/%s", phydev->speed,
> DUPLEX_FULL == phydev->duplex ?
> "Full" : "Half");
>
> - printk("\n");
> + pr_info("\n");

This isn't the right way to fix this actually.

The first pr_info is not terminated with a newline,
so the second printk should be printk(KERN_CONT or
pr_cont instead.

Ideally, you would make a different change.
There should be just one printk/pr_info.
Fewer messages, couldn't be interleaved with other
simultaneous output, easier to grep, etc...

I think something like this would be better:

if (phydev->link)
pr_info("PHY: %s - Link is down\n", dev_name(&phydev->dev));
else
pr_info("PHY: %s - Link is up - %d/%s\n",
dev_name(&phydev->dev),
phydev->speed,
phydev->duplex == DUPLEX_FULL ? "Full" : "Half");

or maybe use dev_info like this:

if (phydev->link)
dev_info(&phydev->dev, "PHY: Link is down\n");
else
dev_info(&phydev->dev, "PHY: Link is up - %d/%s\n",
phydev->speed,
phydev->duplex == DUPLEX_FULL ? "Full" : "Half");

cheers, Joe



\
 
 \ /
  Last update: 2010-12-19 10:21    [W:0.050 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site