Commit a475f603 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

drivers/net/usb: Use netif_<level> logging facilities

Convert from:
	if (netif_msg_<foo>(priv))
		dev_<level>(dev...
to
	netif_<level>(priv, foo, dev...

Also convert a few:

	if (i < REG_TIMEOUT) {
		etc...
		return ret;
       }
to
	if (i >= REG_TIMEOUT)
		goto fail;
	etc...
	return ret;
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 60b86755
......@@ -339,8 +339,8 @@ EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
static void dumpspeed(struct usbnet *dev, __le32 *speeds)
{
if (netif_msg_timer(dev))
netdev_info(dev->net, "link speeds: %u kbps up, %u kbps down\n",
netif_info(dev, timer, dev->net,
"link speeds: %u kbps up, %u kbps down\n",
__le32_to_cpu(speeds[0]) / 1000,
__le32_to_cpu(speeds[1]) / 1000);
}
......@@ -361,8 +361,7 @@ static void cdc_status(struct usbnet *dev, struct urb *urb)
event = urb->transfer_buffer;
switch (event->bNotificationType) {
case USB_CDC_NOTIFY_NETWORK_CONNECTION:
if (netif_msg_timer(dev))
netdev_dbg(dev->net, "CDC: carrier %s\n",
netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",
event->wValue ? "on" : "off");
if (event->wValue)
netif_carrier_on(dev->net);
......@@ -370,8 +369,7 @@ static void cdc_status(struct usbnet *dev, struct urb *urb)
netif_carrier_off(dev->net);
break;
case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */
if (netif_msg_timer(dev))
netdev_dbg(dev->net, "CDC: speed change (len %d)\n",
netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n",
urb->actual_length);
if (urb->actual_length != (sizeof *event + 8))
set_bit(EVENT_STS_SPLIT, &dev->flags);
......
......@@ -203,11 +203,8 @@ static void nc_dump_registers(struct usbnet *dev)
static inline void nc_dump_usbctl(struct usbnet *dev, u16 usbctl)
{
if (!netif_msg_link(dev))
return;
netdev_dbg(dev->net, "net1080 %s-%s usbctl 0x%x:%s%s%s%s%s;"
" this%s%s;"
" other%s%s; r/o 0x%x\n",
netif_dbg(dev, link, dev->net,
"net1080 %s-%s usbctl 0x%x:%s%s%s%s%s; this%s%s; other%s%s; r/o 0x%x\n",
dev->udev->bus->bus_name, dev->udev->devpath,
usbctl,
(usbctl & USBCTL_ENABLE_LANG) ? " lang" : "",
......@@ -249,9 +246,8 @@ static inline void nc_dump_usbctl(struct usbnet *dev, u16 usbctl)
static inline void nc_dump_status(struct usbnet *dev, u16 status)
{
if (!netif_msg_link(dev))
return;
netdev_dbg(dev->net, "net1080 %s-%s status 0x%x: this (%c) PKT=%d%s%s%s; other PKT=%d%s%s%s; unspec 0x%x\n",
netif_dbg(dev, link, dev->net,
"net1080 %s-%s status 0x%x: this (%c) PKT=%d%s%s%s; other PKT=%d%s%s%s; unspec 0x%x\n",
dev->udev->bus->bus_name, dev->udev->devpath,
status,
......@@ -284,8 +280,7 @@ static inline void nc_dump_status(struct usbnet *dev, u16 status)
static inline void nc_dump_ttl(struct usbnet *dev, u16 ttl)
{
if (netif_msg_link(dev))
netdev_dbg(dev->net, "net1080 %s-%s ttl 0x%x this = %d, other = %d\n",
netif_dbg(dev, link, dev->net, "net1080 %s-%s ttl 0x%x this = %d, other = %d\n",
dev->udev->bus->bus_name, dev->udev->devpath,
ttl, TTL_THIS(ttl), TTL_OTHER(ttl));
}
......@@ -332,8 +327,7 @@ static int net1080_reset(struct usbnet *dev)
MK_TTL(NC_READ_TTL_MS, TTL_OTHER(ttl)) );
dbg("%s: assigned TTL, %d ms", dev->net->name, NC_READ_TTL_MS);
if (netif_msg_link(dev))
netdev_info(dev->net, "port %c, peer %sconnected\n",
netif_info(dev, link, dev->net, "port %c, peer %sconnected\n",
(status & STATUS_PORT_A) ? 'A' : 'B',
(status & STATUS_CONN_OTHER) ? "" : "dis");
retval = 0;
......@@ -412,8 +406,8 @@ static void nc_ensure_sync(struct usbnet *dev)
return;
}
if (netif_msg_rx_err(dev))
netdev_dbg(dev->net, "flush net1080; too many framing errors\n");
netif_dbg(dev, rx_err, dev->net,
"flush net1080; too many framing errors\n");
dev->frame_errors = 0;
}
}
......
This diff is collapsed.
......@@ -335,8 +335,8 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1);
if (dev->maxpacket == 0) {
if (netif_msg_probe(dev))
dev_dbg(&intf->dev, "dev->maxpacket can't be 0\n");
netif_dbg(dev, probe, dev->net,
"dev->maxpacket can't be 0\n");
retval = -EINVAL;
goto fail_and_release;
}
......@@ -394,17 +394,15 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
}
if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
*phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
if (netif_msg_probe(dev))
dev_dbg(&intf->dev, "driver requires wireless "
"physical medium, but device is not.\n");
netif_dbg(dev, probe, dev->net,
"driver requires wireless physical medium, but device is not\n");
retval = -ENODEV;
goto halt_fail_and_release;
}
if ((flags & FLAG_RNDIS_PHYM_NOT_WIRELESS) &&
*phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
if (netif_msg_probe(dev))
dev_dbg(&intf->dev, "driver requires non-wireless "
"physical medium, but device is wireless.\n");
netif_dbg(dev, probe, dev->net,
"driver requires non-wireless physical medium, but device is wireless.\n");
retval = -ENODEV;
goto halt_fail_and_release;
}
......
......@@ -376,13 +376,11 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
spin_lock_irqsave(&pdata->mac_cr_lock, flags);
if (dev->net->flags & IFF_PROMISC) {
if (netif_msg_drv(dev))
netdev_dbg(dev->net, "promiscuous mode enabled\n");
netif_dbg(dev, drv, dev->net, "promiscuous mode enabled\n");
pdata->mac_cr |= MAC_CR_PRMS_;
pdata->mac_cr &= ~(MAC_CR_MCPAS_ | MAC_CR_HPFILT_);
} else if (dev->net->flags & IFF_ALLMULTI) {
if (netif_msg_drv(dev))
netdev_dbg(dev->net, "receive all multicast enabled\n");
netif_dbg(dev, drv, dev->net, "receive all multicast enabled\n");
pdata->mac_cr |= MAC_CR_MCPAS_;
pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_);
} else if (!netdev_mc_empty(dev->net)) {
......@@ -410,12 +408,10 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
if (count != ((u32) netdev_mc_count(dev->net)))
netdev_warn(dev->net, "mc_count != dev->mc_count\n");
if (netif_msg_drv(dev))
netdev_dbg(dev->net, "HASHH=0x%08X, HASHL=0x%08X\n",
netif_dbg(dev, drv, dev->net, "HASHH=0x%08X, HASHL=0x%08X\n",
hash_hi, hash_lo);
} else {
if (netif_msg_drv(dev))
netdev_dbg(dev->net, "receive own packets only\n");
netif_dbg(dev, drv, dev->net, "receive own packets only\n");
pdata->mac_cr &=
~(MAC_CR_PRMS_ | MAC_CR_MCPAS_ | MAC_CR_HPFILT_);
}
......@@ -452,13 +448,11 @@ static void smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
else
afc_cfg &= ~0xF;
if (netif_msg_link(dev))
netdev_dbg(dev->net, "rx pause %s, tx pause %s\n",
netif_dbg(dev, link, dev->net, "rx pause %s, tx pause %s\n",
cap & FLOW_CTRL_RX ? "enabled" : "disabled",
cap & FLOW_CTRL_TX ? "enabled" : "disabled");
} else {
if (netif_msg_link(dev))
netdev_dbg(dev->net, "half duplex\n");
netif_dbg(dev, link, dev->net, "half duplex\n");
flow = 0;
afc_cfg |= 0xF;
}
......@@ -486,8 +480,7 @@ static int smsc95xx_link_reset(struct usbnet *dev)
lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA);
if (netif_msg_link(dev))
netdev_dbg(dev->net, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x\n",
netif_dbg(dev, link, dev->net, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x\n",
ecmd.speed, ecmd.duplex, lcladv, rmtadv);
spin_lock_irqsave(&pdata->mac_cr_lock, flags);
......@@ -520,8 +513,7 @@ static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
memcpy(&intdata, urb->transfer_buffer, 4);
le32_to_cpus(&intdata);
if (netif_msg_link(dev))
netdev_dbg(dev->net, "intdata: 0x%08X\n", intdata);
netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata);
if (intdata & INT_ENP_PHY_INT_)
usbnet_defer_kevent(dev, EVENT_LINK_RESET);
......@@ -557,8 +549,7 @@ static int smsc95xx_set_csums(struct usbnet *dev)
return ret;
}
if (netif_msg_hw(dev))
netdev_dbg(dev->net, "COE_CR = 0x%08x\n", read_buf);
netif_dbg(dev, hw, dev->net, "COE_CR = 0x%08x\n", read_buf);
return 0;
}
......@@ -662,16 +653,14 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
dev->net->dev_addr) == 0) {
if (is_valid_ether_addr(dev->net->dev_addr)) {
/* eeprom values are valid so use them */
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "MAC address read from EEPROM\n");
netif_dbg(dev, ifup, dev->net, "MAC address read from EEPROM\n");
return;
}
}
/* no eeprom, or eeprom values are invalid. generate random MAC */
random_ether_addr(dev->net->dev_addr);
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "MAC address set to random_ether_addr\n");
netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n");
}
static int smsc95xx_set_mac_address(struct usbnet *dev)
......@@ -750,8 +739,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev)
PHY_INT_MASK_DEFAULT_);
mii_nway_restart(&dev->mii);
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "phy initialised successfully\n");
netif_dbg(dev, ifup, dev->net, "phy initialised successfully\n");
return 0;
}
......@@ -762,8 +750,7 @@ static int smsc95xx_reset(struct usbnet *dev)
u32 read_buf, write_buf, burst_cap;
int ret = 0, timeout;
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "entering smsc95xx_reset\n");
netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n");
write_buf = HW_CFG_LRST_;
ret = smsc95xx_write_reg(dev, HW_CFG, write_buf);
......@@ -818,8 +805,8 @@ static int smsc95xx_reset(struct usbnet *dev)
if (ret < 0)
return ret;
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "MAC Address: %pM\n", dev->net->dev_addr);
netif_dbg(dev, ifup, dev->net,
"MAC Address: %pM\n", dev->net->dev_addr);
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
if (ret < 0) {
......@@ -827,8 +814,8 @@ static int smsc95xx_reset(struct usbnet *dev)
return ret;
}
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "Read Value from HW_CFG : 0x%08x\n", read_buf);
netif_dbg(dev, ifup, dev->net,
"Read Value from HW_CFG : 0x%08x\n", read_buf);
read_buf |= HW_CFG_BIR_;
......@@ -844,8 +831,8 @@ static int smsc95xx_reset(struct usbnet *dev)
netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
return ret;
}
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "Read Value from HW_CFG after writing HW_CFG_BIR_: 0x%08x\n",
netif_dbg(dev, ifup, dev->net,
"Read Value from HW_CFG after writing HW_CFG_BIR_: 0x%08x\n",
read_buf);
if (!turbo_mode) {
......@@ -859,8 +846,8 @@ static int smsc95xx_reset(struct usbnet *dev)
dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE;
}
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "rx_urb_size=%ld\n", (ulong)dev->rx_urb_size);
netif_dbg(dev, ifup, dev->net,
"rx_urb_size=%ld\n", (ulong)dev->rx_urb_size);
ret = smsc95xx_write_reg(dev, BURST_CAP, burst_cap);
if (ret < 0) {
......@@ -873,8 +860,8 @@ static int smsc95xx_reset(struct usbnet *dev)
netdev_warn(dev->net, "Failed to read BURST_CAP: %d\n", ret);
return ret;
}
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "Read Value from BURST_CAP after writing: 0x%08x\n",
netif_dbg(dev, ifup, dev->net,
"Read Value from BURST_CAP after writing: 0x%08x\n",
read_buf);
read_buf = DEFAULT_BULK_IN_DELAY;
......@@ -889,8 +876,8 @@ static int smsc95xx_reset(struct usbnet *dev)
netdev_warn(dev->net, "Failed to read BULK_IN_DLY: %d\n", ret);
return ret;
}
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "Read Value from BULK_IN_DLY after writing: 0x%08x\n",
netif_dbg(dev, ifup, dev->net,
"Read Value from BULK_IN_DLY after writing: 0x%08x\n",
read_buf);
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
......@@ -898,8 +885,8 @@ static int smsc95xx_reset(struct usbnet *dev)
netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
return ret;
}
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "Read Value from HW_CFG: 0x%08x\n", read_buf);
netif_dbg(dev, ifup, dev->net,
"Read Value from HW_CFG: 0x%08x\n", read_buf);
if (turbo_mode)
read_buf |= (HW_CFG_MEF_ | HW_CFG_BCE_);
......@@ -921,9 +908,8 @@ static int smsc95xx_reset(struct usbnet *dev)
netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
return ret;
}
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "Read Value from HW_CFG after writing: 0x%08x\n",
read_buf);
netif_dbg(dev, ifup, dev->net,
"Read Value from HW_CFG after writing: 0x%08x\n", read_buf);
write_buf = 0xFFFFFFFF;
ret = smsc95xx_write_reg(dev, INT_STS, write_buf);
......@@ -938,8 +924,7 @@ static int smsc95xx_reset(struct usbnet *dev)
netdev_warn(dev->net, "Failed to read ID_REV: %d\n", ret);
return ret;
}
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "ID_REV = 0x%08x\n", read_buf);
netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf);
/* Configure GPIO pins as LED outputs */
write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
......@@ -1013,8 +998,7 @@ static int smsc95xx_reset(struct usbnet *dev)
smsc95xx_start_tx_path(dev);
smsc95xx_start_rx_path(dev);
if (netif_msg_ifup(dev))
netdev_dbg(dev->net, "smsc95xx_reset, return 0\n");
netif_dbg(dev, ifup, dev->net, "smsc95xx_reset, return 0\n");
return 0;
}
......@@ -1071,8 +1055,7 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
{
struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
if (pdata) {
if (netif_msg_ifdown(dev))
netdev_dbg(dev->net, "free pdata\n");
netif_dbg(dev, ifdown, dev->net, "free pdata\n");
kfree(pdata);
pdata = NULL;
dev->data[0] = 0;
......@@ -1106,9 +1089,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4;
if (unlikely(header & RX_STS_ES_)) {
if (netif_msg_rx_err(dev))
netdev_dbg(dev->net, "Error header=0x%08x\n",
header);
netif_dbg(dev, rx_err, dev->net,
"Error header=0x%08x\n", header);
dev->net->stats.rx_errors++;
dev->net->stats.rx_dropped++;
......@@ -1125,9 +1107,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
} else {
/* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */
if (unlikely(size > (ETH_FRAME_LEN + 12))) {
if (netif_msg_rx_err(dev))
netdev_dbg(dev->net, "size err header=0x%08x\n",
header);
netif_dbg(dev, rx_err, dev->net,
"size err header=0x%08x\n", header);
return 0;
}
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment