From 49ae25b03c8622e381e4e54d066cd4ee2dbcc3e2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 19 Sep 2012 09:46:14 +0000 Subject: USB: remove dbg() usage in USB networking drivers The dbg() USB macro is so old, it predates me. The USB networking drivers are the last hold-out using this macro, and we want to get rid of it, so replace the usage of it with the proper netdev_dbg() or dev_dbg() (depending on the context) calls. Some places we end up using a local variable for the debug call, so also convert the other existing dev_* calls to use it as well, to save tiny amounts of code space. Signed-off-by: Greg Kroah-Hartman Signed-off-by: David S. Miller --- drivers/net/usb/net1080.c | 48 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'drivers/net/usb/net1080.c') diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index 28c4d513ba85..29e06e1a34f4 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c @@ -155,12 +155,10 @@ static void nc_dump_registers(struct usbnet *dev) u8 reg; u16 *vp = kmalloc(sizeof (u16)); - if (!vp) { - dbg("no memory?"); + if (!vp) return; - } - dbg("%s registers:", dev->net->name); + netdev_dbg(dev->net, "registers:\n"); for (reg = 0; reg < 0x20; reg++) { int retval; @@ -172,11 +170,10 @@ static void nc_dump_registers(struct usbnet *dev) retval = nc_register_read(dev, reg, vp); if (retval < 0) - dbg("%s reg [0x%x] ==> error %d", - dev->net->name, reg, retval); + netdev_dbg(dev->net, "reg [0x%x] ==> error %d\n", + reg, retval); else - dbg("%s reg [0x%x] = 0x%x", - dev->net->name, reg, *vp); + netdev_dbg(dev->net, "reg [0x%x] = 0x%x\n", reg, *vp); } kfree(vp); } @@ -300,15 +297,15 @@ static int net1080_reset(struct usbnet *dev) // nc_dump_registers(dev); if ((retval = nc_register_read(dev, REG_STATUS, vp)) < 0) { - dbg("can't read %s-%s status: %d", - dev->udev->bus->bus_name, dev->udev->devpath, retval); + netdev_dbg(dev->net, "can't read %s-%s status: %d\n", + dev->udev->bus->bus_name, dev->udev->devpath, retval); goto done; } status = *vp; nc_dump_status(dev, status); if ((retval = nc_register_read(dev, REG_USBCTL, vp)) < 0) { - dbg("can't read USBCTL, %d", retval); + netdev_dbg(dev->net, "can't read USBCTL, %d\n", retval); goto done; } usbctl = *vp; @@ -318,7 +315,7 @@ static int net1080_reset(struct usbnet *dev) USBCTL_FLUSH_THIS | USBCTL_FLUSH_OTHER); if ((retval = nc_register_read(dev, REG_TTL, vp)) < 0) { - dbg("can't read TTL, %d", retval); + netdev_dbg(dev->net, "can't read TTL, %d\n", retval); goto done; } ttl = *vp; @@ -326,7 +323,7 @@ static int net1080_reset(struct usbnet *dev) nc_register_write(dev, REG_TTL, MK_TTL(NC_READ_TTL_MS, TTL_OTHER(ttl)) ); - dbg("%s: assigned TTL, %d ms", dev->net->name, NC_READ_TTL_MS); + netdev_dbg(dev->net, "assigned TTL, %d ms\n", NC_READ_TTL_MS); netif_info(dev, link, dev->net, "port %c, peer %sconnected\n", (status & STATUS_PORT_A) ? 'A' : 'B', @@ -350,7 +347,7 @@ static int net1080_check_connect(struct usbnet *dev) status = *vp; kfree(vp); if (retval != 0) { - dbg("%s net1080_check_conn read - %d", dev->net->name, retval); + netdev_dbg(dev->net, "net1080_check_conn read - %d\n", retval); return retval; } if ((status & STATUS_CONN_OTHER) != STATUS_CONN_OTHER) @@ -422,8 +419,9 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (!(skb->len & 0x01)) { #ifdef DEBUG struct net_device *net = dev->net; - dbg("rx framesize %d range %d..%d mtu %d", skb->len, - net->hard_header_len, dev->hard_mtu, net->mtu); + netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n", + skb->len, net->hard_header_len, dev->hard_mtu, + net->mtu); #endif dev->net->stats.rx_frame_errors++; nc_ensure_sync(dev); @@ -435,17 +433,17 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb) packet_len = le16_to_cpup(&header->packet_len); if (FRAMED_SIZE(packet_len) > NC_MAX_PACKET) { dev->net->stats.rx_frame_errors++; - dbg("packet too big, %d", packet_len); + netdev_dbg(dev->net, "packet too big, %d\n", packet_len); nc_ensure_sync(dev); return 0; } else if (hdr_len < MIN_HEADER) { dev->net->stats.rx_frame_errors++; - dbg("header too short, %d", hdr_len); + netdev_dbg(dev->net, "header too short, %d\n", hdr_len); nc_ensure_sync(dev); return 0; } else if (hdr_len > MIN_HEADER) { // out of band data for us? - dbg("header OOB, %d bytes", hdr_len - MIN_HEADER); + netdev_dbg(dev->net, "header OOB, %d bytes\n", hdr_len - MIN_HEADER); nc_ensure_sync(dev); // switch (vendor/product ids) { ... } } @@ -458,23 +456,23 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if ((packet_len & 0x01) == 0) { if (skb->data [packet_len] != PAD_BYTE) { dev->net->stats.rx_frame_errors++; - dbg("bad pad"); + netdev_dbg(dev->net, "bad pad\n"); return 0; } skb_trim(skb, skb->len - 1); } if (skb->len != packet_len) { dev->net->stats.rx_frame_errors++; - dbg("bad packet len %d (expected %d)", - skb->len, packet_len); + netdev_dbg(dev->net, "bad packet len %d (expected %d)\n", + skb->len, packet_len); nc_ensure_sync(dev); return 0; } if (header->packet_id != get_unaligned(&trailer->packet_id)) { dev->net->stats.rx_fifo_errors++; - dbg("(2+ dropped) rx packet_id mismatch 0x%x 0x%x", - le16_to_cpu(header->packet_id), - le16_to_cpu(trailer->packet_id)); + netdev_dbg(dev->net, "(2+ dropped) rx packet_id mismatch 0x%x 0x%x\n", + le16_to_cpu(header->packet_id), + le16_to_cpu(trailer->packet_id)); return 0; } #if 0 -- cgit v1.2.3 From 127a479442790d175811547dd95241dce9812ec5 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Thu, 20 Sep 2012 14:10:23 +0000 Subject: net1080: Neaten netdev_dbg use Remove unnecessary temporary variable and #ifdef DEBUG block. Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- drivers/net/usb/net1080.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/net/usb/net1080.c') diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index 29e06e1a34f4..c062a3e8295c 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c @@ -417,12 +417,9 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb) u16 hdr_len, packet_len; if (!(skb->len & 0x01)) { -#ifdef DEBUG - struct net_device *net = dev->net; netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n", - skb->len, net->hard_header_len, dev->hard_mtu, - net->mtu); -#endif + skb->len, dev->net->hard_header_len, dev->hard_mtu, + dev->net->mtu); dev->net->stats.rx_frame_errors++; nc_ensure_sync(dev); return 0; -- cgit v1.2.3