Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Greg Kroah-Hartman and committed by
David S. Miller
49ae25b0 4308fc58

+152 -137
+20 -16
drivers/net/usb/asix_devices.c
··· 221 221 /* Get the MAC address */ 222 222 ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf); 223 223 if (ret < 0) { 224 - dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); 224 + netdev_dbg(dev->net, "read AX_CMD_READ_NODE_ID failed: %d\n", 225 + ret); 225 226 goto out; 226 227 } 227 228 memcpy(dev->net->dev_addr, buf, ETH_ALEN); ··· 304 303 305 304 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL); 306 305 if (ret < 0) { 307 - dbg("Select PHY #1 failed: %d", ret); 306 + netdev_dbg(dev->net, "Select PHY #1 failed: %d\n", ret); 308 307 goto out; 309 308 } 310 309 ··· 332 331 333 332 msleep(150); 334 333 rx_ctl = asix_read_rx_ctl(dev); 335 - dbg("RX_CTL is 0x%04x after software reset", rx_ctl); 334 + netdev_dbg(dev->net, "RX_CTL is 0x%04x after software reset\n", rx_ctl); 336 335 ret = asix_write_rx_ctl(dev, 0x0000); 337 336 if (ret < 0) 338 337 goto out; 339 338 340 339 rx_ctl = asix_read_rx_ctl(dev); 341 - dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); 340 + netdev_dbg(dev->net, "RX_CTL is 0x%04x setting to 0x0000\n", rx_ctl); 342 341 343 342 ret = asix_sw_reset(dev, AX_SWRESET_PRL); 344 343 if (ret < 0) ··· 365 364 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, 366 365 AX88772_IPG2_DEFAULT, 0, NULL); 367 366 if (ret < 0) { 368 - dbg("Write IPG,IPG1,IPG2 failed: %d", ret); 367 + netdev_dbg(dev->net, "Write IPG,IPG1,IPG2 failed: %d\n", ret); 369 368 goto out; 370 369 } 371 370 ··· 382 381 goto out; 383 382 384 383 rx_ctl = asix_read_rx_ctl(dev); 385 - dbg("RX_CTL is 0x%04x after all initializations", rx_ctl); 384 + netdev_dbg(dev->net, "RX_CTL is 0x%04x after all initializations\n", 385 + rx_ctl); 386 386 387 387 rx_ctl = asix_read_medium_status(dev); 388 - dbg("Medium Status is 0x%04x after all initializations", rx_ctl); 388 + netdev_dbg(dev->net, 389 + "Medium Status is 0x%04x after all initializations\n", 390 + rx_ctl); 389 391 390 392 return 0; 391 393 ··· 420 416 /* Get the MAC address */ 421 417 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf); 422 418 if (ret < 0) { 423 - dbg("Failed to read MAC address: %d", ret); 419 + netdev_dbg(dev->net, "Failed to read MAC address: %d\n", ret); 424 420 return ret; 425 421 } 426 422 memcpy(dev->net->dev_addr, buf, ETH_ALEN); ··· 443 439 /* Reset the PHY to normal operation mode */ 444 440 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL); 445 441 if (ret < 0) { 446 - dbg("Select PHY #1 failed: %d", ret); 442 + netdev_dbg(dev->net, "Select PHY #1 failed: %d\n", ret); 447 443 return ret; 448 444 } 449 445 ··· 463 459 464 460 /* Read PHYID register *AFTER* the PHY was reset properly */ 465 461 phyid = asix_get_phyid(dev); 466 - dbg("PHYID=0x%08x", phyid); 462 + netdev_dbg(dev->net, "PHYID=0x%08x\n", phyid); 467 463 468 464 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 469 465 if (dev->driver_info->flags & FLAG_FRAMING_AX) { ··· 579 575 u32 phyid; 580 576 581 577 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); 582 - dbg("GPIO Status: 0x%04x", status); 578 + netdev_dbg(dev->net, "GPIO Status: 0x%04x\n", status); 583 579 584 580 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL); 585 581 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom); 586 582 asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL); 587 583 588 - dbg("EEPROM index 0x17 is 0x%04x", eeprom); 584 + netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom); 589 585 590 586 if (eeprom == cpu_to_le16(0xffff)) { 591 587 data->phymode = PHY_MODE_MARVELL; ··· 596 592 data->ledmode = le16_to_cpu(eeprom) >> 8; 597 593 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; 598 594 } 599 - dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); 595 + netdev_dbg(dev->net, "GPIO0: %d, PhyMode: %d\n", gpio0, data->phymode); 600 596 601 597 /* Power up external GigaPHY through AX88178 GPIO pin */ 602 598 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); ··· 605 601 asix_write_gpio(dev, 0x001c, 300); 606 602 asix_write_gpio(dev, 0x003c, 30); 607 603 } else { 608 - dbg("gpio phymode == 1 path"); 604 + netdev_dbg(dev->net, "gpio phymode == 1 path\n"); 609 605 asix_write_gpio(dev, AX_GPIO_GPO1EN, 30); 610 606 asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); 611 607 } 612 608 613 609 /* Read PHYID register *AFTER* powering up PHY */ 614 610 phyid = asix_get_phyid(dev); 615 - dbg("PHYID=0x%08x", phyid); 611 + netdev_dbg(dev->net, "PHYID=0x%08x\n", phyid); 616 612 617 613 /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */ 618 614 asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL); ··· 774 770 /* Get the MAC address */ 775 771 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf); 776 772 if (ret < 0) { 777 - dbg("Failed to read MAC address: %d", ret); 773 + netdev_dbg(dev->net, "Failed to read MAC address: %d\n", ret); 778 774 return ret; 779 775 } 780 776 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
+32 -23
drivers/net/usb/catc.c
··· 236 236 } 237 237 238 238 if (status) { 239 - dbg("rx_done, status %d, length %d", status, urb->actual_length); 239 + dev_dbg(&urb->dev->dev, "rx_done, status %d, length %d\n", 240 + status, urb->actual_length); 240 241 return; 241 242 } 242 243 ··· 276 275 if (atomic_read(&catc->recq_sz)) { 277 276 int state; 278 277 atomic_dec(&catc->recq_sz); 279 - dbg("getting extra packet"); 278 + netdev_dbg(catc->netdev, "getting extra packet\n"); 280 279 urb->dev = catc->usbdev; 281 280 if ((state = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { 282 - dbg("submit(rx_urb) status %d", state); 281 + netdev_dbg(catc->netdev, 282 + "submit(rx_urb) status %d\n", state); 283 283 } 284 284 } else { 285 285 clear_bit(RX_RUNNING, &catc->flags); ··· 319 317 return; 320 318 /* -EPIPE: should clear the halt */ 321 319 default: /* error */ 322 - dbg("irq_done, status %d, data %02x %02x.", status, data[0], data[1]); 320 + dev_dbg(&urb->dev->dev, 321 + "irq_done, status %d, data %02x %02x.\n", 322 + status, data[0], data[1]); 323 323 goto resubmit; 324 324 } 325 325 326 326 if (linksts == LinkGood) { 327 327 netif_carrier_on(catc->netdev); 328 - dbg("link ok"); 328 + netdev_dbg(catc->netdev, "link ok\n"); 329 329 } 330 330 331 331 if (linksts == LinkBad) { 332 332 netif_carrier_off(catc->netdev); 333 - dbg("link bad"); 333 + netdev_dbg(catc->netdev, "link bad\n"); 334 334 } 335 335 336 336 if (hasdata) { ··· 389 385 int r, status = urb->status; 390 386 391 387 if (status == -ECONNRESET) { 392 - dbg("Tx Reset."); 388 + dev_dbg(&urb->dev->dev, "Tx Reset.\n"); 393 389 urb->status = 0; 394 390 catc->netdev->trans_start = jiffies; 395 391 catc->netdev->stats.tx_errors++; ··· 399 395 } 400 396 401 397 if (status) { 402 - dbg("tx_done, status %d, length %d", status, urb->actual_length); 398 + dev_dbg(&urb->dev->dev, "tx_done, status %d, length %d\n", 399 + status, urb->actual_length); 403 400 return; 404 401 } 405 402 ··· 516 511 int status = urb->status; 517 512 518 513 if (status) 519 - dbg("ctrl_done, status %d, len %d.", status, urb->actual_length); 514 + dev_dbg(&urb->dev->dev, "ctrl_done, status %d, len %d.\n", 515 + status, urb->actual_length); 520 516 521 517 spin_lock_irqsave(&catc->ctrl_lock, flags); 522 518 ··· 673 667 f5u011_mchash_async(catc, catc->multicast); 674 668 if (catc->rxmode[0] != rx) { 675 669 catc->rxmode[0] = rx; 676 - dbg("Setting RX mode to %2.2X %2.2X", catc->rxmode[0], catc->rxmode[1]); 670 + netdev_dbg(catc->netdev, 671 + "Setting RX mode to %2.2X %2.2X\n", 672 + catc->rxmode[0], catc->rxmode[1]); 677 673 f5u011_rxmode_async(catc, catc->rxmode); 678 674 } 679 675 } ··· 774 766 775 767 static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id) 776 768 { 769 + struct device *dev = &intf->dev; 777 770 struct usb_device *usbdev = interface_to_usbdev(intf); 778 771 struct net_device *netdev; 779 772 struct catc *catc; ··· 783 774 784 775 if (usb_set_interface(usbdev, 785 776 intf->altsetting->desc.bInterfaceNumber, 1)) { 786 - dev_err(&intf->dev, "Can't set altsetting 1.\n"); 777 + dev_err(dev, "Can't set altsetting 1.\n"); 787 778 return -EIO; 788 779 } 789 780 ··· 826 817 if (le16_to_cpu(usbdev->descriptor.idVendor) == 0x0423 && 827 818 le16_to_cpu(usbdev->descriptor.idProduct) == 0xa && 828 819 le16_to_cpu(catc->usbdev->descriptor.bcdDevice) == 0x0130) { 829 - dbg("Testing for f5u011"); 820 + dev_dbg(dev, "Testing for f5u011\n"); 830 821 catc->is_f5u011 = 1; 831 822 atomic_set(&catc->recq_sz, 0); 832 823 pktsz = RX_PKT_SZ; ··· 847 838 catc->irq_buf, 2, catc_irq_done, catc, 1); 848 839 849 840 if (!catc->is_f5u011) { 850 - dbg("Checking memory size\n"); 841 + dev_dbg(dev, "Checking memory size\n"); 851 842 852 843 i = 0x12345678; 853 844 catc_write_mem(catc, 0x7a80, &i, 4); ··· 859 850 case 0x12345678: 860 851 catc_set_reg(catc, TxBufCount, 8); 861 852 catc_set_reg(catc, RxBufCount, 32); 862 - dbg("64k Memory\n"); 853 + dev_dbg(dev, "64k Memory\n"); 863 854 break; 864 855 default: 865 856 dev_warn(&intf->dev, ··· 867 858 case 0x87654321: 868 859 catc_set_reg(catc, TxBufCount, 4); 869 860 catc_set_reg(catc, RxBufCount, 16); 870 - dbg("32k Memory\n"); 861 + dev_dbg(dev, "32k Memory\n"); 871 862 break; 872 863 } 873 864 874 - dbg("Getting MAC from SEEROM."); 865 + dev_dbg(dev, "Getting MAC from SEEROM.\n"); 875 866 876 867 catc_get_mac(catc, netdev->dev_addr); 877 868 878 - dbg("Setting MAC into registers."); 869 + dev_dbg(dev, "Setting MAC into registers.\n"); 879 870 880 871 for (i = 0; i < 6; i++) 881 872 catc_set_reg(catc, StationAddr0 - i, netdev->dev_addr[i]); 882 873 883 - dbg("Filling the multicast list."); 874 + dev_dbg(dev, "Filling the multicast list.\n"); 884 875 885 876 memset(broadcast, 0xff, 6); 886 877 catc_multicast(broadcast, catc->multicast); 887 878 catc_multicast(netdev->dev_addr, catc->multicast); 888 879 catc_write_mem(catc, 0xfa80, catc->multicast, 64); 889 880 890 - dbg("Clearing error counters."); 881 + dev_dbg(dev, "Clearing error counters.\n"); 891 882 892 883 for (i = 0; i < 8; i++) 893 884 catc_set_reg(catc, EthStats + i, 0); 894 885 catc->last_stats = jiffies; 895 886 896 - dbg("Enabling."); 887 + dev_dbg(dev, "Enabling.\n"); 897 888 898 889 catc_set_reg(catc, MaxBurst, RX_MAX_BURST); 899 890 catc_set_reg(catc, OpModes, OpTxMerge | OpRxMerge | OpLenInclude | Op3MemWaits); 900 891 catc_set_reg(catc, LEDCtrl, LEDLink); 901 892 catc_set_reg(catc, RxUnit, RxEnable | RxPolarity | RxMultiCast); 902 893 } else { 903 - dbg("Performing reset\n"); 894 + dev_dbg(dev, "Performing reset\n"); 904 895 catc_reset(catc); 905 896 catc_get_mac(catc, netdev->dev_addr); 906 897 907 - dbg("Setting RX Mode"); 898 + dev_dbg(dev, "Setting RX Mode\n"); 908 899 catc->rxmode[0] = RxEnable | RxPolarity | RxMultiCast; 909 900 catc->rxmode[1] = 0; 910 901 f5u011_rxmode(catc, catc->rxmode); 911 902 } 912 - dbg("Init done."); 903 + dev_dbg(dev, "Init done.\n"); 913 904 printk(KERN_INFO "%s: %s USB Ethernet at usb-%s-%s, %pM.\n", 914 905 netdev->name, (catc->is_f5u011) ? "Belkin F5U011" : "CATC EL1210A NetMate", 915 906 usbdev->bus->bus_name, usbdev->devpath, netdev->dev_addr);
+7 -3
drivers/net/usb/gl620a.c
··· 91 91 // get the packet count of the received skb 92 92 count = le32_to_cpu(header->packet_count); 93 93 if (count > GL_MAX_TRANSMIT_PACKETS) { 94 - dbg("genelink: invalid received packet count %u", count); 94 + netdev_dbg(dev->net, 95 + "genelink: invalid received packet count %u\n", 96 + count); 95 97 return 0; 96 98 } 97 99 ··· 109 107 110 108 // this may be a broken packet 111 109 if (size > GL_MAX_PACKET_LEN) { 112 - dbg("genelink: invalid rx length %d", size); 110 + netdev_dbg(dev->net, "genelink: invalid rx length %d\n", 111 + size); 113 112 return 0; 114 113 } 115 114 ··· 136 133 skb_pull(skb, 4); 137 134 138 135 if (skb->len > GL_MAX_PACKET_LEN) { 139 - dbg("genelink: invalid rx length %d", skb->len); 136 + netdev_dbg(dev->net, "genelink: invalid rx length %d\n", 137 + skb->len); 140 138 return 0; 141 139 } 142 140 return 1;
+67 -67
drivers/net/usb/kaweth.c
··· 267 267 struct usb_ctrlrequest *dr; 268 268 int retval; 269 269 270 - dbg("kaweth_control()"); 270 + netdev_dbg(kaweth->net, "kaweth_control()\n"); 271 271 272 272 if(in_interrupt()) { 273 - dbg("in_interrupt()"); 273 + netdev_dbg(kaweth->net, "in_interrupt()\n"); 274 274 return -EBUSY; 275 275 } 276 276 277 277 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); 278 - 279 - if (!dr) { 280 - dbg("kmalloc() failed"); 278 + if (!dr) 281 279 return -ENOMEM; 282 - } 283 280 284 281 dr->bRequestType = requesttype; 285 282 dr->bRequest = request; ··· 302 305 { 303 306 int retval; 304 307 305 - dbg("Reading kaweth configuration"); 308 + netdev_dbg(kaweth->net, "Reading kaweth configuration\n"); 306 309 307 310 retval = kaweth_control(kaweth, 308 311 usb_rcvctrlpipe(kaweth->dev, 0), ··· 324 327 { 325 328 int retval; 326 329 327 - dbg("Setting URB size to %d", (unsigned)urb_size); 330 + netdev_dbg(kaweth->net, "Setting URB size to %d\n", (unsigned)urb_size); 328 331 329 332 retval = kaweth_control(kaweth, 330 333 usb_sndctrlpipe(kaweth->dev, 0), ··· 346 349 { 347 350 int retval; 348 351 349 - dbg("Set SOFS wait to %d", (unsigned)sofs_wait); 352 + netdev_dbg(kaweth->net, "Set SOFS wait to %d\n", (unsigned)sofs_wait); 350 353 351 354 retval = kaweth_control(kaweth, 352 355 usb_sndctrlpipe(kaweth->dev, 0), ··· 369 372 { 370 373 int retval; 371 374 372 - dbg("Set receive filter to %d", (unsigned)receive_filter); 375 + netdev_dbg(kaweth->net, "Set receive filter to %d\n", 376 + (unsigned)receive_filter); 373 377 374 378 retval = kaweth_control(kaweth, 375 379 usb_sndctrlpipe(kaweth->dev, 0), ··· 419 421 kaweth->firmware_buf[4] = type; 420 422 kaweth->firmware_buf[5] = interrupt; 421 423 422 - dbg("High: %i, Low:%i", kaweth->firmware_buf[3], 424 + netdev_dbg(kaweth->net, "High: %i, Low:%i\n", kaweth->firmware_buf[3], 423 425 kaweth->firmware_buf[2]); 424 426 425 - dbg("Downloading firmware at %p to kaweth device at %p", 426 - fw->data, kaweth); 427 - dbg("Firmware length: %d", data_len); 427 + netdev_dbg(kaweth->net, 428 + "Downloading firmware at %p to kaweth device at %p\n", 429 + fw->data, kaweth); 430 + netdev_dbg(kaweth->net, "Firmware length: %d\n", data_len); 428 431 429 432 return kaweth_control(kaweth, 430 433 usb_sndctrlpipe(kaweth->dev, 0), ··· 453 454 kaweth->firmware_buf[6] = 0x00; 454 455 kaweth->firmware_buf[7] = 0x00; 455 456 456 - dbg("Triggering firmware"); 457 + netdev_dbg(kaweth->net, "Triggering firmware\n"); 457 458 458 459 return kaweth_control(kaweth, 459 460 usb_sndctrlpipe(kaweth->dev, 0), ··· 473 474 { 474 475 int result; 475 476 476 - dbg("kaweth_reset(%p)", kaweth); 477 + netdev_dbg(kaweth->net, "kaweth_reset(%p)\n", kaweth); 477 478 result = usb_reset_configuration(kaweth->dev); 478 479 mdelay(10); 479 480 480 - dbg("kaweth_reset() returns %d.",result); 481 + netdev_dbg(kaweth->net, "kaweth_reset() returns %d.\n", result); 481 482 482 483 return result; 483 484 } ··· 594 595 ****************************************************************/ 595 596 static void kaweth_usb_receive(struct urb *urb) 596 597 { 598 + struct device *dev = &urb->dev->dev; 597 599 struct kaweth_device *kaweth = urb->context; 598 600 struct net_device *net = kaweth->net; 599 601 int status = urb->status; ··· 610 610 kaweth->stats.rx_errors++; 611 611 kaweth->end = 1; 612 612 wake_up(&kaweth->term_wait); 613 - dbg("Status was -EPIPE."); 613 + dev_dbg(dev, "Status was -EPIPE.\n"); 614 614 return; 615 615 } 616 616 if (unlikely(status == -ECONNRESET || status == -ESHUTDOWN)) { 617 617 /* we are killed - set a flag and wake the disconnect handler */ 618 618 kaweth->end = 1; 619 619 wake_up(&kaweth->term_wait); 620 - dbg("Status was -ECONNRESET or -ESHUTDOWN."); 620 + dev_dbg(dev, "Status was -ECONNRESET or -ESHUTDOWN.\n"); 621 621 return; 622 622 } 623 623 if (unlikely(status == -EPROTO || status == -ETIME || 624 624 status == -EILSEQ)) { 625 625 kaweth->stats.rx_errors++; 626 - dbg("Status was -EPROTO, -ETIME, or -EILSEQ."); 626 + dev_dbg(dev, "Status was -EPROTO, -ETIME, or -EILSEQ.\n"); 627 627 return; 628 628 } 629 629 if (unlikely(status == -EOVERFLOW)) { 630 630 kaweth->stats.rx_errors++; 631 - dbg("Status was -EOVERFLOW."); 631 + dev_dbg(dev, "Status was -EOVERFLOW.\n"); 632 632 } 633 633 spin_lock(&kaweth->device_lock); 634 634 if (IS_BLOCKED(kaweth->status)) { ··· 687 687 struct kaweth_device *kaweth = netdev_priv(net); 688 688 int res; 689 689 690 - dbg("Opening network device."); 690 + netdev_dbg(kaweth->net, "Opening network device.\n"); 691 691 692 692 res = usb_autopm_get_interface(kaweth->intf); 693 693 if (res) { ··· 787 787 788 788 if (unlikely(status != 0)) 789 789 if (status != -ENOENT) 790 - dbg("%s: TX status %d.", kaweth->net->name, status); 790 + dev_dbg(&urb->dev->dev, "%s: TX status %d.\n", 791 + kaweth->net->name, status); 791 792 792 793 netif_wake_queue(kaweth->net); 793 794 dev_kfree_skb_irq(skb); ··· 872 871 KAWETH_PACKET_FILTER_BROADCAST | 873 872 KAWETH_PACKET_FILTER_MULTICAST; 874 873 875 - dbg("Setting Rx mode to %d", packet_filter_bitmap); 874 + netdev_dbg(net, "Setting Rx mode to %d\n", packet_filter_bitmap); 876 875 877 876 netif_stop_queue(net); 878 877 ··· 917 916 result); 918 917 } 919 918 else { 920 - dbg("Set Rx mode to %d", packet_filter_bitmap); 919 + netdev_dbg(kaweth->net, "Set Rx mode to %d\n", 920 + packet_filter_bitmap); 921 921 } 922 922 } 923 923 ··· 953 951 struct kaweth_device *kaweth = usb_get_intfdata(intf); 954 952 unsigned long flags; 955 953 956 - dbg("Suspending device"); 954 + dev_dbg(&intf->dev, "Suspending device\n"); 957 955 spin_lock_irqsave(&kaweth->device_lock, flags); 958 956 kaweth->status |= KAWETH_STATUS_SUSPENDING; 959 957 spin_unlock_irqrestore(&kaweth->device_lock, flags); ··· 970 968 struct kaweth_device *kaweth = usb_get_intfdata(intf); 971 969 unsigned long flags; 972 970 973 - dbg("Resuming device"); 971 + dev_dbg(&intf->dev, "Resuming device\n"); 974 972 spin_lock_irqsave(&kaweth->device_lock, flags); 975 973 kaweth->status &= ~KAWETH_STATUS_SUSPENDING; 976 974 spin_unlock_irqrestore(&kaweth->device_lock, flags); ··· 1005 1003 const struct usb_device_id *id /* from id_table */ 1006 1004 ) 1007 1005 { 1008 - struct usb_device *dev = interface_to_usbdev(intf); 1006 + struct device *dev = &intf->dev; 1007 + struct usb_device *udev = interface_to_usbdev(intf); 1009 1008 struct kaweth_device *kaweth; 1010 1009 struct net_device *netdev; 1011 1010 const eth_addr_t bcast_addr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 1012 1011 int result = 0; 1013 1012 1014 - dbg("Kawasaki Device Probe (Device number:%d): 0x%4.4x:0x%4.4x:0x%4.4x", 1015 - dev->devnum, 1016 - le16_to_cpu(dev->descriptor.idVendor), 1017 - le16_to_cpu(dev->descriptor.idProduct), 1018 - le16_to_cpu(dev->descriptor.bcdDevice)); 1013 + dev_dbg(dev, 1014 + "Kawasaki Device Probe (Device number:%d): 0x%4.4x:0x%4.4x:0x%4.4x\n", 1015 + udev->devnum, le16_to_cpu(udev->descriptor.idVendor), 1016 + le16_to_cpu(udev->descriptor.idProduct), 1017 + le16_to_cpu(udev->descriptor.bcdDevice)); 1019 1018 1020 - dbg("Device at %p", dev); 1019 + dev_dbg(dev, "Device at %p\n", udev); 1021 1020 1022 - dbg("Descriptor length: %x type: %x", 1023 - (int)dev->descriptor.bLength, 1024 - (int)dev->descriptor.bDescriptorType); 1021 + dev_dbg(dev, "Descriptor length: %x type: %x\n", 1022 + (int)udev->descriptor.bLength, 1023 + (int)udev->descriptor.bDescriptorType); 1025 1024 1026 1025 netdev = alloc_etherdev(sizeof(*kaweth)); 1027 1026 if (!netdev) 1028 1027 return -ENOMEM; 1029 1028 1030 1029 kaweth = netdev_priv(netdev); 1031 - kaweth->dev = dev; 1030 + kaweth->dev = udev; 1032 1031 kaweth->net = netdev; 1033 1032 1034 1033 spin_lock_init(&kaweth->device_lock); 1035 1034 init_waitqueue_head(&kaweth->term_wait); 1036 1035 1037 - dbg("Resetting."); 1036 + dev_dbg(dev, "Resetting.\n"); 1038 1037 1039 1038 kaweth_reset(kaweth); 1040 1039 ··· 1044 1041 * downloaded. Don't try to do it again, or we'll hang the device. 1045 1042 */ 1046 1043 1047 - if (le16_to_cpu(dev->descriptor.bcdDevice) >> 8) { 1048 - dev_info(&intf->dev, "Firmware present in device.\n"); 1044 + if (le16_to_cpu(udev->descriptor.bcdDevice) >> 8) { 1045 + dev_info(dev, "Firmware present in device.\n"); 1049 1046 } else { 1050 1047 /* Download the firmware */ 1051 - dev_info(&intf->dev, "Downloading firmware...\n"); 1048 + dev_info(dev, "Downloading firmware...\n"); 1052 1049 kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL); 1053 1050 if ((result = kaweth_download_firmware(kaweth, 1054 1051 "kaweth/new_code.bin", 1055 1052 100, 1056 1053 2)) < 0) { 1057 - dev_err(&intf->dev, "Error downloading firmware (%d)\n", 1054 + dev_err(dev, "Error downloading firmware (%d)\n", 1058 1055 result); 1059 1056 goto err_fw; 1060 1057 } ··· 1063 1060 "kaweth/new_code_fix.bin", 1064 1061 100, 1065 1062 3)) < 0) { 1066 - dev_err(&intf->dev, 1067 - "Error downloading firmware fix (%d)\n", 1063 + dev_err(dev, "Error downloading firmware fix (%d)\n", 1068 1064 result); 1069 1065 goto err_fw; 1070 1066 } ··· 1072 1070 "kaweth/trigger_code.bin", 1073 1071 126, 1074 1072 2)) < 0) { 1075 - dev_err(&intf->dev, 1076 - "Error downloading trigger code (%d)\n", 1073 + dev_err(dev, "Error downloading trigger code (%d)\n", 1077 1074 result); 1078 1075 goto err_fw; 1079 1076 ··· 1082 1081 "kaweth/trigger_code_fix.bin", 1083 1082 126, 1084 1083 3)) < 0) { 1085 - dev_err(&intf->dev, "Error downloading trigger code fix (%d)\n", result); 1084 + dev_err(dev, "Error downloading trigger code fix (%d)\n", result); 1086 1085 goto err_fw; 1087 1086 } 1088 1087 1089 1088 1090 1089 if ((result = kaweth_trigger_firmware(kaweth, 126)) < 0) { 1091 - dev_err(&intf->dev, "Error triggering firmware (%d)\n", 1092 - result); 1090 + dev_err(dev, "Error triggering firmware (%d)\n", result); 1093 1091 goto err_fw; 1094 1092 } 1095 1093 1096 1094 /* Device will now disappear for a moment... */ 1097 - dev_info(&intf->dev, "Firmware loaded. I'll be back...\n"); 1095 + dev_info(dev, "Firmware loaded. I'll be back...\n"); 1098 1096 err_fw: 1099 1097 free_page((unsigned long)kaweth->firmware_buf); 1100 1098 free_netdev(netdev); ··· 1103 1103 result = kaweth_read_configuration(kaweth); 1104 1104 1105 1105 if(result < 0) { 1106 - dev_err(&intf->dev, "Error reading configuration (%d), no net device created\n", result); 1106 + dev_err(dev, "Error reading configuration (%d), no net device created\n", result); 1107 1107 goto err_free_netdev; 1108 1108 } 1109 1109 1110 - dev_info(&intf->dev, "Statistics collection: %x\n", kaweth->configuration.statistics_mask); 1111 - dev_info(&intf->dev, "Multicast filter limit: %x\n", kaweth->configuration.max_multicast_filters & ((1 << 15) - 1)); 1112 - dev_info(&intf->dev, "MTU: %d\n", le16_to_cpu(kaweth->configuration.segment_size)); 1113 - dev_info(&intf->dev, "Read MAC address %pM\n", kaweth->configuration.hw_addr); 1110 + dev_info(dev, "Statistics collection: %x\n", kaweth->configuration.statistics_mask); 1111 + dev_info(dev, "Multicast filter limit: %x\n", kaweth->configuration.max_multicast_filters & ((1 << 15) - 1)); 1112 + dev_info(dev, "MTU: %d\n", le16_to_cpu(kaweth->configuration.segment_size)); 1113 + dev_info(dev, "Read MAC address %pM\n", kaweth->configuration.hw_addr); 1114 1114 1115 1115 if(!memcmp(&kaweth->configuration.hw_addr, 1116 1116 &bcast_addr, 1117 1117 sizeof(bcast_addr))) { 1118 - dev_err(&intf->dev, "Firmware not functioning properly, no net device created\n"); 1118 + dev_err(dev, "Firmware not functioning properly, no net device created\n"); 1119 1119 goto err_free_netdev; 1120 1120 } 1121 1121 1122 1122 if(kaweth_set_urb_size(kaweth, KAWETH_BUF_SIZE) < 0) { 1123 - dbg("Error setting URB size"); 1123 + dev_dbg(dev, "Error setting URB size\n"); 1124 1124 goto err_free_netdev; 1125 1125 } 1126 1126 1127 1127 if(kaweth_set_sofs_wait(kaweth, KAWETH_SOFS_TO_WAIT) < 0) { 1128 - dev_err(&intf->dev, "Error setting SOFS wait\n"); 1128 + dev_err(dev, "Error setting SOFS wait\n"); 1129 1129 goto err_free_netdev; 1130 1130 } 1131 1131 ··· 1135 1135 KAWETH_PACKET_FILTER_MULTICAST); 1136 1136 1137 1137 if(result < 0) { 1138 - dev_err(&intf->dev, "Error setting receive filter\n"); 1138 + dev_err(dev, "Error setting receive filter\n"); 1139 1139 goto err_free_netdev; 1140 1140 } 1141 1141 1142 - dbg("Initializing net device."); 1142 + dev_dbg(dev, "Initializing net device.\n"); 1143 1143 1144 1144 kaweth->intf = intf; 1145 1145 ··· 1181 1181 1182 1182 #if 0 1183 1183 // dma_supported() is deeply broken on almost all architectures 1184 - if (dma_supported (&intf->dev, 0xffffffffffffffffULL)) 1184 + if (dma_supported (dev, 0xffffffffffffffffULL)) 1185 1185 kaweth->net->features |= NETIF_F_HIGHDMA; 1186 1186 #endif 1187 1187 1188 - SET_NETDEV_DEV(netdev, &intf->dev); 1188 + SET_NETDEV_DEV(netdev, dev); 1189 1189 if (register_netdev(netdev) != 0) { 1190 - dev_err(&intf->dev, "Error registering netdev.\n"); 1190 + dev_err(dev, "Error registering netdev.\n"); 1191 1191 goto err_intfdata; 1192 1192 } 1193 1193 1194 - dev_info(&intf->dev, "kaweth interface created at %s\n", 1194 + dev_info(dev, "kaweth interface created at %s\n", 1195 1195 kaweth->net->name); 1196 1196 1197 - dbg("Kaweth probe returning."); 1197 + dev_dbg(dev, "Kaweth probe returning.\n"); 1198 1198 1199 1199 return 0; 1200 1200 ··· 1232 1232 } 1233 1233 netdev = kaweth->net; 1234 1234 1235 - dbg("Unregistering net device"); 1235 + netdev_dbg(kaweth->net, "Unregistering net device\n"); 1236 1236 unregister_netdev(netdev); 1237 1237 1238 1238 usb_free_urb(kaweth->rx_urb);
+23 -25
drivers/net/usb/net1080.c
··· 155 155 u8 reg; 156 156 u16 *vp = kmalloc(sizeof (u16)); 157 157 158 - if (!vp) { 159 - dbg("no memory?"); 158 + if (!vp) 160 159 return; 161 - } 162 160 163 - dbg("%s registers:", dev->net->name); 161 + netdev_dbg(dev->net, "registers:\n"); 164 162 for (reg = 0; reg < 0x20; reg++) { 165 163 int retval; 166 164 ··· 170 172 171 173 retval = nc_register_read(dev, reg, vp); 172 174 if (retval < 0) 173 - dbg("%s reg [0x%x] ==> error %d", 174 - dev->net->name, reg, retval); 175 + netdev_dbg(dev->net, "reg [0x%x] ==> error %d\n", 176 + reg, retval); 175 177 else 176 - dbg("%s reg [0x%x] = 0x%x", 177 - dev->net->name, reg, *vp); 178 + netdev_dbg(dev->net, "reg [0x%x] = 0x%x\n", reg, *vp); 178 179 } 179 180 kfree(vp); 180 181 } ··· 297 300 // nc_dump_registers(dev); 298 301 299 302 if ((retval = nc_register_read(dev, REG_STATUS, vp)) < 0) { 300 - dbg("can't read %s-%s status: %d", 301 - dev->udev->bus->bus_name, dev->udev->devpath, retval); 303 + netdev_dbg(dev->net, "can't read %s-%s status: %d\n", 304 + dev->udev->bus->bus_name, dev->udev->devpath, retval); 302 305 goto done; 303 306 } 304 307 status = *vp; 305 308 nc_dump_status(dev, status); 306 309 307 310 if ((retval = nc_register_read(dev, REG_USBCTL, vp)) < 0) { 308 - dbg("can't read USBCTL, %d", retval); 311 + netdev_dbg(dev->net, "can't read USBCTL, %d\n", retval); 309 312 goto done; 310 313 } 311 314 usbctl = *vp; ··· 315 318 USBCTL_FLUSH_THIS | USBCTL_FLUSH_OTHER); 316 319 317 320 if ((retval = nc_register_read(dev, REG_TTL, vp)) < 0) { 318 - dbg("can't read TTL, %d", retval); 321 + netdev_dbg(dev->net, "can't read TTL, %d\n", retval); 319 322 goto done; 320 323 } 321 324 ttl = *vp; ··· 323 326 324 327 nc_register_write(dev, REG_TTL, 325 328 MK_TTL(NC_READ_TTL_MS, TTL_OTHER(ttl)) ); 326 - dbg("%s: assigned TTL, %d ms", dev->net->name, NC_READ_TTL_MS); 329 + netdev_dbg(dev->net, "assigned TTL, %d ms\n", NC_READ_TTL_MS); 327 330 328 331 netif_info(dev, link, dev->net, "port %c, peer %sconnected\n", 329 332 (status & STATUS_PORT_A) ? 'A' : 'B', ··· 347 350 status = *vp; 348 351 kfree(vp); 349 352 if (retval != 0) { 350 - dbg("%s net1080_check_conn read - %d", dev->net->name, retval); 353 + netdev_dbg(dev->net, "net1080_check_conn read - %d\n", retval); 351 354 return retval; 352 355 } 353 356 if ((status & STATUS_CONN_OTHER) != STATUS_CONN_OTHER) ··· 419 422 if (!(skb->len & 0x01)) { 420 423 #ifdef DEBUG 421 424 struct net_device *net = dev->net; 422 - dbg("rx framesize %d range %d..%d mtu %d", skb->len, 423 - net->hard_header_len, dev->hard_mtu, net->mtu); 425 + netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n", 426 + skb->len, net->hard_header_len, dev->hard_mtu, 427 + net->mtu); 424 428 #endif 425 429 dev->net->stats.rx_frame_errors++; 426 430 nc_ensure_sync(dev); ··· 433 435 packet_len = le16_to_cpup(&header->packet_len); 434 436 if (FRAMED_SIZE(packet_len) > NC_MAX_PACKET) { 435 437 dev->net->stats.rx_frame_errors++; 436 - dbg("packet too big, %d", packet_len); 438 + netdev_dbg(dev->net, "packet too big, %d\n", packet_len); 437 439 nc_ensure_sync(dev); 438 440 return 0; 439 441 } else if (hdr_len < MIN_HEADER) { 440 442 dev->net->stats.rx_frame_errors++; 441 - dbg("header too short, %d", hdr_len); 443 + netdev_dbg(dev->net, "header too short, %d\n", hdr_len); 442 444 nc_ensure_sync(dev); 443 445 return 0; 444 446 } else if (hdr_len > MIN_HEADER) { 445 447 // out of band data for us? 446 - dbg("header OOB, %d bytes", hdr_len - MIN_HEADER); 448 + netdev_dbg(dev->net, "header OOB, %d bytes\n", hdr_len - MIN_HEADER); 447 449 nc_ensure_sync(dev); 448 450 // switch (vendor/product ids) { ... } 449 451 } ··· 456 458 if ((packet_len & 0x01) == 0) { 457 459 if (skb->data [packet_len] != PAD_BYTE) { 458 460 dev->net->stats.rx_frame_errors++; 459 - dbg("bad pad"); 461 + netdev_dbg(dev->net, "bad pad\n"); 460 462 return 0; 461 463 } 462 464 skb_trim(skb, skb->len - 1); 463 465 } 464 466 if (skb->len != packet_len) { 465 467 dev->net->stats.rx_frame_errors++; 466 - dbg("bad packet len %d (expected %d)", 467 - skb->len, packet_len); 468 + netdev_dbg(dev->net, "bad packet len %d (expected %d)\n", 469 + skb->len, packet_len); 468 470 nc_ensure_sync(dev); 469 471 return 0; 470 472 } 471 473 if (header->packet_id != get_unaligned(&trailer->packet_id)) { 472 474 dev->net->stats.rx_fifo_errors++; 473 - dbg("(2+ dropped) rx packet_id mismatch 0x%x 0x%x", 474 - le16_to_cpu(header->packet_id), 475 - le16_to_cpu(trailer->packet_id)); 475 + netdev_dbg(dev->net, "(2+ dropped) rx packet_id mismatch 0x%x 0x%x\n", 476 + le16_to_cpu(header->packet_id), 477 + le16_to_cpu(trailer->packet_id)); 476 478 return 0; 477 479 } 478 480 #if 0
+3 -3
drivers/net/usb/rtl8150.c
··· 275 275 return -EBUSY; 276 276 277 277 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 278 - dbg("%s: Setting MAC address to %pM\n", netdev->name, netdev->dev_addr); 278 + netdev_dbg(netdev, "Setting MAC address to %pM\n", netdev->dev_addr); 279 279 /* Set the IDR registers. */ 280 280 set_registers(dev, IDR, netdev->addr_len, netdev->dev_addr); 281 281 #ifdef EEPROM_WRITE ··· 503 503 if ((d[INT_MSR] & MSR_LINK) == 0) { 504 504 if (netif_carrier_ok(dev->netdev)) { 505 505 netif_carrier_off(dev->netdev); 506 - dbg("%s: LINK LOST\n", __func__); 506 + netdev_dbg(dev->netdev, "%s: LINK LOST\n", __func__); 507 507 } 508 508 } else { 509 509 if (!netif_carrier_ok(dev->netdev)) { 510 510 netif_carrier_on(dev->netdev); 511 - dbg("%s: LINK CAME BACK\n", __func__); 511 + netdev_dbg(dev->netdev, "%s: LINK CAME BACK\n", __func__); 512 512 } 513 513 } 514 514