diff options
Diffstat (limited to 'drivers/net/usb/net1080.c')
-rw-r--r-- | drivers/net/usb/net1080.c | 110 |
1 files changed, 51 insertions, 59 deletions
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index aeb1ab03a9ee..961a8ed38d8f 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c @@ -29,6 +29,7 @@ #include <linux/mii.h> #include <linux/usb.h> #include <linux/usb/usbnet.h> +#include <linux/slab.h> #include <asm/unaligned.h> @@ -203,25 +204,23 @@ 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; - devdbg(dev, "net1080 %s-%s usbctl 0x%x:%s%s%s%s%s;" - " this%s%s;" - " other%s%s; r/o 0x%x", - dev->udev->bus->bus_name, dev->udev->devpath, - usbctl, - (usbctl & USBCTL_ENABLE_LANG) ? " lang" : "", - (usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "", - (usbctl & USBCTL_ENABLE_PROD) ? " prod" : "", - (usbctl & USBCTL_ENABLE_SERIAL) ? " serial" : "", - (usbctl & USBCTL_ENABLE_DEFAULTS) ? " defaults" : "", - - (usbctl & USBCTL_FLUSH_OTHER) ? " FLUSH" : "", - (usbctl & USBCTL_DISCONN_OTHER) ? " DIS" : "", - (usbctl & USBCTL_FLUSH_THIS) ? " FLUSH" : "", - (usbctl & USBCTL_DISCONN_THIS) ? " DIS" : "", - usbctl & ~USBCTL_WRITABLE_MASK - ); + 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" : "", + (usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "", + (usbctl & USBCTL_ENABLE_PROD) ? " prod" : "", + (usbctl & USBCTL_ENABLE_SERIAL) ? " serial" : "", + (usbctl & USBCTL_ENABLE_DEFAULTS) ? " defaults" : "", + + (usbctl & USBCTL_FLUSH_THIS) ? " FLUSH" : "", + (usbctl & USBCTL_DISCONN_THIS) ? " DIS" : "", + + (usbctl & USBCTL_FLUSH_OTHER) ? " FLUSH" : "", + (usbctl & USBCTL_DISCONN_OTHER) ? " DIS" : "", + + usbctl & ~USBCTL_WRITABLE_MASK); } /*-------------------------------------------------------------------------*/ @@ -248,30 +247,26 @@ 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; - devdbg(dev, "net1080 %s-%s status 0x%x:" - " this (%c) PKT=%d%s%s%s;" - " other PKT=%d%s%s%s; unspec 0x%x", - dev->udev->bus->bus_name, dev->udev->devpath, - status, - - // XXX the packet counts don't seem right - // (1 at reset, not 0); maybe UNSPEC too - - (status & STATUS_PORT_A) ? 'A' : 'B', - STATUS_PACKETS_THIS(status), - (status & STATUS_CONN_THIS) ? " CON" : "", - (status & STATUS_SUSPEND_THIS) ? " SUS" : "", - (status & STATUS_MAILBOX_THIS) ? " MBOX" : "", - - STATUS_PACKETS_OTHER(status), - (status & STATUS_CONN_OTHER) ? " CON" : "", - (status & STATUS_SUSPEND_OTHER) ? " SUS" : "", - (status & STATUS_MAILBOX_OTHER) ? " MBOX" : "", - - status & STATUS_UNSPEC_MASK - ); + 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, + + // XXX the packet counts don't seem right + // (1 at reset, not 0); maybe UNSPEC too + + (status & STATUS_PORT_A) ? 'A' : 'B', + STATUS_PACKETS_THIS(status), + (status & STATUS_CONN_THIS) ? " CON" : "", + (status & STATUS_SUSPEND_THIS) ? " SUS" : "", + (status & STATUS_MAILBOX_THIS) ? " MBOX" : "", + + STATUS_PACKETS_OTHER(status), + (status & STATUS_CONN_OTHER) ? " CON" : "", + (status & STATUS_SUSPEND_OTHER) ? " SUS" : "", + (status & STATUS_MAILBOX_OTHER) ? " MBOX" : "", + + status & STATUS_UNSPEC_MASK); } /*-------------------------------------------------------------------------*/ @@ -286,10 +281,9 @@ 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)) - devdbg(dev, "net1080 %s-%s ttl 0x%x this = %d, other = %d", - dev->udev->bus->bus_name, dev->udev->devpath, - ttl, TTL_THIS(ttl), TTL_OTHER(ttl)); + 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)); } /*-------------------------------------------------------------------------*/ @@ -334,11 +328,9 @@ 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)) - devinfo(dev, "port %c, peer %sconnected", - (status & STATUS_PORT_A) ? 'A' : 'B', - (status & STATUS_CONN_OTHER) ? "" : "dis" - ); + netif_info(dev, link, dev->net, "port %c, peer %sconnected\n", + (status & STATUS_PORT_A) ? 'A' : 'B', + (status & STATUS_CONN_OTHER) ? "" : "dis"); retval = 0; done: @@ -415,8 +407,8 @@ static void nc_ensure_sync(struct usbnet *dev) return; } - if (netif_msg_rx_err(dev)) - devdbg(dev, "flush net1080; too many framing errors"); + netif_dbg(dev, rx_err, dev->net, + "flush net1080; too many framing errors\n"); dev->frame_errors = 0; } } @@ -486,8 +478,8 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb) return 0; } #if 0 - devdbg(dev, "frame <rx h %d p %d id %d", header->hdr_len, - header->packet_len, header->packet_id); + netdev_dbg(dev->net, "frame <rx h %d p %d id %d\n", header->hdr_len, + header->packet_len, header->packet_id); #endif dev->frame_errors = 0; return 1; @@ -547,9 +539,9 @@ encapsulate: trailer = (struct nc_trailer *) skb_put(skb, sizeof *trailer); put_unaligned(header->packet_id, &trailer->packet_id); #if 0 - devdbg(dev, "frame >tx h %d p %d id %d", - header->hdr_len, header->packet_len, - header->packet_id); + netdev_dbg(dev->net, "frame >tx h %d p %d id %d\n", + header->hdr_len, header->packet_len, + header->packet_id); #endif return skb; } |