提交 8d242488 编写于 作者: J Joe Perches 提交者: David S. Miller

phy: Use pr_<level>

Use a more current logging style.

Add pr_fmt and missing newlines.
Remove embedded prefixes.
Neaten phy_print_status to avoid using KERN_CONT.
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 de74e92a
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -453,16 +456,16 @@ static void enable_status_frames(struct phy_device *phydev, bool on) ...@@ -453,16 +456,16 @@ static void enable_status_frames(struct phy_device *phydev, bool on)
ext_write(0, phydev, PAGE6, PSF_CFG1, ver); ext_write(0, phydev, PAGE6, PSF_CFG1, ver);
if (!phydev->attached_dev) { if (!phydev->attached_dev) {
pr_warning("dp83640: expected to find an attached netdevice\n"); pr_warn("expected to find an attached netdevice\n");
return; return;
} }
if (on) { if (on) {
if (dev_mc_add(phydev->attached_dev, status_frame_dst)) if (dev_mc_add(phydev->attached_dev, status_frame_dst))
pr_warning("dp83640: failed to add mc address\n"); pr_warn("failed to add mc address\n");
} else { } else {
if (dev_mc_del(phydev->attached_dev, status_frame_dst)) if (dev_mc_del(phydev->attached_dev, status_frame_dst))
pr_warning("dp83640: failed to delete mc address\n"); pr_warn("failed to delete mc address\n");
} }
} }
...@@ -582,9 +585,9 @@ static void recalibrate(struct dp83640_clock *clock) ...@@ -582,9 +585,9 @@ static void recalibrate(struct dp83640_clock *clock)
* read out and correct offsets * read out and correct offsets
*/ */
val = ext_read(master, PAGE4, PTP_STS); val = ext_read(master, PAGE4, PTP_STS);
pr_info("master PTP_STS 0x%04hx", val); pr_info("master PTP_STS 0x%04hx\n", val);
val = ext_read(master, PAGE4, PTP_ESTS); val = ext_read(master, PAGE4, PTP_ESTS);
pr_info("master PTP_ESTS 0x%04hx", val); pr_info("master PTP_ESTS 0x%04hx\n", val);
event_ts.ns_lo = ext_read(master, PAGE4, PTP_EDATA); event_ts.ns_lo = ext_read(master, PAGE4, PTP_EDATA);
event_ts.ns_hi = ext_read(master, PAGE4, PTP_EDATA); event_ts.ns_hi = ext_read(master, PAGE4, PTP_EDATA);
event_ts.sec_lo = ext_read(master, PAGE4, PTP_EDATA); event_ts.sec_lo = ext_read(master, PAGE4, PTP_EDATA);
...@@ -594,9 +597,9 @@ static void recalibrate(struct dp83640_clock *clock) ...@@ -594,9 +597,9 @@ static void recalibrate(struct dp83640_clock *clock)
list_for_each(this, &clock->phylist) { list_for_each(this, &clock->phylist) {
tmp = list_entry(this, struct dp83640_private, list); tmp = list_entry(this, struct dp83640_private, list);
val = ext_read(tmp->phydev, PAGE4, PTP_STS); val = ext_read(tmp->phydev, PAGE4, PTP_STS);
pr_info("slave PTP_STS 0x%04hx", val); pr_info("slave PTP_STS 0x%04hx\n", val);
val = ext_read(tmp->phydev, PAGE4, PTP_ESTS); val = ext_read(tmp->phydev, PAGE4, PTP_ESTS);
pr_info("slave PTP_ESTS 0x%04hx", val); pr_info("slave PTP_ESTS 0x%04hx\n", val);
event_ts.ns_lo = ext_read(tmp->phydev, PAGE4, PTP_EDATA); event_ts.ns_lo = ext_read(tmp->phydev, PAGE4, PTP_EDATA);
event_ts.ns_hi = ext_read(tmp->phydev, PAGE4, PTP_EDATA); event_ts.ns_hi = ext_read(tmp->phydev, PAGE4, PTP_EDATA);
event_ts.sec_lo = ext_read(tmp->phydev, PAGE4, PTP_EDATA); event_ts.sec_lo = ext_read(tmp->phydev, PAGE4, PTP_EDATA);
...@@ -686,7 +689,7 @@ static void decode_rxts(struct dp83640_private *dp83640, ...@@ -686,7 +689,7 @@ static void decode_rxts(struct dp83640_private *dp83640,
prune_rx_ts(dp83640); prune_rx_ts(dp83640);
if (list_empty(&dp83640->rxpool)) { if (list_empty(&dp83640->rxpool)) {
pr_debug("dp83640: rx timestamp pool is empty\n"); pr_debug("rx timestamp pool is empty\n");
goto out; goto out;
} }
rxts = list_first_entry(&dp83640->rxpool, struct rxts, list); rxts = list_first_entry(&dp83640->rxpool, struct rxts, list);
...@@ -709,7 +712,7 @@ static void decode_txts(struct dp83640_private *dp83640, ...@@ -709,7 +712,7 @@ static void decode_txts(struct dp83640_private *dp83640,
skb = skb_dequeue(&dp83640->tx_queue); skb = skb_dequeue(&dp83640->tx_queue);
if (!skb) { if (!skb) {
pr_debug("dp83640: have timestamp but tx_queue empty\n"); pr_debug("have timestamp but tx_queue empty\n");
return; return;
} }
ns = phy2txts(phy_txts); ns = phy2txts(phy_txts);
...@@ -847,7 +850,7 @@ static void dp83640_free_clocks(void) ...@@ -847,7 +850,7 @@ static void dp83640_free_clocks(void)
list_for_each_safe(this, next, &phyter_clocks) { list_for_each_safe(this, next, &phyter_clocks) {
clock = list_entry(this, struct dp83640_clock, list); clock = list_entry(this, struct dp83640_clock, list);
if (!list_empty(&clock->phylist)) { if (!list_empty(&clock->phylist)) {
pr_warning("phy list non-empty while unloading"); pr_warn("phy list non-empty while unloading\n");
BUG(); BUG();
} }
list_del(&clock->list); list_del(&clock->list);
......
...@@ -70,7 +70,7 @@ static int fixed_phy_update_regs(struct fixed_phy *fp) ...@@ -70,7 +70,7 @@ static int fixed_phy_update_regs(struct fixed_phy *fp)
lpa |= LPA_10FULL; lpa |= LPA_10FULL;
break; break;
default: default:
printk(KERN_WARNING "fixed phy: unknown speed\n"); pr_warn("fixed phy: unknown speed\n");
return -EINVAL; return -EINVAL;
} }
} else { } else {
...@@ -90,7 +90,7 @@ static int fixed_phy_update_regs(struct fixed_phy *fp) ...@@ -90,7 +90,7 @@ static int fixed_phy_update_regs(struct fixed_phy *fp)
lpa |= LPA_10HALF; lpa |= LPA_10HALF;
break; break;
default: default:
printk(KERN_WARNING "fixed phy: unknown speed\n"); pr_warn("fixed phy: unknown speed\n");
return -EINVAL; return -EINVAL;
} }
} }
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
* option) any later version. * option) any later version.
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -148,7 +151,7 @@ int mdiobus_register(struct mii_bus *bus) ...@@ -148,7 +151,7 @@ int mdiobus_register(struct mii_bus *bus)
err = device_register(&bus->dev); err = device_register(&bus->dev);
if (err) { if (err) {
printk(KERN_ERR "mii_bus %s failed to register\n", bus->id); pr_err("mii_bus %s failed to register\n", bus->id);
return -EINVAL; return -EINVAL;
} }
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mii.h> #include <linux/mii.h>
...@@ -22,6 +24,8 @@ ...@@ -22,6 +24,8 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#define DEBUG
/* DP83865 phy identifier values */ /* DP83865 phy identifier values */
#define DP83865_PHY_ID 0x20005c7a #define DP83865_PHY_ID 0x20005c7a
...@@ -112,8 +116,8 @@ static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable) ...@@ -112,8 +116,8 @@ static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable)
ns_exp_write(phydev, 0x1c0, ns_exp_write(phydev, 0x1c0,
ns_exp_read(phydev, 0x1c0) & 0xfffe); ns_exp_read(phydev, 0x1c0) & 0xfffe);
printk(KERN_DEBUG "DP83865 PHY: 10BASE-T HDX loopback %s\n", pr_debug("10BASE-T HDX loopback %s\n",
(ns_exp_read(phydev, 0x1c0) & 0x0001) ? "off" : "on"); (ns_exp_read(phydev, 0x1c0) & 0x0001) ? "off" : "on");
} }
static int ns_config_init(struct phy_device *phydev) static int ns_config_init(struct phy_device *phydev)
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
* option) any later version. * option) any later version.
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -44,18 +47,16 @@ ...@@ -44,18 +47,16 @@
*/ */
void phy_print_status(struct phy_device *phydev) 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) if (phydev->link)
printk(KERN_CONT " - %d/%s", phydev->speed, pr_info("%s - Link is Up - %d/%s\n",
DUPLEX_FULL == phydev->duplex ? dev_name(&phydev->dev),
"Full" : "Half"); phydev->speed,
DUPLEX_FULL == phydev->duplex ? "Full" : "Half");
printk(KERN_CONT "\n"); else
pr_info("%s - Link is Down\n", dev_name(&phydev->dev));
} }
EXPORT_SYMBOL(phy_print_status); EXPORT_SYMBOL(phy_print_status);
/** /**
* phy_clear_interrupt - Ack the phy device's interrupt * phy_clear_interrupt - Ack the phy device's interrupt
* @phydev: the phy_device struct * @phydev: the phy_device struct
...@@ -482,9 +483,8 @@ static void phy_force_reduction(struct phy_device *phydev) ...@@ -482,9 +483,8 @@ static void phy_force_reduction(struct phy_device *phydev)
phydev->speed = settings[idx].speed; phydev->speed = settings[idx].speed;
phydev->duplex = settings[idx].duplex; phydev->duplex = settings[idx].duplex;
pr_info("Trying %d/%s\n", phydev->speed, pr_info("Trying %d/%s\n",
DUPLEX_FULL == phydev->duplex ? phydev->speed, DUPLEX_FULL == phydev->duplex ? "FULL" : "HALF");
"FULL" : "HALF");
} }
...@@ -598,9 +598,8 @@ int phy_start_interrupts(struct phy_device *phydev) ...@@ -598,9 +598,8 @@ int phy_start_interrupts(struct phy_device *phydev)
IRQF_SHARED, IRQF_SHARED,
"phy_interrupt", "phy_interrupt",
phydev) < 0) { phydev) < 0) {
printk(KERN_WARNING "%s: Can't get IRQ %d (PHY)\n", pr_warn("%s: Can't get IRQ %d (PHY)\n",
phydev->bus->name, phydev->bus->name, phydev->irq);
phydev->irq);
phydev->irq = PHY_POLL; phydev->irq = PHY_POLL;
return 0; return 0;
} }
...@@ -838,10 +837,10 @@ void phy_state_machine(struct work_struct *work) ...@@ -838,10 +837,10 @@ void phy_state_machine(struct work_struct *work)
phydev->autoneg = AUTONEG_DISABLE; phydev->autoneg = AUTONEG_DISABLE;
pr_info("Trying %d/%s\n", phydev->speed, pr_info("Trying %d/%s\n",
DUPLEX_FULL == phydev->speed,
phydev->duplex ? DUPLEX_FULL == phydev->duplex ?
"FULL" : "HALF"); "FULL" : "HALF");
} }
break; break;
case PHY_NOLINK: case PHY_NOLINK:
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
* option) any later version. * option) any later version.
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -975,8 +978,8 @@ int phy_driver_register(struct phy_driver *new_driver) ...@@ -975,8 +978,8 @@ int phy_driver_register(struct phy_driver *new_driver)
retval = driver_register(&new_driver->driver); retval = driver_register(&new_driver->driver);
if (retval) { if (retval) {
printk(KERN_ERR "%s: Error %d in registering driver\n", pr_err("%s: Error %d in registering driver\n",
new_driver->name, retval); new_driver->name, retval);
return retval; return retval;
} }
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
* by the Free Software Foundation. * by the Free Software Foundation.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -356,7 +358,7 @@ static struct spi_driver ks8995_driver = { ...@@ -356,7 +358,7 @@ static struct spi_driver ks8995_driver = {
static int __init ks8995_init(void) static int __init ks8995_init(void)
{ {
printk(KERN_INFO DRV_DESC " version " DRV_VERSION"\n"); pr_info(DRV_DESC " version " DRV_VERSION "\n");
return spi_register_driver(&ks8995_driver); return spi_register_driver(&ks8995_driver);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册