aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/asix.c117
-rw-r--r--drivers/net/usb/catc.c9
-rw-r--r--drivers/net/usb/cdc_eem.c10
-rw-r--r--drivers/net/usb/cdc_ether.c22
-rw-r--r--drivers/net/usb/dm9601.c59
-rw-r--r--drivers/net/usb/int51x1.c17
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/usb/mcs7830.c256
-rw-r--r--drivers/net/usb/net1080.c109
-rw-r--r--drivers/net/usb/pegasus.c172
-rw-r--r--drivers/net/usb/rndis_host.c24
-rw-r--r--drivers/net/usb/rtl8150.c9
-rw-r--r--drivers/net/usb/smsc95xx.c245
-rw-r--r--drivers/net/usb/usbnet.c238
14 files changed, 653 insertions, 636 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index a516185cbc9f..20e34608fa4a 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -184,8 +184,8 @@ static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
184 void *buf; 184 void *buf;
185 int err = -ENOMEM; 185 int err = -ENOMEM;
186 186
187 devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", 187 netdev_dbg(dev->net, "asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d\n",
188 cmd, value, index, size); 188 cmd, value, index, size);
189 189
190 buf = kmalloc(size, GFP_KERNEL); 190 buf = kmalloc(size, GFP_KERNEL);
191 if (!buf) 191 if (!buf)
@@ -217,8 +217,8 @@ static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
217 void *buf = NULL; 217 void *buf = NULL;
218 int err = -ENOMEM; 218 int err = -ENOMEM;
219 219
220 devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", 220 netdev_dbg(dev->net, "asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d\n",
221 cmd, value, index, size); 221 cmd, value, index, size);
222 222
223 if (data) { 223 if (data) {
224 buf = kmalloc(size, GFP_KERNEL); 224 buf = kmalloc(size, GFP_KERNEL);
@@ -264,15 +264,15 @@ asix_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
264 int status; 264 int status;
265 struct urb *urb; 265 struct urb *urb;
266 266
267 devdbg(dev,"asix_write_cmd_async() cmd=0x%02x value=0x%04x index=0x%04x size=%d", 267 netdev_dbg(dev->net, "asix_write_cmd_async() cmd=0x%02x value=0x%04x index=0x%04x size=%d\n",
268 cmd, value, index, size); 268 cmd, value, index, size);
269 if ((urb = usb_alloc_urb(0, GFP_ATOMIC)) == NULL) { 269 if ((urb = usb_alloc_urb(0, GFP_ATOMIC)) == NULL) {
270 deverr(dev, "Error allocating URB in write_cmd_async!"); 270 netdev_err(dev->net, "Error allocating URB in write_cmd_async!\n");
271 return; 271 return;
272 } 272 }
273 273
274 if ((req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC)) == NULL) { 274 if ((req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC)) == NULL) {
275 deverr(dev, "Failed to allocate memory for control request"); 275 netdev_err(dev->net, "Failed to allocate memory for control request\n");
276 usb_free_urb(urb); 276 usb_free_urb(urb);
277 return; 277 return;
278 } 278 }
@@ -289,8 +289,8 @@ asix_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
289 asix_async_cmd_callback, req); 289 asix_async_cmd_callback, req);
290 290
291 if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { 291 if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
292 deverr(dev, "Error submitting the control message: status=%d", 292 netdev_err(dev->net, "Error submitting the control message: status=%d\n",
293 status); 293 status);
294 kfree(req); 294 kfree(req);
295 usb_free_urb(urb); 295 usb_free_urb(urb);
296 } 296 }
@@ -314,7 +314,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
314 while (skb->len > 0) { 314 while (skb->len > 0) {
315 if ((short)(header & 0x0000ffff) != 315 if ((short)(header & 0x0000ffff) !=
316 ~((short)((header & 0xffff0000) >> 16))) { 316 ~((short)((header & 0xffff0000) >> 16))) {
317 deverr(dev,"asix_rx_fixup() Bad Header Length"); 317 netdev_err(dev->net, "asix_rx_fixup() Bad Header Length\n");
318 } 318 }
319 /* get the packet length */ 319 /* get the packet length */
320 size = (u16) (header & 0x0000ffff); 320 size = (u16) (header & 0x0000ffff);
@@ -322,7 +322,8 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
322 if ((skb->len) - ((size + 1) & 0xfffe) == 0) 322 if ((skb->len) - ((size + 1) & 0xfffe) == 0)
323 return 2; 323 return 2;
324 if (size > ETH_FRAME_LEN) { 324 if (size > ETH_FRAME_LEN) {
325 deverr(dev,"asix_rx_fixup() Bad RX Length %d", size); 325 netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n",
326 size);
326 return 0; 327 return 0;
327 } 328 }
328 ax_skb = skb_clone(skb, GFP_ATOMIC); 329 ax_skb = skb_clone(skb, GFP_ATOMIC);
@@ -348,7 +349,8 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
348 } 349 }
349 350
350 if (skb->len < 0) { 351 if (skb->len < 0) {
351 deverr(dev,"asix_rx_fixup() Bad SKB Length %d", skb->len); 352 netdev_err(dev->net, "asix_rx_fixup() Bad SKB Length %d\n",
353 skb->len);
352 return 0; 354 return 0;
353 } 355 }
354 return 1; 356 return 1;
@@ -409,7 +411,7 @@ static void asix_status(struct usbnet *dev, struct urb *urb)
409 usbnet_defer_kevent (dev, EVENT_LINK_RESET ); 411 usbnet_defer_kevent (dev, EVENT_LINK_RESET );
410 } else 412 } else
411 netif_carrier_off(dev->net); 413 netif_carrier_off(dev->net);
412 devdbg(dev, "Link Status is: %d", link); 414 netdev_dbg(dev->net, "Link Status is: %d\n", link);
413 } 415 }
414} 416}
415 417
@@ -418,7 +420,7 @@ static inline int asix_set_sw_mii(struct usbnet *dev)
418 int ret; 420 int ret;
419 ret = asix_write_cmd(dev, AX_CMD_SET_SW_MII, 0x0000, 0, 0, NULL); 421 ret = asix_write_cmd(dev, AX_CMD_SET_SW_MII, 0x0000, 0, 0, NULL);
420 if (ret < 0) 422 if (ret < 0)
421 deverr(dev, "Failed to enable software MII access"); 423 netdev_err(dev->net, "Failed to enable software MII access\n");
422 return ret; 424 return ret;
423} 425}
424 426
@@ -427,7 +429,7 @@ static inline int asix_set_hw_mii(struct usbnet *dev)
427 int ret; 429 int ret;
428 ret = asix_write_cmd(dev, AX_CMD_SET_HW_MII, 0x0000, 0, 0, NULL); 430 ret = asix_write_cmd(dev, AX_CMD_SET_HW_MII, 0x0000, 0, 0, NULL);
429 if (ret < 0) 431 if (ret < 0)
430 deverr(dev, "Failed to enable hardware MII access"); 432 netdev_err(dev->net, "Failed to enable hardware MII access\n");
431 return ret; 433 return ret;
432} 434}
433 435
@@ -436,13 +438,14 @@ static inline int asix_get_phy_addr(struct usbnet *dev)
436 u8 buf[2]; 438 u8 buf[2];
437 int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf); 439 int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf);
438 440
439 devdbg(dev, "asix_get_phy_addr()"); 441 netdev_dbg(dev->net, "asix_get_phy_addr()\n");
440 442
441 if (ret < 0) { 443 if (ret < 0) {
442 deverr(dev, "Error reading PHYID register: %02x", ret); 444 netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret);
443 goto out; 445 goto out;
444 } 446 }
445 devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((__le16 *)buf)); 447 netdev_dbg(dev->net, "asix_get_phy_addr() returning 0x%04x\n",
448 *((__le16 *)buf));
446 ret = buf[1]; 449 ret = buf[1];
447 450
448out: 451out:
@@ -455,7 +458,7 @@ static int asix_sw_reset(struct usbnet *dev, u8 flags)
455 458
456 ret = asix_write_cmd(dev, AX_CMD_SW_RESET, flags, 0, 0, NULL); 459 ret = asix_write_cmd(dev, AX_CMD_SW_RESET, flags, 0, 0, NULL);
457 if (ret < 0) 460 if (ret < 0)
458 deverr(dev,"Failed to send software reset: %02x", ret); 461 netdev_err(dev->net, "Failed to send software reset: %02x\n", ret);
459 462
460 return ret; 463 return ret;
461} 464}
@@ -466,7 +469,7 @@ static u16 asix_read_rx_ctl(struct usbnet *dev)
466 int ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 0, 0, 2, &v); 469 int ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 0, 0, 2, &v);
467 470
468 if (ret < 0) { 471 if (ret < 0) {
469 deverr(dev, "Error reading RX_CTL register: %02x", ret); 472 netdev_err(dev->net, "Error reading RX_CTL register: %02x\n", ret);
470 goto out; 473 goto out;
471 } 474 }
472 ret = le16_to_cpu(v); 475 ret = le16_to_cpu(v);
@@ -478,11 +481,11 @@ static int asix_write_rx_ctl(struct usbnet *dev, u16 mode)
478{ 481{
479 int ret; 482 int ret;
480 483
481 devdbg(dev,"asix_write_rx_ctl() - mode = 0x%04x", mode); 484 netdev_dbg(dev->net, "asix_write_rx_ctl() - mode = 0x%04x\n", mode);
482 ret = asix_write_cmd(dev, AX_CMD_WRITE_RX_CTL, mode, 0, 0, NULL); 485 ret = asix_write_cmd(dev, AX_CMD_WRITE_RX_CTL, mode, 0, 0, NULL);
483 if (ret < 0) 486 if (ret < 0)
484 deverr(dev, "Failed to write RX_CTL mode to 0x%04x: %02x", 487 netdev_err(dev->net, "Failed to write RX_CTL mode to 0x%04x: %02x\n",
485 mode, ret); 488 mode, ret);
486 489
487 return ret; 490 return ret;
488} 491}
@@ -493,7 +496,8 @@ static u16 asix_read_medium_status(struct usbnet *dev)
493 int ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, 0, 0, 2, &v); 496 int ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, 0, 0, 2, &v);
494 497
495 if (ret < 0) { 498 if (ret < 0) {
496 deverr(dev, "Error reading Medium Status register: %02x", ret); 499 netdev_err(dev->net, "Error reading Medium Status register: %02x\n",
500 ret);
497 goto out; 501 goto out;
498 } 502 }
499 ret = le16_to_cpu(v); 503 ret = le16_to_cpu(v);
@@ -505,11 +509,11 @@ static int asix_write_medium_mode(struct usbnet *dev, u16 mode)
505{ 509{
506 int ret; 510 int ret;
507 511
508 devdbg(dev,"asix_write_medium_mode() - mode = 0x%04x", mode); 512 netdev_dbg(dev->net, "asix_write_medium_mode() - mode = 0x%04x\n", mode);
509 ret = asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); 513 ret = asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL);
510 if (ret < 0) 514 if (ret < 0)
511 deverr(dev, "Failed to write Medium Mode mode to 0x%04x: %02x", 515 netdev_err(dev->net, "Failed to write Medium Mode mode to 0x%04x: %02x\n",
512 mode, ret); 516 mode, ret);
513 517
514 return ret; 518 return ret;
515} 519}
@@ -518,11 +522,11 @@ static int asix_write_gpio(struct usbnet *dev, u16 value, int sleep)
518{ 522{
519 int ret; 523 int ret;
520 524
521 devdbg(dev,"asix_write_gpio() - value = 0x%04x", value); 525 netdev_dbg(dev->net, "asix_write_gpio() - value = 0x%04x\n", value);
522 ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, value, 0, 0, NULL); 526 ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, value, 0, 0, NULL);
523 if (ret < 0) 527 if (ret < 0)
524 deverr(dev, "Failed to write GPIO value 0x%04x: %02x", 528 netdev_err(dev->net, "Failed to write GPIO value 0x%04x: %02x\n",
525 value, ret); 529 value, ret);
526 530
527 if (sleep) 531 if (sleep)
528 msleep(sleep); 532 msleep(sleep);
@@ -542,29 +546,27 @@ static void asix_set_multicast(struct net_device *net)
542 if (net->flags & IFF_PROMISC) { 546 if (net->flags & IFF_PROMISC) {
543 rx_ctl |= AX_RX_CTL_PRO; 547 rx_ctl |= AX_RX_CTL_PRO;
544 } else if (net->flags & IFF_ALLMULTI || 548 } else if (net->flags & IFF_ALLMULTI ||
545 net->mc_count > AX_MAX_MCAST) { 549 netdev_mc_count(net) > AX_MAX_MCAST) {
546 rx_ctl |= AX_RX_CTL_AMALL; 550 rx_ctl |= AX_RX_CTL_AMALL;
547 } else if (net->mc_count == 0) { 551 } else if (netdev_mc_empty(net)) {
548 /* just broadcast and directed */ 552 /* just broadcast and directed */
549 } else { 553 } else {
550 /* We use the 20 byte dev->data 554 /* We use the 20 byte dev->data
551 * for our 8 byte filter buffer 555 * for our 8 byte filter buffer
552 * to avoid allocating memory that 556 * to avoid allocating memory that
553 * is tricky to free later */ 557 * is tricky to free later */
554 struct dev_mc_list *mc_list = net->mc_list; 558 struct dev_mc_list *mc_list;
555 u32 crc_bits; 559 u32 crc_bits;
556 int i;
557 560
558 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); 561 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
559 562
560 /* Build the multicast hash filter. */ 563 /* Build the multicast hash filter. */
561 for (i = 0; i < net->mc_count; i++) { 564 netdev_for_each_mc_addr(mc_list, net) {
562 crc_bits = 565 crc_bits =
563 ether_crc(ETH_ALEN, 566 ether_crc(ETH_ALEN,
564 mc_list->dmi_addr) >> 26; 567 mc_list->dmi_addr) >> 26;
565 data->multi_filter[crc_bits >> 3] |= 568 data->multi_filter[crc_bits >> 3] |=
566 1 << (crc_bits & 7); 569 1 << (crc_bits & 7);
567 mc_list = mc_list->next;
568 } 570 }
569 571
570 asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, 572 asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
@@ -588,7 +590,8 @@ static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)
588 asix_set_hw_mii(dev); 590 asix_set_hw_mii(dev);
589 mutex_unlock(&dev->phy_mutex); 591 mutex_unlock(&dev->phy_mutex);
590 592
591 devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res)); 593 netdev_dbg(dev->net, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n",
594 phy_id, loc, le16_to_cpu(res));
592 595
593 return le16_to_cpu(res); 596 return le16_to_cpu(res);
594} 597}
@@ -599,7 +602,8 @@ asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)
599 struct usbnet *dev = netdev_priv(netdev); 602 struct usbnet *dev = netdev_priv(netdev);
600 __le16 res = cpu_to_le16(val); 603 __le16 res = cpu_to_le16(val);
601 604
602 devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val); 605 netdev_dbg(dev->net, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x\n",
606 phy_id, loc, val);
603 mutex_lock(&dev->phy_mutex); 607 mutex_lock(&dev->phy_mutex);
604 asix_set_sw_mii(dev); 608 asix_set_sw_mii(dev);
605 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res); 609 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res);
@@ -754,29 +758,27 @@ static void ax88172_set_multicast(struct net_device *net)
754 if (net->flags & IFF_PROMISC) { 758 if (net->flags & IFF_PROMISC) {
755 rx_ctl |= 0x01; 759 rx_ctl |= 0x01;
756 } else if (net->flags & IFF_ALLMULTI || 760 } else if (net->flags & IFF_ALLMULTI ||
757 net->mc_count > AX_MAX_MCAST) { 761 netdev_mc_count(net) > AX_MAX_MCAST) {
758 rx_ctl |= 0x02; 762 rx_ctl |= 0x02;
759 } else if (net->mc_count == 0) { 763 } else if (netdev_mc_empty(net)) {
760 /* just broadcast and directed */ 764 /* just broadcast and directed */
761 } else { 765 } else {
762 /* We use the 20 byte dev->data 766 /* We use the 20 byte dev->data
763 * for our 8 byte filter buffer 767 * for our 8 byte filter buffer
764 * to avoid allocating memory that 768 * to avoid allocating memory that
765 * is tricky to free later */ 769 * is tricky to free later */
766 struct dev_mc_list *mc_list = net->mc_list; 770 struct dev_mc_list *mc_list;
767 u32 crc_bits; 771 u32 crc_bits;
768 int i;
769 772
770 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); 773 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
771 774
772 /* Build the multicast hash filter. */ 775 /* Build the multicast hash filter. */
773 for (i = 0; i < net->mc_count; i++) { 776 netdev_for_each_mc_addr(mc_list, net) {
774 crc_bits = 777 crc_bits =
775 ether_crc(ETH_ALEN, 778 ether_crc(ETH_ALEN,
776 mc_list->dmi_addr) >> 26; 779 mc_list->dmi_addr) >> 26;
777 data->multi_filter[crc_bits >> 3] |= 780 data->multi_filter[crc_bits >> 3] |=
778 1 << (crc_bits & 7); 781 1 << (crc_bits & 7);
779 mc_list = mc_list->next;
780 } 782 }
781 783
782 asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, 784 asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
@@ -800,7 +802,8 @@ static int ax88172_link_reset(struct usbnet *dev)
800 if (ecmd.duplex != DUPLEX_FULL) 802 if (ecmd.duplex != DUPLEX_FULL)
801 mode |= ~AX88172_MEDIUM_FD; 803 mode |= ~AX88172_MEDIUM_FD;
802 804
803 devdbg(dev, "ax88172_link_reset() speed: %d duplex: %d setting mode to 0x%04x", ecmd.speed, ecmd.duplex, mode); 805 netdev_dbg(dev->net, "ax88172_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n",
806 ecmd.speed, ecmd.duplex, mode);
804 807
805 asix_write_medium_mode(dev, mode); 808 asix_write_medium_mode(dev, mode);
806 809
@@ -902,7 +905,8 @@ static int ax88772_link_reset(struct usbnet *dev)
902 if (ecmd.duplex != DUPLEX_FULL) 905 if (ecmd.duplex != DUPLEX_FULL)
903 mode &= ~AX_MEDIUM_FD; 906 mode &= ~AX_MEDIUM_FD;
904 907
905 devdbg(dev, "ax88772_link_reset() speed: %d duplex: %d setting mode to 0x%04x", ecmd.speed, ecmd.duplex, mode); 908 netdev_dbg(dev->net, "ax88772_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n",
909 ecmd.speed, ecmd.duplex, mode);
906 910
907 asix_write_medium_mode(dev, mode); 911 asix_write_medium_mode(dev, mode);
908 912
@@ -1059,10 +1063,10 @@ static int marvell_phy_init(struct usbnet *dev)
1059 struct asix_data *data = (struct asix_data *)&dev->data; 1063 struct asix_data *data = (struct asix_data *)&dev->data;
1060 u16 reg; 1064 u16 reg;
1061 1065
1062 devdbg(dev,"marvell_phy_init()"); 1066 netdev_dbg(dev->net, "marvell_phy_init()\n");
1063 1067
1064 reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_MARVELL_STATUS); 1068 reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_MARVELL_STATUS);
1065 devdbg(dev,"MII_MARVELL_STATUS = 0x%04x", reg); 1069 netdev_dbg(dev->net, "MII_MARVELL_STATUS = 0x%04x\n", reg);
1066 1070
1067 asix_mdio_write(dev->net, dev->mii.phy_id, MII_MARVELL_CTRL, 1071 asix_mdio_write(dev->net, dev->mii.phy_id, MII_MARVELL_CTRL,
1068 MARVELL_CTRL_RXDELAY | MARVELL_CTRL_TXDELAY); 1072 MARVELL_CTRL_RXDELAY | MARVELL_CTRL_TXDELAY);
@@ -1070,7 +1074,7 @@ static int marvell_phy_init(struct usbnet *dev)
1070 if (data->ledmode) { 1074 if (data->ledmode) {
1071 reg = asix_mdio_read(dev->net, dev->mii.phy_id, 1075 reg = asix_mdio_read(dev->net, dev->mii.phy_id,
1072 MII_MARVELL_LED_CTRL); 1076 MII_MARVELL_LED_CTRL);
1073 devdbg(dev,"MII_MARVELL_LED_CTRL (1) = 0x%04x", reg); 1077 netdev_dbg(dev->net, "MII_MARVELL_LED_CTRL (1) = 0x%04x\n", reg);
1074 1078
1075 reg &= 0xf8ff; 1079 reg &= 0xf8ff;
1076 reg |= (1 + 0x0100); 1080 reg |= (1 + 0x0100);
@@ -1079,7 +1083,7 @@ static int marvell_phy_init(struct usbnet *dev)
1079 1083
1080 reg = asix_mdio_read(dev->net, dev->mii.phy_id, 1084 reg = asix_mdio_read(dev->net, dev->mii.phy_id,
1081 MII_MARVELL_LED_CTRL); 1085 MII_MARVELL_LED_CTRL);
1082 devdbg(dev,"MII_MARVELL_LED_CTRL (2) = 0x%04x", reg); 1086 netdev_dbg(dev->net, "MII_MARVELL_LED_CTRL (2) = 0x%04x\n", reg);
1083 reg &= 0xfc0f; 1087 reg &= 0xfc0f;
1084 } 1088 }
1085 1089
@@ -1090,7 +1094,7 @@ static int marvell_led_status(struct usbnet *dev, u16 speed)
1090{ 1094{
1091 u16 reg = asix_mdio_read(dev->net, dev->mii.phy_id, MARVELL_LED_MANUAL); 1095 u16 reg = asix_mdio_read(dev->net, dev->mii.phy_id, MARVELL_LED_MANUAL);
1092 1096
1093 devdbg(dev, "marvell_led_status() read 0x%04x", reg); 1097 netdev_dbg(dev->net, "marvell_led_status() read 0x%04x\n", reg);
1094 1098
1095 /* Clear out the center LED bits - 0x03F0 */ 1099 /* Clear out the center LED bits - 0x03F0 */
1096 reg &= 0xfc0f; 1100 reg &= 0xfc0f;
@@ -1106,7 +1110,7 @@ static int marvell_led_status(struct usbnet *dev, u16 speed)
1106 reg |= 0x02f0; 1110 reg |= 0x02f0;
1107 } 1111 }
1108 1112
1109 devdbg(dev, "marvell_led_status() writing 0x%04x", reg); 1113 netdev_dbg(dev->net, "marvell_led_status() writing 0x%04x\n", reg);
1110 asix_mdio_write(dev->net, dev->mii.phy_id, MARVELL_LED_MANUAL, reg); 1114 asix_mdio_write(dev->net, dev->mii.phy_id, MARVELL_LED_MANUAL, reg);
1111 1115
1112 return 0; 1116 return 0;
@@ -1118,7 +1122,7 @@ static int ax88178_link_reset(struct usbnet *dev)
1118 struct ethtool_cmd ecmd; 1122 struct ethtool_cmd ecmd;
1119 struct asix_data *data = (struct asix_data *)&dev->data; 1123 struct asix_data *data = (struct asix_data *)&dev->data;
1120 1124
1121 devdbg(dev,"ax88178_link_reset()"); 1125 netdev_dbg(dev->net, "ax88178_link_reset()\n");
1122 1126
1123 mii_check_media(&dev->mii, 1, 1); 1127 mii_check_media(&dev->mii, 1, 1);
1124 mii_ethtool_gset(&dev->mii, &ecmd); 1128 mii_ethtool_gset(&dev->mii, &ecmd);
@@ -1138,7 +1142,8 @@ static int ax88178_link_reset(struct usbnet *dev)
1138 else 1142 else
1139 mode &= ~AX_MEDIUM_FD; 1143 mode &= ~AX_MEDIUM_FD;
1140 1144
1141 devdbg(dev, "ax88178_link_reset() speed: %d duplex: %d setting mode to 0x%04x", ecmd.speed, ecmd.duplex, mode); 1145 netdev_dbg(dev->net, "ax88178_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n",
1146 ecmd.speed, ecmd.duplex, mode);
1142 1147
1143 asix_write_medium_mode(dev, mode); 1148 asix_write_medium_mode(dev, mode);
1144 1149
@@ -1188,7 +1193,7 @@ static int ax88178_change_mtu(struct net_device *net, int new_mtu)
1188 struct usbnet *dev = netdev_priv(net); 1193 struct usbnet *dev = netdev_priv(net);
1189 int ll_mtu = new_mtu + net->hard_header_len + 4; 1194 int ll_mtu = new_mtu + net->hard_header_len + 4;
1190 1195
1191 devdbg(dev, "ax88178_change_mtu() new_mtu=%d", new_mtu); 1196 netdev_dbg(dev->net, "ax88178_change_mtu() new_mtu=%d\n", new_mtu);
1192 1197
1193 if (new_mtu <= 0 || ll_mtu > 16384) 1198 if (new_mtu <= 0 || ll_mtu > 16384)
1194 return -EINVAL; 1199 return -EINVAL;
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 22b87e64a810..96f1ebe0d348 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -632,7 +632,6 @@ static void catc_set_multicast_list(struct net_device *netdev)
632 struct dev_mc_list *mc; 632 struct dev_mc_list *mc;
633 u8 broadcast[6]; 633 u8 broadcast[6];
634 u8 rx = RxEnable | RxPolarity | RxMultiCast; 634 u8 rx = RxEnable | RxPolarity | RxMultiCast;
635 int i;
636 635
637 memset(broadcast, 0xff, 6); 636 memset(broadcast, 0xff, 6);
638 memset(catc->multicast, 0, 64); 637 memset(catc->multicast, 0, 64);
@@ -648,7 +647,7 @@ static void catc_set_multicast_list(struct net_device *netdev)
648 if (netdev->flags & IFF_ALLMULTI) { 647 if (netdev->flags & IFF_ALLMULTI) {
649 memset(catc->multicast, 0xff, 64); 648 memset(catc->multicast, 0xff, 64);
650 } else { 649 } else {
651 for (i = 0, mc = netdev->mc_list; mc && i < netdev->mc_count; i++, mc = mc->next) { 650 netdev_for_each_mc_addr(mc, netdev) {
652 u32 crc = ether_crc_le(6, mc->dmi_addr); 651 u32 crc = ether_crc_le(6, mc->dmi_addr);
653 if (!catc->is_f5u011) { 652 if (!catc->is_f5u011) {
654 catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7); 653 catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7);
@@ -897,11 +896,9 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
897 f5u011_rxmode(catc, catc->rxmode); 896 f5u011_rxmode(catc, catc->rxmode);
898 } 897 }
899 dbg("Init done."); 898 dbg("Init done.");
900 printk(KERN_INFO "%s: %s USB Ethernet at usb-%s-%s, ", 899 printk(KERN_INFO "%s: %s USB Ethernet at usb-%s-%s, %pM.\n",
901 netdev->name, (catc->is_f5u011) ? "Belkin F5U011" : "CATC EL1210A NetMate", 900 netdev->name, (catc->is_f5u011) ? "Belkin F5U011" : "CATC EL1210A NetMate",
902 usbdev->bus->bus_name, usbdev->devpath); 901 usbdev->bus->bus_name, usbdev->devpath, netdev->dev_addr);
903 for (i = 0; i < 5; i++) printk("%2.2x:", netdev->dev_addr[i]);
904 printk("%2.2x.\n", netdev->dev_addr[i]);
905 usb_set_intfdata(intf, catc); 902 usb_set_intfdata(intf, catc);
906 903
907 SET_NETDEV_DEV(netdev, &intf->dev); 904 SET_NETDEV_DEV(netdev, &intf->dev);
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index c337ffc3304a..a4a85a6ed86d 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -73,7 +73,7 @@ static void eem_linkcmd(struct usbnet *dev, struct sk_buff *skb)
73 usb_free_urb(urb); 73 usb_free_urb(urb);
74fail: 74fail:
75 dev_kfree_skb(skb); 75 dev_kfree_skb(skb);
76 devwarn(dev, "link cmd failure\n"); 76 netdev_warn(dev->net, "link cmd failure\n");
77 return; 77 return;
78 } 78 }
79} 79}
@@ -212,7 +212,8 @@ static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
212 * b15: 1 (EEM command) 212 * b15: 1 (EEM command)
213 */ 213 */
214 if (header & BIT(14)) { 214 if (header & BIT(14)) {
215 devdbg(dev, "reserved command %04x\n", header); 215 netdev_dbg(dev->net, "reserved command %04x\n",
216 header);
216 continue; 217 continue;
217 } 218 }
218 219
@@ -255,8 +256,9 @@ static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
255 case 1: /* Echo response */ 256 case 1: /* Echo response */
256 case 5: /* Tickle */ 257 case 5: /* Tickle */
257 default: /* reserved */ 258 default: /* reserved */
258 devwarn(dev, "unexpected link command %d\n", 259 netdev_warn(dev->net,
259 bmEEMCmd); 260 "unexpected link command %d\n",
261 bmEEMCmd);
260 continue; 262 continue;
261 } 263 }
262 264
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 5f3b9eaeb04f..c8cdb7f30adc 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -339,10 +339,10 @@ EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
339 339
340static void dumpspeed(struct usbnet *dev, __le32 *speeds) 340static void dumpspeed(struct usbnet *dev, __le32 *speeds)
341{ 341{
342 if (netif_msg_timer(dev)) 342 netif_info(dev, timer, dev->net,
343 devinfo(dev, "link speeds: %u kbps up, %u kbps down", 343 "link speeds: %u kbps up, %u kbps down\n",
344 __le32_to_cpu(speeds[0]) / 1000, 344 __le32_to_cpu(speeds[0]) / 1000,
345 __le32_to_cpu(speeds[1]) / 1000); 345 __le32_to_cpu(speeds[1]) / 1000);
346} 346}
347 347
348static void cdc_status(struct usbnet *dev, struct urb *urb) 348static void cdc_status(struct usbnet *dev, struct urb *urb)
@@ -361,18 +361,16 @@ static void cdc_status(struct usbnet *dev, struct urb *urb)
361 event = urb->transfer_buffer; 361 event = urb->transfer_buffer;
362 switch (event->bNotificationType) { 362 switch (event->bNotificationType) {
363 case USB_CDC_NOTIFY_NETWORK_CONNECTION: 363 case USB_CDC_NOTIFY_NETWORK_CONNECTION:
364 if (netif_msg_timer(dev)) 364 netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",
365 devdbg(dev, "CDC: carrier %s", 365 event->wValue ? "on" : "off");
366 event->wValue ? "on" : "off");
367 if (event->wValue) 366 if (event->wValue)
368 netif_carrier_on(dev->net); 367 netif_carrier_on(dev->net);
369 else 368 else
370 netif_carrier_off(dev->net); 369 netif_carrier_off(dev->net);
371 break; 370 break;
372 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */ 371 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */
373 if (netif_msg_timer(dev)) 372 netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n",
374 devdbg(dev, "CDC: speed change (len %d)", 373 urb->actual_length);
375 urb->actual_length);
376 if (urb->actual_length != (sizeof *event + 8)) 374 if (urb->actual_length != (sizeof *event + 8))
377 set_bit(EVENT_STS_SPLIT, &dev->flags); 375 set_bit(EVENT_STS_SPLIT, &dev->flags);
378 else 376 else
@@ -382,8 +380,8 @@ static void cdc_status(struct usbnet *dev, struct urb *urb)
382 * but there are no standard formats for the response data. 380 * but there are no standard formats for the response data.
383 */ 381 */
384 default: 382 default:
385 deverr(dev, "CDC: unexpected notification %02x!", 383 netdev_err(dev->net, "CDC: unexpected notification %02x!\n",
386 event->bNotificationType); 384 event->bNotificationType);
387 break; 385 break;
388 } 386 }
389} 387}
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 3d406f9b2f29..269339769f47 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -58,7 +58,7 @@ static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data)
58 void *buf; 58 void *buf;
59 int err = -ENOMEM; 59 int err = -ENOMEM;
60 60
61 devdbg(dev, "dm_read() reg=0x%02x length=%d", reg, length); 61 netdev_dbg(dev->net, "dm_read() reg=0x%02x length=%d\n", reg, length);
62 62
63 buf = kmalloc(length, GFP_KERNEL); 63 buf = kmalloc(length, GFP_KERNEL);
64 if (!buf) 64 if (!buf)
@@ -89,7 +89,7 @@ static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data)
89 void *buf = NULL; 89 void *buf = NULL;
90 int err = -ENOMEM; 90 int err = -ENOMEM;
91 91
92 devdbg(dev, "dm_write() reg=0x%02x, length=%d", reg, length); 92 netdev_dbg(dev->net, "dm_write() reg=0x%02x, length=%d\n", reg, length);
93 93
94 if (data) { 94 if (data) {
95 buf = kmalloc(length, GFP_KERNEL); 95 buf = kmalloc(length, GFP_KERNEL);
@@ -112,7 +112,8 @@ static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data)
112 112
113static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value) 113static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value)
114{ 114{
115 devdbg(dev, "dm_write_reg() reg=0x%02x, value=0x%02x", reg, value); 115 netdev_dbg(dev->net, "dm_write_reg() reg=0x%02x, value=0x%02x\n",
116 reg, value);
116 return usb_control_msg(dev->udev, 117 return usb_control_msg(dev->udev,
117 usb_sndctrlpipe(dev->udev, 0), 118 usb_sndctrlpipe(dev->udev, 0),
118 DM_WRITE_REG, 119 DM_WRITE_REG,
@@ -142,13 +143,13 @@ static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value,
142 143
143 urb = usb_alloc_urb(0, GFP_ATOMIC); 144 urb = usb_alloc_urb(0, GFP_ATOMIC);
144 if (!urb) { 145 if (!urb) {
145 deverr(dev, "Error allocating URB in dm_write_async_helper!"); 146 netdev_err(dev->net, "Error allocating URB in dm_write_async_helper!\n");
146 return; 147 return;
147 } 148 }
148 149
149 req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); 150 req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
150 if (!req) { 151 if (!req) {
151 deverr(dev, "Failed to allocate memory for control request"); 152 netdev_err(dev->net, "Failed to allocate memory for control request\n");
152 usb_free_urb(urb); 153 usb_free_urb(urb);
153 return; 154 return;
154 } 155 }
@@ -166,8 +167,8 @@ static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value,
166 167
167 status = usb_submit_urb(urb, GFP_ATOMIC); 168 status = usb_submit_urb(urb, GFP_ATOMIC);
168 if (status < 0) { 169 if (status < 0) {
169 deverr(dev, "Error submitting the control message: status=%d", 170 netdev_err(dev->net, "Error submitting the control message: status=%d\n",
170 status); 171 status);
171 kfree(req); 172 kfree(req);
172 usb_free_urb(urb); 173 usb_free_urb(urb);
173 } 174 }
@@ -175,15 +176,15 @@ static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value,
175 176
176static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) 177static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
177{ 178{
178 devdbg(dev, "dm_write_async() reg=0x%02x length=%d", reg, length); 179 netdev_dbg(dev->net, "dm_write_async() reg=0x%02x length=%d\n", reg, length);
179 180
180 dm_write_async_helper(dev, reg, 0, length, data); 181 dm_write_async_helper(dev, reg, 0, length, data);
181} 182}
182 183
183static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value) 184static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
184{ 185{
185 devdbg(dev, "dm_write_reg_async() reg=0x%02x value=0x%02x", 186 netdev_dbg(dev->net, "dm_write_reg_async() reg=0x%02x value=0x%02x\n",
186 reg, value); 187 reg, value);
187 188
188 dm_write_async_helper(dev, reg, value, 0, NULL); 189 dm_write_async_helper(dev, reg, value, 0, NULL);
189} 190}
@@ -211,7 +212,7 @@ static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *valu
211 } 212 }
212 213
213 if (i == DM_TIMEOUT) { 214 if (i == DM_TIMEOUT) {
214 deverr(dev, "%s read timed out!", phy ? "phy" : "eeprom"); 215 netdev_err(dev->net, "%s read timed out!\n", phy ? "phy" : "eeprom");
215 ret = -EIO; 216 ret = -EIO;
216 goto out; 217 goto out;
217 } 218 }
@@ -219,8 +220,8 @@ static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *valu
219 dm_write_reg(dev, DM_SHARED_CTRL, 0x0); 220 dm_write_reg(dev, DM_SHARED_CTRL, 0x0);
220 ret = dm_read(dev, DM_SHARED_DATA, 2, value); 221 ret = dm_read(dev, DM_SHARED_DATA, 2, value);
221 222
222 devdbg(dev, "read shared %d 0x%02x returned 0x%04x, %d", 223 netdev_dbg(dev->net, "read shared %d 0x%02x returned 0x%04x, %d\n",
223 phy, reg, *value, ret); 224 phy, reg, *value, ret);
224 225
225 out: 226 out:
226 mutex_unlock(&dev->phy_mutex); 227 mutex_unlock(&dev->phy_mutex);
@@ -254,7 +255,7 @@ static int dm_write_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 valu
254 } 255 }
255 256
256 if (i == DM_TIMEOUT) { 257 if (i == DM_TIMEOUT) {
257 deverr(dev, "%s write timed out!", phy ? "phy" : "eeprom"); 258 netdev_err(dev->net, "%s write timed out!\n", phy ? "phy" : "eeprom");
258 ret = -EIO; 259 ret = -EIO;
259 goto out; 260 goto out;
260 } 261 }
@@ -304,15 +305,15 @@ static int dm9601_mdio_read(struct net_device *netdev, int phy_id, int loc)
304 __le16 res; 305 __le16 res;
305 306
306 if (phy_id) { 307 if (phy_id) {
307 devdbg(dev, "Only internal phy supported"); 308 netdev_dbg(dev->net, "Only internal phy supported\n");
308 return 0; 309 return 0;
309 } 310 }
310 311
311 dm_read_shared_word(dev, 1, loc, &res); 312 dm_read_shared_word(dev, 1, loc, &res);
312 313
313 devdbg(dev, 314 netdev_dbg(dev->net,
314 "dm9601_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", 315 "dm9601_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n",
315 phy_id, loc, le16_to_cpu(res)); 316 phy_id, loc, le16_to_cpu(res));
316 317
317 return le16_to_cpu(res); 318 return le16_to_cpu(res);
318} 319}
@@ -324,12 +325,12 @@ static void dm9601_mdio_write(struct net_device *netdev, int phy_id, int loc,
324 __le16 res = cpu_to_le16(val); 325 __le16 res = cpu_to_le16(val);
325 326
326 if (phy_id) { 327 if (phy_id) {
327 devdbg(dev, "Only internal phy supported"); 328 netdev_dbg(dev->net, "Only internal phy supported\n");
328 return; 329 return;
329 } 330 }
330 331
331 devdbg(dev,"dm9601_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", 332 netdev_dbg(dev->net, "dm9601_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x\n",
332 phy_id, loc, val); 333 phy_id, loc, val);
333 334
334 dm_write_shared_word(dev, 1, loc, res); 335 dm_write_shared_word(dev, 1, loc, res);
335} 336}
@@ -381,13 +382,13 @@ static void dm9601_set_multicast(struct net_device *net)
381 382
382 if (net->flags & IFF_PROMISC) { 383 if (net->flags & IFF_PROMISC) {
383 rx_ctl |= 0x02; 384 rx_ctl |= 0x02;
384 } else if (net->flags & IFF_ALLMULTI || net->mc_count > DM_MAX_MCAST) { 385 } else if (net->flags & IFF_ALLMULTI ||
386 netdev_mc_count(net) > DM_MAX_MCAST) {
385 rx_ctl |= 0x04; 387 rx_ctl |= 0x04;
386 } else if (net->mc_count) { 388 } else if (!netdev_mc_empty(net)) {
387 struct dev_mc_list *mc_list = net->mc_list; 389 struct dev_mc_list *mc_list;
388 int i;
389 390
390 for (i = 0; i < net->mc_count; i++, mc_list = mc_list->next) { 391 netdev_for_each_mc_addr(mc_list, net) {
391 u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26; 392 u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
392 hashes[crc >> 3] |= 1 << (crc & 0x7); 393 hashes[crc >> 3] |= 1 << (crc & 0x7);
393 } 394 }
@@ -592,7 +593,7 @@ static void dm9601_status(struct usbnet *dev, struct urb *urb)
592 } 593 }
593 else 594 else
594 netif_carrier_off(dev->net); 595 netif_carrier_off(dev->net);
595 devdbg(dev, "Link Status is: %d", link); 596 netdev_dbg(dev->net, "Link Status is: %d\n", link);
596 } 597 }
597} 598}
598 599
@@ -603,8 +604,8 @@ static int dm9601_link_reset(struct usbnet *dev)
603 mii_check_media(&dev->mii, 1, 1); 604 mii_check_media(&dev->mii, 1, 1);
604 mii_ethtool_gset(&dev->mii, &ecmd); 605 mii_ethtool_gset(&dev->mii, &ecmd);
605 606
606 devdbg(dev, "link_reset() speed: %d duplex: %d", 607 netdev_dbg(dev->net, "link_reset() speed: %d duplex: %d\n",
607 ecmd.speed, ecmd.duplex); 608 ecmd.speed, ecmd.duplex);
608 609
609 return 0; 610 return 0;
610} 611}
diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c
index 55cf7081de10..3c228df57062 100644
--- a/drivers/net/usb/int51x1.c
+++ b/drivers/net/usb/int51x1.c
@@ -51,7 +51,7 @@ static int int51x1_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
51 int len; 51 int len;
52 52
53 if (!(pskb_may_pull(skb, INT51X1_HEADER_SIZE))) { 53 if (!(pskb_may_pull(skb, INT51X1_HEADER_SIZE))) {
54 deverr(dev, "unexpected tiny rx frame"); 54 netdev_err(dev->net, "unexpected tiny rx frame\n");
55 return 0; 55 return 0;
56 } 56 }
57 57
@@ -138,25 +138,25 @@ static void int51x1_set_multicast(struct net_device *netdev)
138 if (netdev->flags & IFF_PROMISC) { 138 if (netdev->flags & IFF_PROMISC) {
139 /* do not expect to see traffic of other PLCs */ 139 /* do not expect to see traffic of other PLCs */
140 filter |= PACKET_TYPE_PROMISCUOUS; 140 filter |= PACKET_TYPE_PROMISCUOUS;
141 devinfo(dev, "promiscuous mode enabled"); 141 netdev_info(dev->net, "promiscuous mode enabled\n");
142 } else if (netdev->mc_count || 142 } else if (!netdev_mc_empty(netdev) ||
143 (netdev->flags & IFF_ALLMULTI)) { 143 (netdev->flags & IFF_ALLMULTI)) {
144 filter |= PACKET_TYPE_ALL_MULTICAST; 144 filter |= PACKET_TYPE_ALL_MULTICAST;
145 devdbg(dev, "receive all multicast enabled"); 145 netdev_dbg(dev->net, "receive all multicast enabled\n");
146 } else { 146 } else {
147 /* ~PROMISCUOUS, ~MULTICAST */ 147 /* ~PROMISCUOUS, ~MULTICAST */
148 devdbg(dev, "receive own packets only"); 148 netdev_dbg(dev->net, "receive own packets only\n");
149 } 149 }
150 150
151 urb = usb_alloc_urb(0, GFP_ATOMIC); 151 urb = usb_alloc_urb(0, GFP_ATOMIC);
152 if (!urb) { 152 if (!urb) {
153 devwarn(dev, "Error allocating URB"); 153 netdev_warn(dev->net, "Error allocating URB\n");
154 return; 154 return;
155 } 155 }
156 156
157 req = kmalloc(sizeof(*req), GFP_ATOMIC); 157 req = kmalloc(sizeof(*req), GFP_ATOMIC);
158 if (!req) { 158 if (!req) {
159 devwarn(dev, "Error allocating control msg"); 159 netdev_warn(dev->net, "Error allocating control msg\n");
160 goto out; 160 goto out;
161 } 161 }
162 162
@@ -173,7 +173,8 @@ static void int51x1_set_multicast(struct net_device *netdev)
173 173
174 status = usb_submit_urb(urb, GFP_ATOMIC); 174 status = usb_submit_urb(urb, GFP_ATOMIC);
175 if (status < 0) { 175 if (status < 0) {
176 devwarn(dev, "Error submitting control msg, sts=%d", status); 176 netdev_warn(dev->net, "Error submitting control msg, sts=%d\n",
177 status);
177 goto out1; 178 goto out1;
178 } 179 }
179 return; 180 return;
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index f1d64ef67efa..52671ea043a7 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -881,7 +881,7 @@ static void kaweth_set_rx_mode(struct net_device *net)
881 if (net->flags & IFF_PROMISC) { 881 if (net->flags & IFF_PROMISC) {
882 packet_filter_bitmap |= KAWETH_PACKET_FILTER_PROMISCUOUS; 882 packet_filter_bitmap |= KAWETH_PACKET_FILTER_PROMISCUOUS;
883 } 883 }
884 else if ((net->mc_count) || (net->flags & IFF_ALLMULTI)) { 884 else if (!netdev_mc_empty(net) || (net->flags & IFF_ALLMULTI)) {
885 packet_filter_bitmap |= KAWETH_PACKET_FILTER_ALL_MULTICAST; 885 packet_filter_bitmap |= KAWETH_PACKET_FILTER_ALL_MULTICAST;
886 } 886 }
887 887
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 87374317f480..70978219e98a 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -1,13 +1,27 @@
1/* 1/*
2 * MosChips MCS7830 based USB 2.0 Ethernet Devices 2 * MOSCHIP MCS7830 based USB 2.0 Ethernet Devices
3 * 3 *
4 * based on usbnet.c, asix.c and the vendor provided mcs7830 driver 4 * based on usbnet.c, asix.c and the vendor provided mcs7830 driver
5 * 5 *
6 * Copyright (C) 2010 Andreas Mohr <andi@lisas.de>
6 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de> 7 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>
7 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com> 8 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
8 * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net> 9 * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
9 * Copyright (c) 2002-2003 TiVo Inc. 10 * Copyright (c) 2002-2003 TiVo Inc.
10 * 11 *
12 * Definitions gathered from MOSCHIP, Data Sheet_7830DA.pdf (thanks!).
13 *
14 * TODO:
15 * - support HIF_REG_CONFIG_SLEEPMODE/HIF_REG_CONFIG_TXENABLE (via autopm?)
16 * - implement ethtool_ops get_pauseparam/set_pauseparam
17 * via HIF_REG_PAUSE_THRESHOLD (>= revision C only!)
18 * - implement get_eeprom/[set_eeprom]
19 * - switch PHY on/off on ifup/ifdown (perhaps in usbnet.c, via MII)
20 * - mcs7830_get_regs() handling is weird: for rev 2 we return 32 regs,
21 * can access only ~ 24, remaining user buffer is uninitialized garbage
22 * - anything else?
23 *
24 *
11 * This program is free software; you can redistribute it and/or modify 25 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 26 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or 27 * the Free Software Foundation; either version 2 of the License, or
@@ -55,7 +69,7 @@
55 ADVERTISE_100HALF | ADVERTISE_10FULL | \ 69 ADVERTISE_100HALF | ADVERTISE_10FULL | \
56 ADVERTISE_10HALF | ADVERTISE_CSMA) 70 ADVERTISE_10HALF | ADVERTISE_CSMA)
57 71
58/* HIF_REG_XX coressponding index value */ 72/* HIF_REG_XX corresponding index value */
59enum { 73enum {
60 HIF_REG_MULTICAST_HASH = 0x00, 74 HIF_REG_MULTICAST_HASH = 0x00,
61 HIF_REG_PACKET_GAP1 = 0x08, 75 HIF_REG_PACKET_GAP1 = 0x08,
@@ -69,6 +83,7 @@ enum {
69 HIF_REG_PHY_CMD2_PEND_FLAG_BIT = 0x80, 83 HIF_REG_PHY_CMD2_PEND_FLAG_BIT = 0x80,
70 HIF_REG_PHY_CMD2_READY_FLAG_BIT = 0x40, 84 HIF_REG_PHY_CMD2_READY_FLAG_BIT = 0x40,
71 HIF_REG_CONFIG = 0x0e, 85 HIF_REG_CONFIG = 0x0e,
86 /* hmm, spec sez: "R/W", "Except bit 3" (likely TXENABLE). */
72 HIF_REG_CONFIG_CFG = 0x80, 87 HIF_REG_CONFIG_CFG = 0x80,
73 HIF_REG_CONFIG_SPEED100 = 0x40, 88 HIF_REG_CONFIG_SPEED100 = 0x40,
74 HIF_REG_CONFIG_FULLDUPLEX_ENABLE = 0x20, 89 HIF_REG_CONFIG_FULLDUPLEX_ENABLE = 0x20,
@@ -76,13 +91,24 @@ enum {
76 HIF_REG_CONFIG_TXENABLE = 0x08, 91 HIF_REG_CONFIG_TXENABLE = 0x08,
77 HIF_REG_CONFIG_SLEEPMODE = 0x04, 92 HIF_REG_CONFIG_SLEEPMODE = 0x04,
78 HIF_REG_CONFIG_ALLMULTICAST = 0x02, 93 HIF_REG_CONFIG_ALLMULTICAST = 0x02,
79 HIF_REG_CONFIG_PROMISCIOUS = 0x01, 94 HIF_REG_CONFIG_PROMISCUOUS = 0x01,
80 HIF_REG_ETHERNET_ADDR = 0x0f, 95 HIF_REG_ETHERNET_ADDR = 0x0f,
81 HIF_REG_22 = 0x15, 96 HIF_REG_FRAME_DROP_COUNTER = 0x15, /* 0..ff; reset: 0 */
82 HIF_REG_PAUSE_THRESHOLD = 0x16, 97 HIF_REG_PAUSE_THRESHOLD = 0x16,
83 HIF_REG_PAUSE_THRESHOLD_DEFAULT = 0, 98 HIF_REG_PAUSE_THRESHOLD_DEFAULT = 0,
84}; 99};
85 100
101/* Trailing status byte in Ethernet Rx frame */
102enum {
103 MCS7830_RX_SHORT_FRAME = 0x01, /* < 64 bytes */
104 MCS7830_RX_LENGTH_ERROR = 0x02, /* framelen != Ethernet length field */
105 MCS7830_RX_ALIGNMENT_ERROR = 0x04, /* non-even number of nibbles */
106 MCS7830_RX_CRC_ERROR = 0x08,
107 MCS7830_RX_LARGE_FRAME = 0x10, /* > 1518 bytes */
108 MCS7830_RX_FRAME_CORRECT = 0x20, /* frame is correct */
109 /* [7:6] reserved */
110};
111
86struct mcs7830_data { 112struct mcs7830_data {
87 u8 multi_filter[8]; 113 u8 multi_filter[8];
88 u8 config; 114 u8 config;
@@ -109,7 +135,7 @@ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data)
109 return ret; 135 return ret;
110} 136}
111 137
112static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, void *data) 138static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data)
113{ 139{
114 struct usb_device *xdev = dev->udev; 140 struct usb_device *xdev = dev->udev;
115 int ret; 141 int ret;
@@ -183,13 +209,43 @@ out:
183 usb_free_urb(urb); 209 usb_free_urb(urb);
184} 210}
185 211
186static int mcs7830_get_address(struct usbnet *dev) 212static int mcs7830_hif_get_mac_address(struct usbnet *dev, unsigned char *addr)
213{
214 int ret = mcs7830_get_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN, addr);
215 if (ret < 0)
216 return ret;
217 return 0;
218}
219
220static int mcs7830_hif_set_mac_address(struct usbnet *dev, unsigned char *addr)
221{
222 int ret = mcs7830_set_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN, addr);
223
224 if (ret < 0)
225 return ret;
226 return 0;
227}
228
229static int mcs7830_set_mac_address(struct net_device *netdev, void *p)
187{ 230{
188 int ret; 231 int ret;
189 ret = mcs7830_get_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN, 232 struct usbnet *dev = netdev_priv(netdev);
190 dev->net->dev_addr); 233 struct sockaddr *addr = p;
234
235 if (netif_running(netdev))
236 return -EBUSY;
237
238 if (!is_valid_ether_addr(addr->sa_data))
239 return -EINVAL;
240
241 ret = mcs7830_hif_set_mac_address(dev, addr->sa_data);
242
191 if (ret < 0) 243 if (ret < 0)
192 return ret; 244 return ret;
245
246 /* it worked --> adopt it on netdev side */
247 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
248
193 return 0; 249 return 0;
194} 250}
195 251
@@ -307,7 +363,7 @@ static int mcs7830_get_rev(struct usbnet *dev)
307{ 363{
308 u8 dummy[2]; 364 u8 dummy[2];
309 int ret; 365 int ret;
310 ret = mcs7830_get_reg(dev, HIF_REG_22, 2, dummy); 366 ret = mcs7830_get_reg(dev, HIF_REG_FRAME_DROP_COUNTER, 2, dummy);
311 if (ret > 0) 367 if (ret > 0)
312 return 2; /* Rev C or later */ 368 return 2; /* Rev C or later */
313 return 1; /* earlier revision */ 369 return 1; /* earlier revision */
@@ -331,33 +387,6 @@ static void mcs7830_rev_C_fixup(struct usbnet *dev)
331 } 387 }
332} 388}
333 389
334static int mcs7830_init_dev(struct usbnet *dev)
335{
336 int ret;
337 int retry;
338
339 /* Read MAC address from EEPROM */
340 ret = -EINVAL;
341 for (retry = 0; retry < 5 && ret; retry++)
342 ret = mcs7830_get_address(dev);
343 if (ret) {
344 dev_warn(&dev->udev->dev, "Cannot read MAC address\n");
345 goto out;
346 }
347
348 /* Set up PHY */
349 ret = mcs7830_set_autoneg(dev, 0);
350 if (ret) {
351 dev_info(&dev->udev->dev, "Cannot set autoneg\n");
352 goto out;
353 }
354
355 mcs7830_rev_C_fixup(dev);
356 ret = 0;
357out:
358 return ret;
359}
360
361static int mcs7830_mdio_read(struct net_device *netdev, int phy_id, 390static int mcs7830_mdio_read(struct net_device *netdev, int phy_id,
362 int location) 391 int location)
363{ 392{
@@ -378,11 +407,33 @@ static int mcs7830_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
378 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); 407 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
379} 408}
380 409
381/* credits go to asix_set_multicast */ 410static inline struct mcs7830_data *mcs7830_get_data(struct usbnet *dev)
382static void mcs7830_set_multicast(struct net_device *net) 411{
412 return (struct mcs7830_data *)&dev->data;
413}
414
415static void mcs7830_hif_update_multicast_hash(struct usbnet *dev)
416{
417 struct mcs7830_data *data = mcs7830_get_data(dev);
418 mcs7830_set_reg_async(dev, HIF_REG_MULTICAST_HASH,
419 sizeof data->multi_filter,
420 data->multi_filter);
421}
422
423static void mcs7830_hif_update_config(struct usbnet *dev)
424{
425 /* implementation specific to data->config
426 (argument needs to be heap-based anyway - USB DMA!) */
427 struct mcs7830_data *data = mcs7830_get_data(dev);
428 mcs7830_set_reg_async(dev, HIF_REG_CONFIG, 1, &data->config);
429}
430
431static void mcs7830_data_set_multicast(struct net_device *net)
383{ 432{
384 struct usbnet *dev = netdev_priv(net); 433 struct usbnet *dev = netdev_priv(net);
385 struct mcs7830_data *data = (struct mcs7830_data *)&dev->data; 434 struct mcs7830_data *data = mcs7830_get_data(dev);
435
436 memset(data->multi_filter, 0, sizeof data->multi_filter);
386 437
387 data->config = HIF_REG_CONFIG_TXENABLE; 438 data->config = HIF_REG_CONFIG_TXENABLE;
388 439
@@ -390,36 +441,64 @@ static void mcs7830_set_multicast(struct net_device *net)
390 data->config |= HIF_REG_CONFIG_ALLMULTICAST; 441 data->config |= HIF_REG_CONFIG_ALLMULTICAST;
391 442
392 if (net->flags & IFF_PROMISC) { 443 if (net->flags & IFF_PROMISC) {
393 data->config |= HIF_REG_CONFIG_PROMISCIOUS; 444 data->config |= HIF_REG_CONFIG_PROMISCUOUS;
394 } else if (net->flags & IFF_ALLMULTI || 445 } else if (net->flags & IFF_ALLMULTI ||
395 net->mc_count > MCS7830_MAX_MCAST) { 446 netdev_mc_count(net) > MCS7830_MAX_MCAST) {
396 data->config |= HIF_REG_CONFIG_ALLMULTICAST; 447 data->config |= HIF_REG_CONFIG_ALLMULTICAST;
397 } else if (net->mc_count == 0) { 448 } else if (netdev_mc_empty(net)) {
398 /* just broadcast and directed */ 449 /* just broadcast and directed */
399 } else { 450 } else {
400 /* We use the 20 byte dev->data 451 /* We use the 20 byte dev->data
401 * for our 8 byte filter buffer 452 * for our 8 byte filter buffer
402 * to avoid allocating memory that 453 * to avoid allocating memory that
403 * is tricky to free later */ 454 * is tricky to free later */
404 struct dev_mc_list *mc_list = net->mc_list; 455 struct dev_mc_list *mc_list;
405 u32 crc_bits; 456 u32 crc_bits;
406 int i;
407
408 memset(data->multi_filter, 0, sizeof data->multi_filter);
409 457
410 /* Build the multicast hash filter. */ 458 /* Build the multicast hash filter. */
411 for (i = 0; i < net->mc_count; i++) { 459 netdev_for_each_mc_addr(mc_list, net) {
412 crc_bits = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26; 460 crc_bits = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
413 data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7); 461 data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7);
414 mc_list = mc_list->next;
415 } 462 }
463 }
464}
416 465
417 mcs7830_set_reg_async(dev, HIF_REG_MULTICAST_HASH, 466static int mcs7830_apply_base_config(struct usbnet *dev)
418 sizeof data->multi_filter, 467{
419 data->multi_filter); 468 int ret;
469
470 /* re-configure known MAC (suspend case etc.) */
471 ret = mcs7830_hif_set_mac_address(dev, dev->net->dev_addr);
472 if (ret) {
473 dev_info(&dev->udev->dev, "Cannot set MAC address\n");
474 goto out;
420 } 475 }
421 476
422 mcs7830_set_reg_async(dev, HIF_REG_CONFIG, 1, &data->config); 477 /* Set up PHY */
478 ret = mcs7830_set_autoneg(dev, 0);
479 if (ret) {
480 dev_info(&dev->udev->dev, "Cannot set autoneg\n");
481 goto out;
482 }
483
484 mcs7830_hif_update_multicast_hash(dev);
485 mcs7830_hif_update_config(dev);
486
487 mcs7830_rev_C_fixup(dev);
488 ret = 0;
489out:
490 return ret;
491}
492
493/* credits go to asix_set_multicast */
494static void mcs7830_set_multicast(struct net_device *net)
495{
496 struct usbnet *dev = netdev_priv(net);
497
498 mcs7830_data_set_multicast(net);
499
500 mcs7830_hif_update_multicast_hash(dev);
501 mcs7830_hif_update_config(dev);
423} 502}
424 503
425static int mcs7830_get_regs_len(struct net_device *net) 504static int mcs7830_get_regs_len(struct net_device *net)
@@ -463,29 +542,6 @@ static const struct ethtool_ops mcs7830_ethtool_ops = {
463 .nway_reset = usbnet_nway_reset, 542 .nway_reset = usbnet_nway_reset,
464}; 543};
465 544
466static int mcs7830_set_mac_address(struct net_device *netdev, void *p)
467{
468 int ret;
469 struct usbnet *dev = netdev_priv(netdev);
470 struct sockaddr *addr = p;
471
472 if (netif_running(netdev))
473 return -EBUSY;
474
475 if (!is_valid_ether_addr(addr->sa_data))
476 return -EINVAL;
477
478 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
479
480 ret = mcs7830_set_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN,
481 netdev->dev_addr);
482
483 if (ret < 0)
484 return ret;
485
486 return 0;
487}
488
489static const struct net_device_ops mcs7830_netdev_ops = { 545static const struct net_device_ops mcs7830_netdev_ops = {
490 .ndo_open = usbnet_open, 546 .ndo_open = usbnet_open,
491 .ndo_stop = usbnet_stop, 547 .ndo_stop = usbnet_stop,
@@ -495,21 +551,32 @@ static const struct net_device_ops mcs7830_netdev_ops = {
495 .ndo_validate_addr = eth_validate_addr, 551 .ndo_validate_addr = eth_validate_addr,
496 .ndo_do_ioctl = mcs7830_ioctl, 552 .ndo_do_ioctl = mcs7830_ioctl,
497 .ndo_set_multicast_list = mcs7830_set_multicast, 553 .ndo_set_multicast_list = mcs7830_set_multicast,
498 .ndo_set_mac_address = mcs7830_set_mac_address, 554 .ndo_set_mac_address = mcs7830_set_mac_address,
499}; 555};
500 556
501static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) 557static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev)
502{ 558{
503 struct net_device *net = dev->net; 559 struct net_device *net = dev->net;
504 int ret; 560 int ret;
561 int retry;
505 562
506 ret = mcs7830_init_dev(dev); 563 /* Initial startup: Gather MAC address setting from EEPROM */
564 ret = -EINVAL;
565 for (retry = 0; retry < 5 && ret; retry++)
566 ret = mcs7830_hif_get_mac_address(dev, net->dev_addr);
567 if (ret) {
568 dev_warn(&dev->udev->dev, "Cannot read MAC address\n");
569 goto out;
570 }
571
572 mcs7830_data_set_multicast(net);
573
574 ret = mcs7830_apply_base_config(dev);
507 if (ret) 575 if (ret)
508 goto out; 576 goto out;
509 577
510 net->ethtool_ops = &mcs7830_ethtool_ops; 578 net->ethtool_ops = &mcs7830_ethtool_ops;
511 net->netdev_ops = &mcs7830_netdev_ops; 579 net->netdev_ops = &mcs7830_netdev_ops;
512 mcs7830_set_multicast(net);
513 580
514 /* reserve space for the status byte on rx */ 581 /* reserve space for the status byte on rx */
515 dev->rx_urb_size = ETH_FRAME_LEN + 1; 582 dev->rx_urb_size = ETH_FRAME_LEN + 1;
@@ -526,7 +593,7 @@ out:
526 return ret; 593 return ret;
527} 594}
528 595
529/* The chip always appends a status bytes that we need to strip */ 596/* The chip always appends a status byte that we need to strip */
530static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb) 597static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
531{ 598{
532 u8 status; 599 u8 status;
@@ -539,9 +606,23 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
539 skb_trim(skb, skb->len - 1); 606 skb_trim(skb, skb->len - 1);
540 status = skb->data[skb->len]; 607 status = skb->data[skb->len];
541 608
542 if (status != 0x20) 609 if (status != MCS7830_RX_FRAME_CORRECT) {
543 dev_dbg(&dev->udev->dev, "rx fixup status %x\n", status); 610 dev_dbg(&dev->udev->dev, "rx fixup status %x\n", status);
544 611
612 /* hmm, perhaps usbnet.c already sees a globally visible
613 frame error and increments rx_errors on its own already? */
614 dev->net->stats.rx_errors++;
615
616 if (status & (MCS7830_RX_SHORT_FRAME
617 |MCS7830_RX_LENGTH_ERROR
618 |MCS7830_RX_LARGE_FRAME))
619 dev->net->stats.rx_length_errors++;
620 if (status & MCS7830_RX_ALIGNMENT_ERROR)
621 dev->net->stats.rx_frame_errors++;
622 if (status & MCS7830_RX_CRC_ERROR)
623 dev->net->stats.rx_crc_errors++;
624 }
625
545 return skb->len > 0; 626 return skb->len > 0;
546} 627}
547 628
@@ -580,6 +661,20 @@ static const struct usb_device_id products[] = {
580}; 661};
581MODULE_DEVICE_TABLE(usb, products); 662MODULE_DEVICE_TABLE(usb, products);
582 663
664static int mcs7830_reset_resume (struct usb_interface *intf)
665{
666 /* YES, this function is successful enough that ethtool -d
667 does show same output pre-/post-suspend */
668
669 struct usbnet *dev = usb_get_intfdata(intf);
670
671 mcs7830_apply_base_config(dev);
672
673 usbnet_resume(intf);
674
675 return 0;
676}
677
583static struct usb_driver mcs7830_driver = { 678static struct usb_driver mcs7830_driver = {
584 .name = driver_name, 679 .name = driver_name,
585 .id_table = products, 680 .id_table = products,
@@ -587,6 +682,7 @@ static struct usb_driver mcs7830_driver = {
587 .disconnect = usbnet_disconnect, 682 .disconnect = usbnet_disconnect,
588 .suspend = usbnet_suspend, 683 .suspend = usbnet_suspend,
589 .resume = usbnet_resume, 684 .resume = usbnet_resume,
685 .reset_resume = mcs7830_reset_resume,
590}; 686};
591 687
592static int __init mcs7830_init(void) 688static int __init mcs7830_init(void)
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
index aeb1ab03a9ee..bdcad45954a3 100644
--- a/drivers/net/usb/net1080.c
+++ b/drivers/net/usb/net1080.c
@@ -203,25 +203,23 @@ static void nc_dump_registers(struct usbnet *dev)
203 203
204static inline void nc_dump_usbctl(struct usbnet *dev, u16 usbctl) 204static inline void nc_dump_usbctl(struct usbnet *dev, u16 usbctl)
205{ 205{
206 if (!netif_msg_link(dev)) 206 netif_dbg(dev, link, dev->net,
207 return; 207 "net1080 %s-%s usbctl 0x%x:%s%s%s%s%s; this%s%s; other%s%s; r/o 0x%x\n",
208 devdbg(dev, "net1080 %s-%s usbctl 0x%x:%s%s%s%s%s;" 208 dev->udev->bus->bus_name, dev->udev->devpath,
209 " this%s%s;" 209 usbctl,
210 " other%s%s; r/o 0x%x", 210 (usbctl & USBCTL_ENABLE_LANG) ? " lang" : "",
211 dev->udev->bus->bus_name, dev->udev->devpath, 211 (usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "",
212 usbctl, 212 (usbctl & USBCTL_ENABLE_PROD) ? " prod" : "",
213 (usbctl & USBCTL_ENABLE_LANG) ? " lang" : "", 213 (usbctl & USBCTL_ENABLE_SERIAL) ? " serial" : "",
214 (usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "", 214 (usbctl & USBCTL_ENABLE_DEFAULTS) ? " defaults" : "",
215 (usbctl & USBCTL_ENABLE_PROD) ? " prod" : "", 215
216 (usbctl & USBCTL_ENABLE_SERIAL) ? " serial" : "", 216 (usbctl & USBCTL_FLUSH_THIS) ? " FLUSH" : "",
217 (usbctl & USBCTL_ENABLE_DEFAULTS) ? " defaults" : "", 217 (usbctl & USBCTL_DISCONN_THIS) ? " DIS" : "",
218 218
219 (usbctl & USBCTL_FLUSH_OTHER) ? " FLUSH" : "", 219 (usbctl & USBCTL_FLUSH_OTHER) ? " FLUSH" : "",
220 (usbctl & USBCTL_DISCONN_OTHER) ? " DIS" : "", 220 (usbctl & USBCTL_DISCONN_OTHER) ? " DIS" : "",
221 (usbctl & USBCTL_FLUSH_THIS) ? " FLUSH" : "", 221
222 (usbctl & USBCTL_DISCONN_THIS) ? " DIS" : "", 222 usbctl & ~USBCTL_WRITABLE_MASK);
223 usbctl & ~USBCTL_WRITABLE_MASK
224 );
225} 223}
226 224
227/*-------------------------------------------------------------------------*/ 225/*-------------------------------------------------------------------------*/
@@ -248,30 +246,26 @@ static inline void nc_dump_usbctl(struct usbnet *dev, u16 usbctl)
248 246
249static inline void nc_dump_status(struct usbnet *dev, u16 status) 247static inline void nc_dump_status(struct usbnet *dev, u16 status)
250{ 248{
251 if (!netif_msg_link(dev)) 249 netif_dbg(dev, link, dev->net,
252 return; 250 "net1080 %s-%s status 0x%x: this (%c) PKT=%d%s%s%s; other PKT=%d%s%s%s; unspec 0x%x\n",
253 devdbg(dev, "net1080 %s-%s status 0x%x:" 251 dev->udev->bus->bus_name, dev->udev->devpath,
254 " this (%c) PKT=%d%s%s%s;" 252 status,
255 " other PKT=%d%s%s%s; unspec 0x%x", 253
256 dev->udev->bus->bus_name, dev->udev->devpath, 254 // XXX the packet counts don't seem right
257 status, 255 // (1 at reset, not 0); maybe UNSPEC too
258 256
259 // XXX the packet counts don't seem right 257 (status & STATUS_PORT_A) ? 'A' : 'B',
260 // (1 at reset, not 0); maybe UNSPEC too 258 STATUS_PACKETS_THIS(status),
261 259 (status & STATUS_CONN_THIS) ? " CON" : "",
262 (status & STATUS_PORT_A) ? 'A' : 'B', 260 (status & STATUS_SUSPEND_THIS) ? " SUS" : "",
263 STATUS_PACKETS_THIS(status), 261 (status & STATUS_MAILBOX_THIS) ? " MBOX" : "",
264 (status & STATUS_CONN_THIS) ? " CON" : "", 262
265 (status & STATUS_SUSPEND_THIS) ? " SUS" : "", 263 STATUS_PACKETS_OTHER(status),
266 (status & STATUS_MAILBOX_THIS) ? " MBOX" : "", 264 (status & STATUS_CONN_OTHER) ? " CON" : "",
267 265 (status & STATUS_SUSPEND_OTHER) ? " SUS" : "",
268 STATUS_PACKETS_OTHER(status), 266 (status & STATUS_MAILBOX_OTHER) ? " MBOX" : "",
269 (status & STATUS_CONN_OTHER) ? " CON" : "", 267
270 (status & STATUS_SUSPEND_OTHER) ? " SUS" : "", 268 status & STATUS_UNSPEC_MASK);
271 (status & STATUS_MAILBOX_OTHER) ? " MBOX" : "",
272
273 status & STATUS_UNSPEC_MASK
274 );
275} 269}
276 270
277/*-------------------------------------------------------------------------*/ 271/*-------------------------------------------------------------------------*/
@@ -286,10 +280,9 @@ static inline void nc_dump_status(struct usbnet *dev, u16 status)
286 280
287static inline void nc_dump_ttl(struct usbnet *dev, u16 ttl) 281static inline void nc_dump_ttl(struct usbnet *dev, u16 ttl)
288{ 282{
289 if (netif_msg_link(dev)) 283 netif_dbg(dev, link, dev->net, "net1080 %s-%s ttl 0x%x this = %d, other = %d\n",
290 devdbg(dev, "net1080 %s-%s ttl 0x%x this = %d, other = %d", 284 dev->udev->bus->bus_name, dev->udev->devpath,
291 dev->udev->bus->bus_name, dev->udev->devpath, 285 ttl, TTL_THIS(ttl), TTL_OTHER(ttl));
292 ttl, TTL_THIS(ttl), TTL_OTHER(ttl));
293} 286}
294 287
295/*-------------------------------------------------------------------------*/ 288/*-------------------------------------------------------------------------*/
@@ -334,11 +327,9 @@ static int net1080_reset(struct usbnet *dev)
334 MK_TTL(NC_READ_TTL_MS, TTL_OTHER(ttl)) ); 327 MK_TTL(NC_READ_TTL_MS, TTL_OTHER(ttl)) );
335 dbg("%s: assigned TTL, %d ms", dev->net->name, NC_READ_TTL_MS); 328 dbg("%s: assigned TTL, %d ms", dev->net->name, NC_READ_TTL_MS);
336 329
337 if (netif_msg_link(dev)) 330 netif_info(dev, link, dev->net, "port %c, peer %sconnected\n",
338 devinfo(dev, "port %c, peer %sconnected", 331 (status & STATUS_PORT_A) ? 'A' : 'B',
339 (status & STATUS_PORT_A) ? 'A' : 'B', 332 (status & STATUS_CONN_OTHER) ? "" : "dis");
340 (status & STATUS_CONN_OTHER) ? "" : "dis"
341 );
342 retval = 0; 333 retval = 0;
343 334
344done: 335done:
@@ -415,8 +406,8 @@ static void nc_ensure_sync(struct usbnet *dev)
415 return; 406 return;
416 } 407 }
417 408
418 if (netif_msg_rx_err(dev)) 409 netif_dbg(dev, rx_err, dev->net,
419 devdbg(dev, "flush net1080; too many framing errors"); 410 "flush net1080; too many framing errors\n");
420 dev->frame_errors = 0; 411 dev->frame_errors = 0;
421 } 412 }
422} 413}
@@ -486,8 +477,8 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
486 return 0; 477 return 0;
487 } 478 }
488#if 0 479#if 0
489 devdbg(dev, "frame <rx h %d p %d id %d", header->hdr_len, 480 netdev_dbg(dev->net, "frame <rx h %d p %d id %d\n", header->hdr_len,
490 header->packet_len, header->packet_id); 481 header->packet_len, header->packet_id);
491#endif 482#endif
492 dev->frame_errors = 0; 483 dev->frame_errors = 0;
493 return 1; 484 return 1;
@@ -547,9 +538,9 @@ encapsulate:
547 trailer = (struct nc_trailer *) skb_put(skb, sizeof *trailer); 538 trailer = (struct nc_trailer *) skb_put(skb, sizeof *trailer);
548 put_unaligned(header->packet_id, &trailer->packet_id); 539 put_unaligned(header->packet_id, &trailer->packet_id);
549#if 0 540#if 0
550 devdbg(dev, "frame >tx h %d p %d id %d", 541 netdev_dbg(dev->net, "frame >tx h %d p %d id %d\n",
551 header->hdr_len, header->packet_len, 542 header->hdr_len, header->packet_len,
552 header->packet_id); 543 header->packet_id);
553#endif 544#endif
554 return skb; 545 return skb;
555} 546}
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index ed4a508ef262..41838773b568 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -132,9 +132,10 @@ static void ctrl_callback(struct urb *urb)
132 case -ENOENT: 132 case -ENOENT:
133 break; 133 break;
134 default: 134 default:
135 if (netif_msg_drv(pegasus) && printk_ratelimit()) 135 if (net_ratelimit())
136 dev_dbg(&pegasus->intf->dev, "%s, status %d\n", 136 netif_dbg(pegasus, drv, pegasus->net,
137 __func__, status); 137 "%s, status %d\n", __func__, status);
138 break;
138 } 139 }
139 pegasus->flags &= ~ETH_REGS_CHANGED; 140 pegasus->flags &= ~ETH_REGS_CHANGED;
140 wake_up(&pegasus->ctrl_wait); 141 wake_up(&pegasus->ctrl_wait);
@@ -149,9 +150,8 @@ static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
149 150
150 buffer = kmalloc(size, GFP_KERNEL); 151 buffer = kmalloc(size, GFP_KERNEL);
151 if (!buffer) { 152 if (!buffer) {
152 if (netif_msg_drv(pegasus)) 153 netif_warn(pegasus, drv, pegasus->net,
153 dev_warn(&pegasus->intf->dev, "out of memory in %s\n", 154 "out of memory in %s\n", __func__);
154 __func__);
155 return -ENOMEM; 155 return -ENOMEM;
156 } 156 }
157 add_wait_queue(&pegasus->ctrl_wait, &wait); 157 add_wait_queue(&pegasus->ctrl_wait, &wait);
@@ -181,9 +181,9 @@ static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
181 set_current_state(TASK_RUNNING); 181 set_current_state(TASK_RUNNING);
182 if (ret == -ENODEV) 182 if (ret == -ENODEV)
183 netif_device_detach(pegasus->net); 183 netif_device_detach(pegasus->net);
184 if (netif_msg_drv(pegasus) && printk_ratelimit()) 184 if (net_ratelimit())
185 dev_err(&pegasus->intf->dev, "%s, status %d\n", 185 netif_err(pegasus, drv, pegasus->net,
186 __func__, ret); 186 "%s, status %d\n", __func__, ret);
187 goto out; 187 goto out;
188 } 188 }
189 189
@@ -205,9 +205,8 @@ static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
205 205
206 buffer = kmalloc(size, GFP_KERNEL); 206 buffer = kmalloc(size, GFP_KERNEL);
207 if (!buffer) { 207 if (!buffer) {
208 if (netif_msg_drv(pegasus)) 208 netif_warn(pegasus, drv, pegasus->net,
209 dev_warn(&pegasus->intf->dev, "out of memory in %s\n", 209 "out of memory in %s\n", __func__);
210 __func__);
211 return -ENOMEM; 210 return -ENOMEM;
212 } 211 }
213 memcpy(buffer, data, size); 212 memcpy(buffer, data, size);
@@ -237,9 +236,8 @@ static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
237 if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) { 236 if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
238 if (ret == -ENODEV) 237 if (ret == -ENODEV)
239 netif_device_detach(pegasus->net); 238 netif_device_detach(pegasus->net);
240 if (netif_msg_drv(pegasus)) 239 netif_err(pegasus, drv, pegasus->net,
241 dev_err(&pegasus->intf->dev, "%s, status %d\n", 240 "%s, status %d\n", __func__, ret);
242 __func__, ret);
243 goto out; 241 goto out;
244 } 242 }
245 243
@@ -259,9 +257,8 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
259 257
260 tmp = kmalloc(1, GFP_KERNEL); 258 tmp = kmalloc(1, GFP_KERNEL);
261 if (!tmp) { 259 if (!tmp) {
262 if (netif_msg_drv(pegasus)) 260 netif_warn(pegasus, drv, pegasus->net,
263 dev_warn(&pegasus->intf->dev, "out of memory in %s\n", 261 "out of memory in %s\n", __func__);
264 __func__);
265 return -ENOMEM; 262 return -ENOMEM;
266 } 263 }
267 memcpy(tmp, &data, 1); 264 memcpy(tmp, &data, 1);
@@ -290,9 +287,9 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
290 if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) { 287 if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
291 if (ret == -ENODEV) 288 if (ret == -ENODEV)
292 netif_device_detach(pegasus->net); 289 netif_device_detach(pegasus->net);
293 if (netif_msg_drv(pegasus) && printk_ratelimit()) 290 if (net_ratelimit())
294 dev_err(&pegasus->intf->dev, "%s, status %d\n", 291 netif_err(pegasus, drv, pegasus->net,
295 __func__, ret); 292 "%s, status %d\n", __func__, ret);
296 goto out; 293 goto out;
297 } 294 }
298 295
@@ -323,9 +320,8 @@ static int update_eth_regs_async(pegasus_t * pegasus)
323 if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) { 320 if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
324 if (ret == -ENODEV) 321 if (ret == -ENODEV)
325 netif_device_detach(pegasus->net); 322 netif_device_detach(pegasus->net);
326 if (netif_msg_drv(pegasus)) 323 netif_err(pegasus, drv, pegasus->net,
327 dev_err(&pegasus->intf->dev, "%s, status %d\n", 324 "%s, status %d\n", __func__, ret);
328 __func__, ret);
329 } 325 }
330 326
331 return ret; 327 return ret;
@@ -349,14 +345,16 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
349 if (data[0] & PHY_DONE) 345 if (data[0] & PHY_DONE)
350 break; 346 break;
351 } 347 }
352 if (i < REG_TIMEOUT) { 348
353 ret = get_registers(pegasus, PhyData, 2, &regdi); 349 if (i >= REG_TIMEOUT)
354 *regd = le16_to_cpu(regdi); 350 goto fail;
355 return ret; 351
356 } 352 ret = get_registers(pegasus, PhyData, 2, &regdi);
353 *regd = le16_to_cpu(regdi);
354 return ret;
355
357fail: 356fail:
358 if (netif_msg_drv(pegasus)) 357 netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__);
359 dev_warn(&pegasus->intf->dev, "%s failed\n", __func__);
360 358
361 return ret; 359 return ret;
362} 360}
@@ -388,12 +386,14 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
388 if (data[0] & PHY_DONE) 386 if (data[0] & PHY_DONE)
389 break; 387 break;
390 } 388 }
391 if (i < REG_TIMEOUT) 389
392 return ret; 390 if (i >= REG_TIMEOUT)
391 goto fail;
392
393 return ret;
393 394
394fail: 395fail:
395 if (netif_msg_drv(pegasus)) 396 netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__);
396 dev_warn(&pegasus->intf->dev, "%s failed\n", __func__);
397 return -ETIMEDOUT; 397 return -ETIMEDOUT;
398} 398}
399 399
@@ -422,15 +422,15 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
422 if (ret == -ESHUTDOWN) 422 if (ret == -ESHUTDOWN)
423 goto fail; 423 goto fail;
424 } 424 }
425 if (i < REG_TIMEOUT) { 425 if (i >= REG_TIMEOUT)
426 ret = get_registers(pegasus, EpromData, 2, &retdatai); 426 goto fail;
427 *retdata = le16_to_cpu(retdatai); 427
428 return ret; 428 ret = get_registers(pegasus, EpromData, 2, &retdatai);
429 } 429 *retdata = le16_to_cpu(retdatai);
430 return ret;
430 431
431fail: 432fail:
432 if (netif_msg_drv(pegasus)) 433 netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__);
433 dev_warn(&pegasus->intf->dev, "%s failed\n", __func__);
434 return -ETIMEDOUT; 434 return -ETIMEDOUT;
435} 435}
436 436
@@ -475,11 +475,13 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
475 break; 475 break;
476 } 476 }
477 disable_eprom_write(pegasus); 477 disable_eprom_write(pegasus);
478 if (i < REG_TIMEOUT) 478 if (i >= REG_TIMEOUT)
479 return ret; 479 goto fail;
480
481 return ret;
482
480fail: 483fail:
481 if (netif_msg_drv(pegasus)) 484 netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__);
482 dev_warn(&pegasus->intf->dev, "%s failed\n", __func__);
483 return -ETIMEDOUT; 485 return -ETIMEDOUT;
484} 486}
485#endif /* PEGASUS_WRITE_EEPROM */ 487#endif /* PEGASUS_WRITE_EEPROM */
@@ -642,25 +644,20 @@ static void read_bulk_callback(struct urb *urb)
642 case 0: 644 case 0:
643 break; 645 break;
644 case -ETIME: 646 case -ETIME:
645 if (netif_msg_rx_err(pegasus)) 647 netif_dbg(pegasus, rx_err, net, "reset MAC\n");
646 pr_debug("%s: reset MAC\n", net->name);
647 pegasus->flags &= ~PEGASUS_RX_BUSY; 648 pegasus->flags &= ~PEGASUS_RX_BUSY;
648 break; 649 break;
649 case -EPIPE: /* stall, or disconnect from TT */ 650 case -EPIPE: /* stall, or disconnect from TT */
650 /* FIXME schedule work to clear the halt */ 651 /* FIXME schedule work to clear the halt */
651 if (netif_msg_rx_err(pegasus)) 652 netif_warn(pegasus, rx_err, net, "no rx stall recovery\n");
652 printk(KERN_WARNING "%s: no rx stall recovery\n",
653 net->name);
654 return; 653 return;
655 case -ENOENT: 654 case -ENOENT:
656 case -ECONNRESET: 655 case -ECONNRESET:
657 case -ESHUTDOWN: 656 case -ESHUTDOWN:
658 if (netif_msg_ifdown(pegasus)) 657 netif_dbg(pegasus, ifdown, net, "rx unlink, %d\n", status);
659 pr_debug("%s: rx unlink, %d\n", net->name, status);
660 return; 658 return;
661 default: 659 default:
662 if (netif_msg_rx_err(pegasus)) 660 netif_dbg(pegasus, rx_err, net, "RX status %d\n", status);
663 pr_debug("%s: RX status %d\n", net->name, status);
664 goto goon; 661 goto goon;
665 } 662 }
666 663
@@ -669,9 +666,8 @@ static void read_bulk_callback(struct urb *urb)
669 666
670 rx_status = buf[count - 2]; 667 rx_status = buf[count - 2];
671 if (rx_status & 0x1e) { 668 if (rx_status & 0x1e) {
672 if (netif_msg_rx_err(pegasus)) 669 netif_dbg(pegasus, rx_err, net,
673 pr_debug("%s: RX packet error %x\n", 670 "RX packet error %x\n", rx_status);
674 net->name, rx_status);
675 pegasus->stats.rx_errors++; 671 pegasus->stats.rx_errors++;
676 if (rx_status & 0x06) // long or runt 672 if (rx_status & 0x06) // long or runt
677 pegasus->stats.rx_length_errors++; 673 pegasus->stats.rx_length_errors++;
@@ -758,9 +754,7 @@ static void rx_fixup(unsigned long data)
758 pegasus->rx_skb = pull_skb(pegasus); 754 pegasus->rx_skb = pull_skb(pegasus);
759 } 755 }
760 if (pegasus->rx_skb == NULL) { 756 if (pegasus->rx_skb == NULL) {
761 if (netif_msg_rx_err(pegasus)) 757 netif_warn(pegasus, rx_err, pegasus->net, "low on memory\n");
762 printk(KERN_WARNING "%s: low on memory\n",
763 pegasus->net->name);
764 tasklet_schedule(&pegasus->rx_tl); 758 tasklet_schedule(&pegasus->rx_tl);
765 goto done; 759 goto done;
766 } 760 }
@@ -800,19 +794,15 @@ static void write_bulk_callback(struct urb *urb)
800 case -EPIPE: 794 case -EPIPE:
801 /* FIXME schedule_work() to clear the tx halt */ 795 /* FIXME schedule_work() to clear the tx halt */
802 netif_stop_queue(net); 796 netif_stop_queue(net);
803 if (netif_msg_tx_err(pegasus)) 797 netif_warn(pegasus, tx_err, net, "no tx stall recovery\n");
804 printk(KERN_WARNING "%s: no tx stall recovery\n",
805 net->name);
806 return; 798 return;
807 case -ENOENT: 799 case -ENOENT:
808 case -ECONNRESET: 800 case -ECONNRESET:
809 case -ESHUTDOWN: 801 case -ESHUTDOWN:
810 if (netif_msg_ifdown(pegasus)) 802 netif_dbg(pegasus, ifdown, net, "tx unlink, %d\n", status);
811 pr_debug("%s: tx unlink, %d\n", net->name, status);
812 return; 803 return;
813 default: 804 default:
814 if (netif_msg_tx_err(pegasus)) 805 netif_info(pegasus, tx_err, net, "TX status %d\n", status);
815 pr_info("%s: TX status %d\n", net->name, status);
816 /* FALL THROUGH */ 806 /* FALL THROUGH */
817 case 0: 807 case 0:
818 break; 808 break;
@@ -843,9 +833,7 @@ static void intr_callback(struct urb *urb)
843 /* some Pegasus-I products report LOTS of data 833 /* some Pegasus-I products report LOTS of data
844 * toggle errors... avoid log spamming 834 * toggle errors... avoid log spamming
845 */ 835 */
846 if (netif_msg_timer(pegasus)) 836 netif_dbg(pegasus, timer, net, "intr status %d\n", status);
847 pr_debug("%s: intr status %d\n", net->name,
848 status);
849 } 837 }
850 838
851 if (urb->actual_length >= 6) { 839 if (urb->actual_length >= 6) {
@@ -875,16 +863,15 @@ static void intr_callback(struct urb *urb)
875 res = usb_submit_urb(urb, GFP_ATOMIC); 863 res = usb_submit_urb(urb, GFP_ATOMIC);
876 if (res == -ENODEV) 864 if (res == -ENODEV)
877 netif_device_detach(pegasus->net); 865 netif_device_detach(pegasus->net);
878 if (res && netif_msg_timer(pegasus)) 866 if (res)
879 printk(KERN_ERR "%s: can't resubmit interrupt urb, %d\n", 867 netif_err(pegasus, timer, net,
880 net->name, res); 868 "can't resubmit interrupt urb, %d\n", res);
881} 869}
882 870
883static void pegasus_tx_timeout(struct net_device *net) 871static void pegasus_tx_timeout(struct net_device *net)
884{ 872{
885 pegasus_t *pegasus = netdev_priv(net); 873 pegasus_t *pegasus = netdev_priv(net);
886 if (netif_msg_timer(pegasus)) 874 netif_warn(pegasus, timer, net, "tx timeout\n");
887 printk(KERN_WARNING "%s: tx timeout\n", net->name);
888 usb_unlink_urb(pegasus->tx_urb); 875 usb_unlink_urb(pegasus->tx_urb);
889 pegasus->stats.tx_errors++; 876 pegasus->stats.tx_errors++;
890} 877}
@@ -906,9 +893,7 @@ static netdev_tx_t pegasus_start_xmit(struct sk_buff *skb,
906 pegasus->tx_buff, count, 893 pegasus->tx_buff, count,
907 write_bulk_callback, pegasus); 894 write_bulk_callback, pegasus);
908 if ((res = usb_submit_urb(pegasus->tx_urb, GFP_ATOMIC))) { 895 if ((res = usb_submit_urb(pegasus->tx_urb, GFP_ATOMIC))) {
909 if (netif_msg_tx_err(pegasus)) 896 netif_warn(pegasus, tx_err, net, "fail tx, %d\n", res);
910 printk(KERN_WARNING "%s: fail tx, %d\n",
911 net->name, res);
912 switch (res) { 897 switch (res) {
913 case -EPIPE: /* stall, or disconnect from TT */ 898 case -EPIPE: /* stall, or disconnect from TT */
914 /* cleanup should already have been scheduled */ 899 /* cleanup should already have been scheduled */
@@ -952,10 +937,9 @@ static inline void get_interrupt_interval(pegasus_t * pegasus)
952 interval = data >> 8; 937 interval = data >> 8;
953 if (pegasus->usb->speed != USB_SPEED_HIGH) { 938 if (pegasus->usb->speed != USB_SPEED_HIGH) {
954 if (interval < 0x80) { 939 if (interval < 0x80) {
955 if (netif_msg_timer(pegasus)) 940 netif_info(pegasus, timer, pegasus->net,
956 dev_info(&pegasus->intf->dev, "intr interval " 941 "intr interval changed from %ums to %ums\n",
957 "changed from %ums to %ums\n", 942 interval, 0x80);
958 interval, 0x80);
959 interval = 0x80; 943 interval = 0x80;
960 data = (data & 0x00FF) | ((u16)interval << 8); 944 data = (data & 0x00FF) | ((u16)interval << 8);
961#ifdef PEGASUS_WRITE_EEPROM 945#ifdef PEGASUS_WRITE_EEPROM
@@ -1046,8 +1030,7 @@ static int pegasus_open(struct net_device *net)
1046 if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) { 1030 if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) {
1047 if (res == -ENODEV) 1031 if (res == -ENODEV)
1048 netif_device_detach(pegasus->net); 1032 netif_device_detach(pegasus->net);
1049 if (netif_msg_ifup(pegasus)) 1033 netif_dbg(pegasus, ifup, net, "failed rx_urb, %d\n", res);
1050 pr_debug("%s: failed rx_urb, %d", net->name, res);
1051 goto exit; 1034 goto exit;
1052 } 1035 }
1053 1036
@@ -1058,15 +1041,13 @@ static int pegasus_open(struct net_device *net)
1058 if ((res = usb_submit_urb(pegasus->intr_urb, GFP_KERNEL))) { 1041 if ((res = usb_submit_urb(pegasus->intr_urb, GFP_KERNEL))) {
1059 if (res == -ENODEV) 1042 if (res == -ENODEV)
1060 netif_device_detach(pegasus->net); 1043 netif_device_detach(pegasus->net);
1061 if (netif_msg_ifup(pegasus)) 1044 netif_dbg(pegasus, ifup, net, "failed intr_urb, %d\n", res);
1062 pr_debug("%s: failed intr_urb, %d\n", net->name, res);
1063 usb_kill_urb(pegasus->rx_urb); 1045 usb_kill_urb(pegasus->rx_urb);
1064 goto exit; 1046 goto exit;
1065 } 1047 }
1066 if ((res = enable_net_traffic(net, pegasus->usb))) { 1048 if ((res = enable_net_traffic(net, pegasus->usb))) {
1067 if (netif_msg_ifup(pegasus)) 1049 netif_dbg(pegasus, ifup, net,
1068 pr_debug("%s: can't enable_net_traffic() - %d\n", 1050 "can't enable_net_traffic() - %d\n", res);
1069 net->name, res);
1070 res = -EIO; 1051 res = -EIO;
1071 usb_kill_urb(pegasus->rx_urb); 1052 usb_kill_urb(pegasus->rx_urb);
1072 usb_kill_urb(pegasus->intr_urb); 1053 usb_kill_urb(pegasus->intr_urb);
@@ -1075,8 +1056,7 @@ static int pegasus_open(struct net_device *net)
1075 } 1056 }
1076 set_carrier(net); 1057 set_carrier(net);
1077 netif_start_queue(net); 1058 netif_start_queue(net);
1078 if (netif_msg_ifup(pegasus)) 1059 netif_dbg(pegasus, ifup, net, "open\n");
1079 pr_debug("%s: open\n", net->name);
1080 res = 0; 1060 res = 0;
1081exit: 1061exit:
1082 return res; 1062 return res;
@@ -1230,13 +1210,11 @@ static void pegasus_set_multicast(struct net_device *net)
1230 1210
1231 if (net->flags & IFF_PROMISC) { 1211 if (net->flags & IFF_PROMISC) {
1232 pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS; 1212 pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS;
1233 if (netif_msg_link(pegasus)) 1213 netif_info(pegasus, link, net, "Promiscuous mode enabled\n");
1234 pr_info("%s: Promiscuous mode enabled.\n", net->name); 1214 } else if (!netdev_mc_empty(net) || (net->flags & IFF_ALLMULTI)) {
1235 } else if (net->mc_count || (net->flags & IFF_ALLMULTI)) {
1236 pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST; 1215 pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST;
1237 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; 1216 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
1238 if (netif_msg_link(pegasus)) 1217 netif_dbg(pegasus, link, net, "set allmulti\n");
1239 pr_debug("%s: set allmulti\n", net->name);
1240 } else { 1218 } else {
1241 pegasus->eth_regs[EthCtrl0] &= ~RX_MULTICAST; 1219 pegasus->eth_regs[EthCtrl0] &= ~RX_MULTICAST;
1242 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; 1220 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 490fa8f55424..4ce331fb1e1e 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -57,8 +57,8 @@
57 */ 57 */
58void rndis_status(struct usbnet *dev, struct urb *urb) 58void rndis_status(struct usbnet *dev, struct urb *urb)
59{ 59{
60 devdbg(dev, "rndis status urb, len %d stat %d", 60 netdev_dbg(dev->net, "rndis status urb, len %d stat %d\n",
61 urb->actual_length, urb->status); 61 urb->actual_length, urb->status);
62 // FIXME for keepalives, respond immediately (asynchronously) 62 // FIXME for keepalives, respond immediately (asynchronously)
63 // if not an RNDIS status, do like cdc_status(dev,urb) does 63 // if not an RNDIS status, do like cdc_status(dev,urb) does
64} 64}
@@ -335,8 +335,8 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
335 335
336 dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1); 336 dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1);
337 if (dev->maxpacket == 0) { 337 if (dev->maxpacket == 0) {
338 if (netif_msg_probe(dev)) 338 netif_dbg(dev, probe, dev->net,
339 dev_dbg(&intf->dev, "dev->maxpacket can't be 0\n"); 339 "dev->maxpacket can't be 0\n");
340 retval = -EINVAL; 340 retval = -EINVAL;
341 goto fail_and_release; 341 goto fail_and_release;
342 } 342 }
@@ -394,17 +394,15 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
394 } 394 }
395 if ((flags & FLAG_RNDIS_PHYM_WIRELESS) && 395 if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
396 *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { 396 *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
397 if (netif_msg_probe(dev)) 397 netif_dbg(dev, probe, dev->net,
398 dev_dbg(&intf->dev, "driver requires wireless " 398 "driver requires wireless physical medium, but device is not\n");
399 "physical medium, but device is not.\n");
400 retval = -ENODEV; 399 retval = -ENODEV;
401 goto halt_fail_and_release; 400 goto halt_fail_and_release;
402 } 401 }
403 if ((flags & FLAG_RNDIS_PHYM_NOT_WIRELESS) && 402 if ((flags & FLAG_RNDIS_PHYM_NOT_WIRELESS) &&
404 *phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { 403 *phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
405 if (netif_msg_probe(dev)) 404 netif_dbg(dev, probe, dev->net,
406 dev_dbg(&intf->dev, "driver requires non-wireless " 405 "driver requires non-wireless physical medium, but device is wireless.\n");
407 "physical medium, but device is wireless.\n");
408 retval = -ENODEV; 406 retval = -ENODEV;
409 goto halt_fail_and_release; 407 goto halt_fail_and_release;
410 } 408 }
@@ -497,9 +495,9 @@ int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
497 skb->len < msg_len || 495 skb->len < msg_len ||
498 (data_offset + data_len + 8) > msg_len)) { 496 (data_offset + data_len + 8) > msg_len)) {
499 dev->net->stats.rx_frame_errors++; 497 dev->net->stats.rx_frame_errors++;
500 devdbg(dev, "bad rndis message %d/%d/%d/%d, len %d", 498 netdev_dbg(dev->net, "bad rndis message %d/%d/%d/%d, len %d\n",
501 le32_to_cpu(hdr->msg_type), 499 le32_to_cpu(hdr->msg_type),
502 msg_len, data_offset, data_len, skb->len); 500 msg_len, data_offset, data_len, skb->len);
503 return 0; 501 return 0;
504 } 502 }
505 skb_pull(skb, 8 + data_offset); 503 skb_pull(skb, 8 + data_offset);
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index fd19db0d2504..e85c89c6706d 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -313,20 +313,17 @@ static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
313{ 313{
314 struct sockaddr *addr = p; 314 struct sockaddr *addr = p;
315 rtl8150_t *dev = netdev_priv(netdev); 315 rtl8150_t *dev = netdev_priv(netdev);
316 int i;
317 316
318 if (netif_running(netdev)) 317 if (netif_running(netdev))
319 return -EBUSY; 318 return -EBUSY;
320 319
321 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 320 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
322 dbg("%s: Setting MAC address to ", netdev->name); 321 dbg("%s: Setting MAC address to %pM\n", netdev->name, netdev->dev_addr);
323 for (i = 0; i < 5; i++)
324 dbg("%02X:", netdev->dev_addr[i]);
325 dbg("%02X\n", netdev->dev_addr[i]);
326 /* Set the IDR registers. */ 322 /* Set the IDR registers. */
327 set_registers(dev, IDR, netdev->addr_len, netdev->dev_addr); 323 set_registers(dev, IDR, netdev->addr_len, netdev->dev_addr);
328#ifdef EEPROM_WRITE 324#ifdef EEPROM_WRITE
329 { 325 {
326 int i;
330 u8 cr; 327 u8 cr;
331 /* Get the CR contents. */ 328 /* Get the CR contents. */
332 get_registers(dev, CR, 1, &cr); 329 get_registers(dev, CR, 1, &cr);
@@ -714,7 +711,7 @@ static void rtl8150_set_multicast(struct net_device *netdev)
714 if (netdev->flags & IFF_PROMISC) { 711 if (netdev->flags & IFF_PROMISC) {
715 dev->rx_creg |= cpu_to_le16(0x0001); 712 dev->rx_creg |= cpu_to_le16(0x0001);
716 dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name); 713 dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name);
717 } else if (netdev->mc_count || 714 } else if (!netdev_mc_empty(netdev) ||
718 (netdev->flags & IFF_ALLMULTI)) { 715 (netdev->flags & IFF_ALLMULTI)) {
719 dev->rx_creg &= cpu_to_le16(0xfffe); 716 dev->rx_creg &= cpu_to_le16(0xfffe);
720 dev->rx_creg |= cpu_to_le16(0x0002); 717 dev->rx_creg |= cpu_to_le16(0x0002);
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 0c3c738d7419..df9179a1c93b 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -78,7 +78,7 @@ static int smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data)
78 00, index, buf, 4, USB_CTRL_GET_TIMEOUT); 78 00, index, buf, 4, USB_CTRL_GET_TIMEOUT);
79 79
80 if (unlikely(ret < 0)) 80 if (unlikely(ret < 0))
81 devwarn(dev, "Failed to read register index 0x%08x", index); 81 netdev_warn(dev->net, "Failed to read register index 0x%08x\n", index);
82 82
83 le32_to_cpus(buf); 83 le32_to_cpus(buf);
84 *data = *buf; 84 *data = *buf;
@@ -106,7 +106,7 @@ static int smsc95xx_write_reg(struct usbnet *dev, u32 index, u32 data)
106 00, index, buf, 4, USB_CTRL_SET_TIMEOUT); 106 00, index, buf, 4, USB_CTRL_SET_TIMEOUT);
107 107
108 if (unlikely(ret < 0)) 108 if (unlikely(ret < 0))
109 devwarn(dev, "Failed to write register index 0x%08x", index); 109 netdev_warn(dev->net, "Failed to write register index 0x%08x\n", index);
110 110
111 kfree(buf); 111 kfree(buf);
112 112
@@ -138,7 +138,7 @@ static int smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx)
138 138
139 /* confirm MII not busy */ 139 /* confirm MII not busy */
140 if (smsc95xx_phy_wait_not_busy(dev)) { 140 if (smsc95xx_phy_wait_not_busy(dev)) {
141 devwarn(dev, "MII is busy in smsc95xx_mdio_read"); 141 netdev_warn(dev->net, "MII is busy in smsc95xx_mdio_read\n");
142 mutex_unlock(&dev->phy_mutex); 142 mutex_unlock(&dev->phy_mutex);
143 return -EIO; 143 return -EIO;
144 } 144 }
@@ -150,7 +150,7 @@ static int smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx)
150 smsc95xx_write_reg(dev, MII_ADDR, addr); 150 smsc95xx_write_reg(dev, MII_ADDR, addr);
151 151
152 if (smsc95xx_phy_wait_not_busy(dev)) { 152 if (smsc95xx_phy_wait_not_busy(dev)) {
153 devwarn(dev, "Timed out reading MII reg %02X", idx); 153 netdev_warn(dev->net, "Timed out reading MII reg %02X\n", idx);
154 mutex_unlock(&dev->phy_mutex); 154 mutex_unlock(&dev->phy_mutex);
155 return -EIO; 155 return -EIO;
156 } 156 }
@@ -172,7 +172,7 @@ static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx,
172 172
173 /* confirm MII not busy */ 173 /* confirm MII not busy */
174 if (smsc95xx_phy_wait_not_busy(dev)) { 174 if (smsc95xx_phy_wait_not_busy(dev)) {
175 devwarn(dev, "MII is busy in smsc95xx_mdio_write"); 175 netdev_warn(dev->net, "MII is busy in smsc95xx_mdio_write\n");
176 mutex_unlock(&dev->phy_mutex); 176 mutex_unlock(&dev->phy_mutex);
177 return; 177 return;
178 } 178 }
@@ -187,7 +187,7 @@ static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx,
187 smsc95xx_write_reg(dev, MII_ADDR, addr); 187 smsc95xx_write_reg(dev, MII_ADDR, addr);
188 188
189 if (smsc95xx_phy_wait_not_busy(dev)) 189 if (smsc95xx_phy_wait_not_busy(dev))
190 devwarn(dev, "Timed out writing MII reg %02X", idx); 190 netdev_warn(dev->net, "Timed out writing MII reg %02X\n", idx);
191 191
192 mutex_unlock(&dev->phy_mutex); 192 mutex_unlock(&dev->phy_mutex);
193} 193}
@@ -205,7 +205,7 @@ static int smsc95xx_wait_eeprom(struct usbnet *dev)
205 } while (!time_after(jiffies, start_time + HZ)); 205 } while (!time_after(jiffies, start_time + HZ));
206 206
207 if (val & (E2P_CMD_TIMEOUT_ | E2P_CMD_BUSY_)) { 207 if (val & (E2P_CMD_TIMEOUT_ | E2P_CMD_BUSY_)) {
208 devwarn(dev, "EEPROM read operation timeout"); 208 netdev_warn(dev->net, "EEPROM read operation timeout\n");
209 return -EIO; 209 return -EIO;
210 } 210 }
211 211
@@ -226,7 +226,7 @@ static int smsc95xx_eeprom_confirm_not_busy(struct usbnet *dev)
226 udelay(40); 226 udelay(40);
227 } while (!time_after(jiffies, start_time + HZ)); 227 } while (!time_after(jiffies, start_time + HZ));
228 228
229 devwarn(dev, "EEPROM is busy"); 229 netdev_warn(dev->net, "EEPROM is busy\n");
230 return -EIO; 230 return -EIO;
231} 231}
232 232
@@ -308,7 +308,7 @@ static void smsc95xx_async_cmd_callback(struct urb *urb)
308 int status = urb->status; 308 int status = urb->status;
309 309
310 if (status < 0) 310 if (status < 0)
311 devwarn(dev, "async callback failed with %d", status); 311 netdev_warn(dev->net, "async callback failed with %d\n", status);
312 312
313 kfree(usb_context); 313 kfree(usb_context);
314 usb_free_urb(urb); 314 usb_free_urb(urb);
@@ -323,13 +323,13 @@ static int smsc95xx_write_reg_async(struct usbnet *dev, u16 index, u32 *data)
323 323
324 urb = usb_alloc_urb(0, GFP_ATOMIC); 324 urb = usb_alloc_urb(0, GFP_ATOMIC);
325 if (!urb) { 325 if (!urb) {
326 devwarn(dev, "Error allocating URB"); 326 netdev_warn(dev->net, "Error allocating URB\n");
327 return -ENOMEM; 327 return -ENOMEM;
328 } 328 }
329 329
330 usb_context = kmalloc(sizeof(struct usb_context), GFP_ATOMIC); 330 usb_context = kmalloc(sizeof(struct usb_context), GFP_ATOMIC);
331 if (usb_context == NULL) { 331 if (usb_context == NULL) {
332 devwarn(dev, "Error allocating control msg"); 332 netdev_warn(dev->net, "Error allocating control msg\n");
333 usb_free_urb(urb); 333 usb_free_urb(urb);
334 return -ENOMEM; 334 return -ENOMEM;
335 } 335 }
@@ -348,7 +348,8 @@ static int smsc95xx_write_reg_async(struct usbnet *dev, u16 index, u32 *data)
348 348
349 status = usb_submit_urb(urb, GFP_ATOMIC); 349 status = usb_submit_urb(urb, GFP_ATOMIC);
350 if (status < 0) { 350 if (status < 0) {
351 devwarn(dev, "Error submitting control msg, sts=%d", status); 351 netdev_warn(dev->net, "Error submitting control msg, sts=%d\n",
352 status);
352 kfree(usb_context); 353 kfree(usb_context);
353 usb_free_urb(urb); 354 usb_free_urb(urb);
354 } 355 }
@@ -375,46 +376,32 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
375 spin_lock_irqsave(&pdata->mac_cr_lock, flags); 376 spin_lock_irqsave(&pdata->mac_cr_lock, flags);
376 377
377 if (dev->net->flags & IFF_PROMISC) { 378 if (dev->net->flags & IFF_PROMISC) {
378 if (netif_msg_drv(dev)) 379 netif_dbg(dev, drv, dev->net, "promiscuous mode enabled\n");
379 devdbg(dev, "promiscuous mode enabled");
380 pdata->mac_cr |= MAC_CR_PRMS_; 380 pdata->mac_cr |= MAC_CR_PRMS_;
381 pdata->mac_cr &= ~(MAC_CR_MCPAS_ | MAC_CR_HPFILT_); 381 pdata->mac_cr &= ~(MAC_CR_MCPAS_ | MAC_CR_HPFILT_);
382 } else if (dev->net->flags & IFF_ALLMULTI) { 382 } else if (dev->net->flags & IFF_ALLMULTI) {
383 if (netif_msg_drv(dev)) 383 netif_dbg(dev, drv, dev->net, "receive all multicast enabled\n");
384 devdbg(dev, "receive all multicast enabled");
385 pdata->mac_cr |= MAC_CR_MCPAS_; 384 pdata->mac_cr |= MAC_CR_MCPAS_;
386 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_); 385 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_);
387 } else if (dev->net->mc_count > 0) { 386 } else if (!netdev_mc_empty(dev->net)) {
388 struct dev_mc_list *mc_list = dev->net->mc_list; 387 struct dev_mc_list *mc_list;
389 int count = 0;
390 388
391 pdata->mac_cr |= MAC_CR_HPFILT_; 389 pdata->mac_cr |= MAC_CR_HPFILT_;
392 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_); 390 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_);
393 391
394 while (mc_list) { 392 netdev_for_each_mc_addr(mc_list, netdev) {
395 count++; 393 u32 bitnum = smsc95xx_hash(mc_list->dmi_addr);
396 if (mc_list->dmi_addrlen == ETH_ALEN) { 394 u32 mask = 0x01 << (bitnum & 0x1F);
397 u32 bitnum = smsc95xx_hash(mc_list->dmi_addr); 395 if (bitnum & 0x20)
398 u32 mask = 0x01 << (bitnum & 0x1F); 396 hash_hi |= mask;
399 if (bitnum & 0x20) 397 else
400 hash_hi |= mask; 398 hash_lo |= mask;
401 else
402 hash_lo |= mask;
403 } else {
404 devwarn(dev, "dmi_addrlen != 6");
405 }
406 mc_list = mc_list->next;
407 } 399 }
408 400
409 if (count != ((u32)dev->net->mc_count)) 401 netif_dbg(dev, drv, dev->net, "HASHH=0x%08X, HASHL=0x%08X\n",
410 devwarn(dev, "mc_count != dev->mc_count"); 402 hash_hi, hash_lo);
411
412 if (netif_msg_drv(dev))
413 devdbg(dev, "HASHH=0x%08X, HASHL=0x%08X", hash_hi,
414 hash_lo);
415 } else { 403 } else {
416 if (netif_msg_drv(dev)) 404 netif_dbg(dev, drv, dev->net, "receive own packets only\n");
417 devdbg(dev, "receive own packets only");
418 pdata->mac_cr &= 405 pdata->mac_cr &=
419 ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_ | MAC_CR_HPFILT_); 406 ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_ | MAC_CR_HPFILT_);
420 } 407 }
@@ -434,7 +421,7 @@ static void smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
434 421
435 int ret = smsc95xx_read_reg(dev, AFC_CFG, &afc_cfg); 422 int ret = smsc95xx_read_reg(dev, AFC_CFG, &afc_cfg);
436 if (ret < 0) { 423 if (ret < 0) {
437 devwarn(dev, "error reading AFC_CFG"); 424 netdev_warn(dev->net, "error reading AFC_CFG\n");
438 return; 425 return;
439 } 426 }
440 427
@@ -451,13 +438,11 @@ static void smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
451 else 438 else
452 afc_cfg &= ~0xF; 439 afc_cfg &= ~0xF;
453 440
454 if (netif_msg_link(dev)) 441 netif_dbg(dev, link, dev->net, "rx pause %s, tx pause %s\n",
455 devdbg(dev, "rx pause %s, tx pause %s", 442 cap & FLOW_CTRL_RX ? "enabled" : "disabled",
456 (cap & FLOW_CTRL_RX ? "enabled" : "disabled"), 443 cap & FLOW_CTRL_TX ? "enabled" : "disabled");
457 (cap & FLOW_CTRL_TX ? "enabled" : "disabled"));
458 } else { 444 } else {
459 if (netif_msg_link(dev)) 445 netif_dbg(dev, link, dev->net, "half duplex\n");
460 devdbg(dev, "half duplex");
461 flow = 0; 446 flow = 0;
462 afc_cfg |= 0xF; 447 afc_cfg |= 0xF;
463 } 448 }
@@ -485,9 +470,8 @@ static int smsc95xx_link_reset(struct usbnet *dev)
485 lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE); 470 lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
486 rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA); 471 rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA);
487 472
488 if (netif_msg_link(dev)) 473 netif_dbg(dev, link, dev->net, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x\n",
489 devdbg(dev, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x", 474 ecmd.speed, ecmd.duplex, lcladv, rmtadv);
490 ecmd.speed, ecmd.duplex, lcladv, rmtadv);
491 475
492 spin_lock_irqsave(&pdata->mac_cr_lock, flags); 476 spin_lock_irqsave(&pdata->mac_cr_lock, flags);
493 if (ecmd.duplex != DUPLEX_FULL) { 477 if (ecmd.duplex != DUPLEX_FULL) {
@@ -511,20 +495,21 @@ static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
511 u32 intdata; 495 u32 intdata;
512 496
513 if (urb->actual_length != 4) { 497 if (urb->actual_length != 4) {
514 devwarn(dev, "unexpected urb length %d", urb->actual_length); 498 netdev_warn(dev->net, "unexpected urb length %d\n",
499 urb->actual_length);
515 return; 500 return;
516 } 501 }
517 502
518 memcpy(&intdata, urb->transfer_buffer, 4); 503 memcpy(&intdata, urb->transfer_buffer, 4);
519 le32_to_cpus(&intdata); 504 le32_to_cpus(&intdata);
520 505
521 if (netif_msg_link(dev)) 506 netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata);
522 devdbg(dev, "intdata: 0x%08X", intdata);
523 507
524 if (intdata & INT_ENP_PHY_INT_) 508 if (intdata & INT_ENP_PHY_INT_)
525 usbnet_defer_kevent(dev, EVENT_LINK_RESET); 509 usbnet_defer_kevent(dev, EVENT_LINK_RESET);
526 else 510 else
527 devwarn(dev, "unexpected interrupt, intdata=0x%08X", intdata); 511 netdev_warn(dev->net, "unexpected interrupt, intdata=0x%08X\n",
512 intdata);
528} 513}
529 514
530/* Enable or disable Tx & Rx checksum offload engines */ 515/* Enable or disable Tx & Rx checksum offload engines */
@@ -534,7 +519,7 @@ static int smsc95xx_set_csums(struct usbnet *dev)
534 u32 read_buf; 519 u32 read_buf;
535 int ret = smsc95xx_read_reg(dev, COE_CR, &read_buf); 520 int ret = smsc95xx_read_reg(dev, COE_CR, &read_buf);
536 if (ret < 0) { 521 if (ret < 0) {
537 devwarn(dev, "Failed to read COE_CR: %d", ret); 522 netdev_warn(dev->net, "Failed to read COE_CR: %d\n", ret);
538 return ret; 523 return ret;
539 } 524 }
540 525
@@ -550,12 +535,11 @@ static int smsc95xx_set_csums(struct usbnet *dev)
550 535
551 ret = smsc95xx_write_reg(dev, COE_CR, read_buf); 536 ret = smsc95xx_write_reg(dev, COE_CR, read_buf);
552 if (ret < 0) { 537 if (ret < 0) {
553 devwarn(dev, "Failed to write COE_CR: %d", ret); 538 netdev_warn(dev->net, "Failed to write COE_CR: %d\n", ret);
554 return ret; 539 return ret;
555 } 540 }
556 541
557 if (netif_msg_hw(dev)) 542 netif_dbg(dev, hw, dev->net, "COE_CR = 0x%08x\n", read_buf);
558 devdbg(dev, "COE_CR = 0x%08x", read_buf);
559 return 0; 543 return 0;
560} 544}
561 545
@@ -580,8 +564,8 @@ static int smsc95xx_ethtool_set_eeprom(struct net_device *netdev,
580 struct usbnet *dev = netdev_priv(netdev); 564 struct usbnet *dev = netdev_priv(netdev);
581 565
582 if (ee->magic != LAN95XX_EEPROM_MAGIC) { 566 if (ee->magic != LAN95XX_EEPROM_MAGIC) {
583 devwarn(dev, "EEPROM: magic value mismatch, magic = 0x%x", 567 netdev_warn(dev->net, "EEPROM: magic value mismatch, magic = 0x%x\n",
584 ee->magic); 568 ee->magic);
585 return -EINVAL; 569 return -EINVAL;
586 } 570 }
587 571
@@ -659,16 +643,14 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
659 dev->net->dev_addr) == 0) { 643 dev->net->dev_addr) == 0) {
660 if (is_valid_ether_addr(dev->net->dev_addr)) { 644 if (is_valid_ether_addr(dev->net->dev_addr)) {
661 /* eeprom values are valid so use them */ 645 /* eeprom values are valid so use them */
662 if (netif_msg_ifup(dev)) 646 netif_dbg(dev, ifup, dev->net, "MAC address read from EEPROM\n");
663 devdbg(dev, "MAC address read from EEPROM");
664 return; 647 return;
665 } 648 }
666 } 649 }
667 650
668 /* no eeprom, or eeprom values are invalid. generate random MAC */ 651 /* no eeprom, or eeprom values are invalid. generate random MAC */
669 random_ether_addr(dev->net->dev_addr); 652 random_ether_addr(dev->net->dev_addr);
670 if (netif_msg_ifup(dev)) 653 netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n");
671 devdbg(dev, "MAC address set to random_ether_addr");
672} 654}
673 655
674static int smsc95xx_set_mac_address(struct usbnet *dev) 656static int smsc95xx_set_mac_address(struct usbnet *dev)
@@ -680,13 +662,13 @@ static int smsc95xx_set_mac_address(struct usbnet *dev)
680 662
681 ret = smsc95xx_write_reg(dev, ADDRL, addr_lo); 663 ret = smsc95xx_write_reg(dev, ADDRL, addr_lo);
682 if (ret < 0) { 664 if (ret < 0) {
683 devwarn(dev, "Failed to write ADDRL: %d", ret); 665 netdev_warn(dev->net, "Failed to write ADDRL: %d\n", ret);
684 return ret; 666 return ret;
685 } 667 }
686 668
687 ret = smsc95xx_write_reg(dev, ADDRH, addr_hi); 669 ret = smsc95xx_write_reg(dev, ADDRH, addr_hi);
688 if (ret < 0) { 670 if (ret < 0) {
689 devwarn(dev, "Failed to write ADDRH: %d", ret); 671 netdev_warn(dev->net, "Failed to write ADDRH: %d\n", ret);
690 return ret; 672 return ret;
691 } 673 }
692 674
@@ -747,8 +729,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev)
747 PHY_INT_MASK_DEFAULT_); 729 PHY_INT_MASK_DEFAULT_);
748 mii_nway_restart(&dev->mii); 730 mii_nway_restart(&dev->mii);
749 731
750 if (netif_msg_ifup(dev)) 732 netif_dbg(dev, ifup, dev->net, "phy initialised successfully\n");
751 devdbg(dev, "phy initialised successfully");
752 return 0; 733 return 0;
753} 734}
754 735
@@ -759,14 +740,13 @@ static int smsc95xx_reset(struct usbnet *dev)
759 u32 read_buf, write_buf, burst_cap; 740 u32 read_buf, write_buf, burst_cap;
760 int ret = 0, timeout; 741 int ret = 0, timeout;
761 742
762 if (netif_msg_ifup(dev)) 743 netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n");
763 devdbg(dev, "entering smsc95xx_reset");
764 744
765 write_buf = HW_CFG_LRST_; 745 write_buf = HW_CFG_LRST_;
766 ret = smsc95xx_write_reg(dev, HW_CFG, write_buf); 746 ret = smsc95xx_write_reg(dev, HW_CFG, write_buf);
767 if (ret < 0) { 747 if (ret < 0) {
768 devwarn(dev, "Failed to write HW_CFG_LRST_ bit in HW_CFG " 748 netdev_warn(dev->net, "Failed to write HW_CFG_LRST_ bit in HW_CFG register, ret = %d\n",
769 "register, ret = %d", ret); 749 ret);
770 return ret; 750 return ret;
771 } 751 }
772 752
@@ -774,7 +754,7 @@ static int smsc95xx_reset(struct usbnet *dev)
774 do { 754 do {
775 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf); 755 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
776 if (ret < 0) { 756 if (ret < 0) {
777 devwarn(dev, "Failed to read HW_CFG: %d", ret); 757 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
778 return ret; 758 return ret;
779 } 759 }
780 msleep(10); 760 msleep(10);
@@ -782,14 +762,14 @@ static int smsc95xx_reset(struct usbnet *dev)
782 } while ((read_buf & HW_CFG_LRST_) && (timeout < 100)); 762 } while ((read_buf & HW_CFG_LRST_) && (timeout < 100));
783 763
784 if (timeout >= 100) { 764 if (timeout >= 100) {
785 devwarn(dev, "timeout waiting for completion of Lite Reset"); 765 netdev_warn(dev->net, "timeout waiting for completion of Lite Reset\n");
786 return ret; 766 return ret;
787 } 767 }
788 768
789 write_buf = PM_CTL_PHY_RST_; 769 write_buf = PM_CTL_PHY_RST_;
790 ret = smsc95xx_write_reg(dev, PM_CTRL, write_buf); 770 ret = smsc95xx_write_reg(dev, PM_CTRL, write_buf);
791 if (ret < 0) { 771 if (ret < 0) {
792 devwarn(dev, "Failed to write PM_CTRL: %d", ret); 772 netdev_warn(dev->net, "Failed to write PM_CTRL: %d\n", ret);
793 return ret; 773 return ret;
794 } 774 }
795 775
@@ -797,7 +777,7 @@ static int smsc95xx_reset(struct usbnet *dev)
797 do { 777 do {
798 ret = smsc95xx_read_reg(dev, PM_CTRL, &read_buf); 778 ret = smsc95xx_read_reg(dev, PM_CTRL, &read_buf);
799 if (ret < 0) { 779 if (ret < 0) {
800 devwarn(dev, "Failed to read PM_CTRL: %d", ret); 780 netdev_warn(dev->net, "Failed to read PM_CTRL: %d\n", ret);
801 return ret; 781 return ret;
802 } 782 }
803 msleep(10); 783 msleep(10);
@@ -805,7 +785,7 @@ static int smsc95xx_reset(struct usbnet *dev)
805 } while ((read_buf & PM_CTL_PHY_RST_) && (timeout < 100)); 785 } while ((read_buf & PM_CTL_PHY_RST_) && (timeout < 100));
806 786
807 if (timeout >= 100) { 787 if (timeout >= 100) {
808 devwarn(dev, "timeout waiting for PHY Reset"); 788 netdev_warn(dev->net, "timeout waiting for PHY Reset\n");
809 return ret; 789 return ret;
810 } 790 }
811 791
@@ -815,35 +795,35 @@ static int smsc95xx_reset(struct usbnet *dev)
815 if (ret < 0) 795 if (ret < 0)
816 return ret; 796 return ret;
817 797
818 if (netif_msg_ifup(dev)) 798 netif_dbg(dev, ifup, dev->net,
819 devdbg(dev, "MAC Address: %pM", dev->net->dev_addr); 799 "MAC Address: %pM\n", dev->net->dev_addr);
820 800
821 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf); 801 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
822 if (ret < 0) { 802 if (ret < 0) {
823 devwarn(dev, "Failed to read HW_CFG: %d", ret); 803 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
824 return ret; 804 return ret;
825 } 805 }
826 806
827 if (netif_msg_ifup(dev)) 807 netif_dbg(dev, ifup, dev->net,
828 devdbg(dev, "Read Value from HW_CFG : 0x%08x", read_buf); 808 "Read Value from HW_CFG : 0x%08x\n", read_buf);
829 809
830 read_buf |= HW_CFG_BIR_; 810 read_buf |= HW_CFG_BIR_;
831 811
832 ret = smsc95xx_write_reg(dev, HW_CFG, read_buf); 812 ret = smsc95xx_write_reg(dev, HW_CFG, read_buf);
833 if (ret < 0) { 813 if (ret < 0) {
834 devwarn(dev, "Failed to write HW_CFG_BIR_ bit in HW_CFG " 814 netdev_warn(dev->net, "Failed to write HW_CFG_BIR_ bit in HW_CFG register, ret = %d\n",
835 "register, ret = %d", ret); 815 ret);
836 return ret; 816 return ret;
837 } 817 }
838 818
839 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf); 819 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
840 if (ret < 0) { 820 if (ret < 0) {
841 devwarn(dev, "Failed to read HW_CFG: %d", ret); 821 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
842 return ret; 822 return ret;
843 } 823 }
844 if (netif_msg_ifup(dev)) 824 netif_dbg(dev, ifup, dev->net,
845 devdbg(dev, "Read Value from HW_CFG after writing " 825 "Read Value from HW_CFG after writing HW_CFG_BIR_: 0x%08x\n",
846 "HW_CFG_BIR_: 0x%08x", read_buf); 826 read_buf);
847 827
848 if (!turbo_mode) { 828 if (!turbo_mode) {
849 burst_cap = 0; 829 burst_cap = 0;
@@ -856,47 +836,47 @@ static int smsc95xx_reset(struct usbnet *dev)
856 dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE; 836 dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE;
857 } 837 }
858 838
859 if (netif_msg_ifup(dev)) 839 netif_dbg(dev, ifup, dev->net,
860 devdbg(dev, "rx_urb_size=%ld", (ulong)dev->rx_urb_size); 840 "rx_urb_size=%ld\n", (ulong)dev->rx_urb_size);
861 841
862 ret = smsc95xx_write_reg(dev, BURST_CAP, burst_cap); 842 ret = smsc95xx_write_reg(dev, BURST_CAP, burst_cap);
863 if (ret < 0) { 843 if (ret < 0) {
864 devwarn(dev, "Failed to write BURST_CAP: %d", ret); 844 netdev_warn(dev->net, "Failed to write BURST_CAP: %d\n", ret);
865 return ret; 845 return ret;
866 } 846 }
867 847
868 ret = smsc95xx_read_reg(dev, BURST_CAP, &read_buf); 848 ret = smsc95xx_read_reg(dev, BURST_CAP, &read_buf);
869 if (ret < 0) { 849 if (ret < 0) {
870 devwarn(dev, "Failed to read BURST_CAP: %d", ret); 850 netdev_warn(dev->net, "Failed to read BURST_CAP: %d\n", ret);
871 return ret; 851 return ret;
872 } 852 }
873 if (netif_msg_ifup(dev)) 853 netif_dbg(dev, ifup, dev->net,
874 devdbg(dev, "Read Value from BURST_CAP after writing: 0x%08x", 854 "Read Value from BURST_CAP after writing: 0x%08x\n",
875 read_buf); 855 read_buf);
876 856
877 read_buf = DEFAULT_BULK_IN_DELAY; 857 read_buf = DEFAULT_BULK_IN_DELAY;
878 ret = smsc95xx_write_reg(dev, BULK_IN_DLY, read_buf); 858 ret = smsc95xx_write_reg(dev, BULK_IN_DLY, read_buf);
879 if (ret < 0) { 859 if (ret < 0) {
880 devwarn(dev, "ret = %d", ret); 860 netdev_warn(dev->net, "ret = %d\n", ret);
881 return ret; 861 return ret;
882 } 862 }
883 863
884 ret = smsc95xx_read_reg(dev, BULK_IN_DLY, &read_buf); 864 ret = smsc95xx_read_reg(dev, BULK_IN_DLY, &read_buf);
885 if (ret < 0) { 865 if (ret < 0) {
886 devwarn(dev, "Failed to read BULK_IN_DLY: %d", ret); 866 netdev_warn(dev->net, "Failed to read BULK_IN_DLY: %d\n", ret);
887 return ret; 867 return ret;
888 } 868 }
889 if (netif_msg_ifup(dev)) 869 netif_dbg(dev, ifup, dev->net,
890 devdbg(dev, "Read Value from BULK_IN_DLY after writing: " 870 "Read Value from BULK_IN_DLY after writing: 0x%08x\n",
891 "0x%08x", read_buf); 871 read_buf);
892 872
893 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf); 873 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
894 if (ret < 0) { 874 if (ret < 0) {
895 devwarn(dev, "Failed to read HW_CFG: %d", ret); 875 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
896 return ret; 876 return ret;
897 } 877 }
898 if (netif_msg_ifup(dev)) 878 netif_dbg(dev, ifup, dev->net,
899 devdbg(dev, "Read Value from HW_CFG: 0x%08x", read_buf); 879 "Read Value from HW_CFG: 0x%08x\n", read_buf);
900 880
901 if (turbo_mode) 881 if (turbo_mode)
902 read_buf |= (HW_CFG_MEF_ | HW_CFG_BCE_); 882 read_buf |= (HW_CFG_MEF_ | HW_CFG_BCE_);
@@ -908,41 +888,41 @@ static int smsc95xx_reset(struct usbnet *dev)
908 888
909 ret = smsc95xx_write_reg(dev, HW_CFG, read_buf); 889 ret = smsc95xx_write_reg(dev, HW_CFG, read_buf);
910 if (ret < 0) { 890 if (ret < 0) {
911 devwarn(dev, "Failed to write HW_CFG register, ret=%d", ret); 891 netdev_warn(dev->net, "Failed to write HW_CFG register, ret=%d\n",
892 ret);
912 return ret; 893 return ret;
913 } 894 }
914 895
915 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf); 896 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
916 if (ret < 0) { 897 if (ret < 0) {
917 devwarn(dev, "Failed to read HW_CFG: %d", ret); 898 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
918 return ret; 899 return ret;
919 } 900 }
920 if (netif_msg_ifup(dev)) 901 netif_dbg(dev, ifup, dev->net,
921 devdbg(dev, "Read Value from HW_CFG after writing: 0x%08x", 902 "Read Value from HW_CFG after writing: 0x%08x\n", read_buf);
922 read_buf);
923 903
924 write_buf = 0xFFFFFFFF; 904 write_buf = 0xFFFFFFFF;
925 ret = smsc95xx_write_reg(dev, INT_STS, write_buf); 905 ret = smsc95xx_write_reg(dev, INT_STS, write_buf);
926 if (ret < 0) { 906 if (ret < 0) {
927 devwarn(dev, "Failed to write INT_STS register, ret=%d", ret); 907 netdev_warn(dev->net, "Failed to write INT_STS register, ret=%d\n",
908 ret);
928 return ret; 909 return ret;
929 } 910 }
930 911
931 ret = smsc95xx_read_reg(dev, ID_REV, &read_buf); 912 ret = smsc95xx_read_reg(dev, ID_REV, &read_buf);
932 if (ret < 0) { 913 if (ret < 0) {
933 devwarn(dev, "Failed to read ID_REV: %d", ret); 914 netdev_warn(dev->net, "Failed to read ID_REV: %d\n", ret);
934 return ret; 915 return ret;
935 } 916 }
936 if (netif_msg_ifup(dev)) 917 netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf);
937 devdbg(dev, "ID_REV = 0x%08x", read_buf);
938 918
939 /* Configure GPIO pins as LED outputs */ 919 /* Configure GPIO pins as LED outputs */
940 write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED | 920 write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
941 LED_GPIO_CFG_FDX_LED; 921 LED_GPIO_CFG_FDX_LED;
942 ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf); 922 ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf);
943 if (ret < 0) { 923 if (ret < 0) {
944 devwarn(dev, "Failed to write LED_GPIO_CFG register, ret=%d", 924 netdev_warn(dev->net, "Failed to write LED_GPIO_CFG register, ret=%d\n",
945 ret); 925 ret);
946 return ret; 926 return ret;
947 } 927 }
948 928
@@ -950,21 +930,21 @@ static int smsc95xx_reset(struct usbnet *dev)
950 write_buf = 0; 930 write_buf = 0;
951 ret = smsc95xx_write_reg(dev, FLOW, write_buf); 931 ret = smsc95xx_write_reg(dev, FLOW, write_buf);
952 if (ret < 0) { 932 if (ret < 0) {
953 devwarn(dev, "Failed to write FLOW: %d", ret); 933 netdev_warn(dev->net, "Failed to write FLOW: %d\n", ret);
954 return ret; 934 return ret;
955 } 935 }
956 936
957 read_buf = AFC_CFG_DEFAULT; 937 read_buf = AFC_CFG_DEFAULT;
958 ret = smsc95xx_write_reg(dev, AFC_CFG, read_buf); 938 ret = smsc95xx_write_reg(dev, AFC_CFG, read_buf);
959 if (ret < 0) { 939 if (ret < 0) {
960 devwarn(dev, "Failed to write AFC_CFG: %d", ret); 940 netdev_warn(dev->net, "Failed to write AFC_CFG: %d\n", ret);
961 return ret; 941 return ret;
962 } 942 }
963 943
964 /* Don't need mac_cr_lock during initialisation */ 944 /* Don't need mac_cr_lock during initialisation */
965 ret = smsc95xx_read_reg(dev, MAC_CR, &pdata->mac_cr); 945 ret = smsc95xx_read_reg(dev, MAC_CR, &pdata->mac_cr);
966 if (ret < 0) { 946 if (ret < 0) {
967 devwarn(dev, "Failed to read MAC_CR: %d", ret); 947 netdev_warn(dev->net, "Failed to read MAC_CR: %d\n", ret);
968 return ret; 948 return ret;
969 } 949 }
970 950
@@ -973,7 +953,7 @@ static int smsc95xx_reset(struct usbnet *dev)
973 write_buf = (u32)ETH_P_8021Q; 953 write_buf = (u32)ETH_P_8021Q;
974 ret = smsc95xx_write_reg(dev, VLAN1, write_buf); 954 ret = smsc95xx_write_reg(dev, VLAN1, write_buf);
975 if (ret < 0) { 955 if (ret < 0) {
976 devwarn(dev, "Failed to write VAN1: %d", ret); 956 netdev_warn(dev->net, "Failed to write VAN1: %d\n", ret);
977 return ret; 957 return ret;
978 } 958 }
979 959
@@ -981,7 +961,7 @@ static int smsc95xx_reset(struct usbnet *dev)
981 ethtool_op_set_tx_hw_csum(netdev, pdata->use_tx_csum); 961 ethtool_op_set_tx_hw_csum(netdev, pdata->use_tx_csum);
982 ret = smsc95xx_set_csums(dev); 962 ret = smsc95xx_set_csums(dev);
983 if (ret < 0) { 963 if (ret < 0) {
984 devwarn(dev, "Failed to set csum offload: %d", ret); 964 netdev_warn(dev->net, "Failed to set csum offload: %d\n", ret);
985 return ret; 965 return ret;
986 } 966 }
987 967
@@ -992,7 +972,7 @@ static int smsc95xx_reset(struct usbnet *dev)
992 972
993 ret = smsc95xx_read_reg(dev, INT_EP_CTL, &read_buf); 973 ret = smsc95xx_read_reg(dev, INT_EP_CTL, &read_buf);
994 if (ret < 0) { 974 if (ret < 0) {
995 devwarn(dev, "Failed to read INT_EP_CTL: %d", ret); 975 netdev_warn(dev->net, "Failed to read INT_EP_CTL: %d\n", ret);
996 return ret; 976 return ret;
997 } 977 }
998 978
@@ -1001,15 +981,14 @@ static int smsc95xx_reset(struct usbnet *dev)
1001 981
1002 ret = smsc95xx_write_reg(dev, INT_EP_CTL, read_buf); 982 ret = smsc95xx_write_reg(dev, INT_EP_CTL, read_buf);
1003 if (ret < 0) { 983 if (ret < 0) {
1004 devwarn(dev, "Failed to write INT_EP_CTL: %d", ret); 984 netdev_warn(dev->net, "Failed to write INT_EP_CTL: %d\n", ret);
1005 return ret; 985 return ret;
1006 } 986 }
1007 987
1008 smsc95xx_start_tx_path(dev); 988 smsc95xx_start_tx_path(dev);
1009 smsc95xx_start_rx_path(dev); 989 smsc95xx_start_rx_path(dev);
1010 990
1011 if (netif_msg_ifup(dev)) 991 netif_dbg(dev, ifup, dev->net, "smsc95xx_reset, return 0\n");
1012 devdbg(dev, "smsc95xx_reset, return 0");
1013 return 0; 992 return 0;
1014} 993}
1015 994
@@ -1034,7 +1013,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
1034 1013
1035 ret = usbnet_get_endpoints(dev, intf); 1014 ret = usbnet_get_endpoints(dev, intf);
1036 if (ret < 0) { 1015 if (ret < 0) {
1037 devwarn(dev, "usbnet_get_endpoints failed: %d", ret); 1016 netdev_warn(dev->net, "usbnet_get_endpoints failed: %d\n", ret);
1038 return ret; 1017 return ret;
1039 } 1018 }
1040 1019
@@ -1043,7 +1022,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
1043 1022
1044 pdata = (struct smsc95xx_priv *)(dev->data[0]); 1023 pdata = (struct smsc95xx_priv *)(dev->data[0]);
1045 if (!pdata) { 1024 if (!pdata) {
1046 devwarn(dev, "Unable to allocate struct smsc95xx_priv"); 1025 netdev_warn(dev->net, "Unable to allocate struct smsc95xx_priv\n");
1047 return -ENOMEM; 1026 return -ENOMEM;
1048 } 1027 }
1049 1028
@@ -1066,8 +1045,7 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
1066{ 1045{
1067 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 1046 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
1068 if (pdata) { 1047 if (pdata) {
1069 if (netif_msg_ifdown(dev)) 1048 netif_dbg(dev, ifdown, dev->net, "free pdata\n");
1070 devdbg(dev, "free pdata");
1071 kfree(pdata); 1049 kfree(pdata);
1072 pdata = NULL; 1050 pdata = NULL;
1073 dev->data[0] = 0; 1051 dev->data[0] = 0;
@@ -1101,8 +1079,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1101 align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4; 1079 align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4;
1102 1080
1103 if (unlikely(header & RX_STS_ES_)) { 1081 if (unlikely(header & RX_STS_ES_)) {
1104 if (netif_msg_rx_err(dev)) 1082 netif_dbg(dev, rx_err, dev->net,
1105 devdbg(dev, "Error header=0x%08x", header); 1083 "Error header=0x%08x\n", header);
1106 dev->net->stats.rx_errors++; 1084 dev->net->stats.rx_errors++;
1107 dev->net->stats.rx_dropped++; 1085 dev->net->stats.rx_dropped++;
1108 1086
@@ -1119,9 +1097,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1119 } else { 1097 } else {
1120 /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */ 1098 /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */
1121 if (unlikely(size > (ETH_FRAME_LEN + 12))) { 1099 if (unlikely(size > (ETH_FRAME_LEN + 12))) {
1122 if (netif_msg_rx_err(dev)) 1100 netif_dbg(dev, rx_err, dev->net,
1123 devdbg(dev, "size err header=0x%08x", 1101 "size err header=0x%08x\n", header);
1124 header);
1125 return 0; 1102 return 0;
1126 } 1103 }
1127 1104
@@ -1137,7 +1114,7 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1137 1114
1138 ax_skb = skb_clone(skb, GFP_ATOMIC); 1115 ax_skb = skb_clone(skb, GFP_ATOMIC);
1139 if (unlikely(!ax_skb)) { 1116 if (unlikely(!ax_skb)) {
1140 devwarn(dev, "Error allocating skb"); 1117 netdev_warn(dev->net, "Error allocating skb\n");
1141 return 0; 1118 return 0;
1142 } 1119 }
1143 1120
@@ -1161,7 +1138,7 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1161 } 1138 }
1162 1139
1163 if (unlikely(skb->len < 0)) { 1140 if (unlikely(skb->len < 0)) {
1164 devwarn(dev, "invalid rx length<0 %d", skb->len); 1141 netdev_warn(dev->net, "invalid rx length<0 %d\n", skb->len);
1165 return 0; 1142 return 0;
1166 } 1143 }
1167 1144
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 035fab04c0a0..17b6a62d206e 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -242,13 +242,13 @@ void usbnet_skb_return (struct usbnet *dev, struct sk_buff *skb)
242 dev->net->stats.rx_packets++; 242 dev->net->stats.rx_packets++;
243 dev->net->stats.rx_bytes += skb->len; 243 dev->net->stats.rx_bytes += skb->len;
244 244
245 if (netif_msg_rx_status (dev)) 245 netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
246 devdbg (dev, "< rx, len %zu, type 0x%x", 246 skb->len + sizeof (struct ethhdr), skb->protocol);
247 skb->len + sizeof (struct ethhdr), skb->protocol);
248 memset (skb->cb, 0, sizeof (struct skb_data)); 247 memset (skb->cb, 0, sizeof (struct skb_data));
249 status = netif_rx (skb); 248 status = netif_rx (skb);
250 if (status != NET_RX_SUCCESS && netif_msg_rx_err (dev)) 249 if (status != NET_RX_SUCCESS)
251 devdbg (dev, "netif_rx status %d", status); 250 netif_dbg(dev, rx_err, dev->net,
251 "netif_rx status %d\n", status);
252} 252}
253EXPORT_SYMBOL_GPL(usbnet_skb_return); 253EXPORT_SYMBOL_GPL(usbnet_skb_return);
254 254
@@ -313,9 +313,9 @@ void usbnet_defer_kevent (struct usbnet *dev, int work)
313{ 313{
314 set_bit (work, &dev->flags); 314 set_bit (work, &dev->flags);
315 if (!schedule_work (&dev->kevent)) 315 if (!schedule_work (&dev->kevent))
316 deverr (dev, "kevent %d may have been dropped", work); 316 netdev_err(dev->net, "kevent %d may have been dropped\n", work);
317 else 317 else
318 devdbg (dev, "kevent %d scheduled", work); 318 netdev_dbg(dev->net, "kevent %d scheduled\n", work);
319} 319}
320EXPORT_SYMBOL_GPL(usbnet_defer_kevent); 320EXPORT_SYMBOL_GPL(usbnet_defer_kevent);
321 321
@@ -332,8 +332,7 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
332 size_t size = dev->rx_urb_size; 332 size_t size = dev->rx_urb_size;
333 333
334 if ((skb = alloc_skb (size + NET_IP_ALIGN, flags)) == NULL) { 334 if ((skb = alloc_skb (size + NET_IP_ALIGN, flags)) == NULL) {
335 if (netif_msg_rx_err (dev)) 335 netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
336 devdbg (dev, "no rx skb");
337 usbnet_defer_kevent (dev, EVENT_RX_MEMORY); 336 usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
338 usb_free_urb (urb); 337 usb_free_urb (urb);
339 return; 338 return;
@@ -363,21 +362,19 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
363 usbnet_defer_kevent (dev, EVENT_RX_MEMORY); 362 usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
364 break; 363 break;
365 case -ENODEV: 364 case -ENODEV:
366 if (netif_msg_ifdown (dev)) 365 netif_dbg(dev, ifdown, dev->net, "device gone\n");
367 devdbg (dev, "device gone");
368 netif_device_detach (dev->net); 366 netif_device_detach (dev->net);
369 break; 367 break;
370 default: 368 default:
371 if (netif_msg_rx_err (dev)) 369 netif_dbg(dev, rx_err, dev->net,
372 devdbg (dev, "rx submit, %d", retval); 370 "rx submit, %d\n", retval);
373 tasklet_schedule (&dev->bh); 371 tasklet_schedule (&dev->bh);
374 break; 372 break;
375 case 0: 373 case 0:
376 __skb_queue_tail (&dev->rxq, skb); 374 __skb_queue_tail (&dev->rxq, skb);
377 } 375 }
378 } else { 376 } else {
379 if (netif_msg_ifdown (dev)) 377 netif_dbg(dev, ifdown, dev->net, "rx: stopped\n");
380 devdbg (dev, "rx: stopped");
381 retval = -ENOLINK; 378 retval = -ENOLINK;
382 } 379 }
383 spin_unlock_irqrestore (&dev->rxq.lock, lockflags); 380 spin_unlock_irqrestore (&dev->rxq.lock, lockflags);
@@ -400,8 +397,7 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
400 if (skb->len) 397 if (skb->len)
401 usbnet_skb_return (dev, skb); 398 usbnet_skb_return (dev, skb);
402 else { 399 else {
403 if (netif_msg_rx_err (dev)) 400 netif_dbg(dev, rx_err, dev->net, "drop\n");
404 devdbg (dev, "drop");
405error: 401error:
406 dev->net->stats.rx_errors++; 402 dev->net->stats.rx_errors++;
407 skb_queue_tail (&dev->done, skb); 403 skb_queue_tail (&dev->done, skb);
@@ -428,8 +424,8 @@ static void rx_complete (struct urb *urb)
428 entry->state = rx_cleanup; 424 entry->state = rx_cleanup;
429 dev->net->stats.rx_errors++; 425 dev->net->stats.rx_errors++;
430 dev->net->stats.rx_length_errors++; 426 dev->net->stats.rx_length_errors++;
431 if (netif_msg_rx_err (dev)) 427 netif_dbg(dev, rx_err, dev->net,
432 devdbg (dev, "rx length %d", skb->len); 428 "rx length %d\n", skb->len);
433 } 429 }
434 break; 430 break;
435 431
@@ -446,8 +442,8 @@ static void rx_complete (struct urb *urb)
446 /* software-driven interface shutdown */ 442 /* software-driven interface shutdown */
447 case -ECONNRESET: /* async unlink */ 443 case -ECONNRESET: /* async unlink */
448 case -ESHUTDOWN: /* hardware gone */ 444 case -ESHUTDOWN: /* hardware gone */
449 if (netif_msg_ifdown (dev)) 445 netif_dbg(dev, ifdown, dev->net,
450 devdbg (dev, "rx shutdown, code %d", urb_status); 446 "rx shutdown, code %d\n", urb_status);
451 goto block; 447 goto block;
452 448
453 /* we get controller i/o faults during khubd disconnect() delays. 449 /* we get controller i/o faults during khubd disconnect() delays.
@@ -460,8 +456,8 @@ static void rx_complete (struct urb *urb)
460 dev->net->stats.rx_errors++; 456 dev->net->stats.rx_errors++;
461 if (!timer_pending (&dev->delay)) { 457 if (!timer_pending (&dev->delay)) {
462 mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); 458 mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES);
463 if (netif_msg_link (dev)) 459 netif_dbg(dev, link, dev->net,
464 devdbg (dev, "rx throttle %d", urb_status); 460 "rx throttle %d\n", urb_status);
465 } 461 }
466block: 462block:
467 entry->state = rx_cleanup; 463 entry->state = rx_cleanup;
@@ -477,8 +473,7 @@ block:
477 default: 473 default:
478 entry->state = rx_cleanup; 474 entry->state = rx_cleanup;
479 dev->net->stats.rx_errors++; 475 dev->net->stats.rx_errors++;
480 if (netif_msg_rx_err (dev)) 476 netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status);
481 devdbg (dev, "rx status %d", urb_status);
482 break; 477 break;
483 } 478 }
484 479
@@ -492,8 +487,7 @@ block:
492 } 487 }
493 usb_free_urb (urb); 488 usb_free_urb (urb);
494 } 489 }
495 if (netif_msg_rx_err (dev)) 490 netif_dbg(dev, rx_err, dev->net, "no read resubmitted\n");
496 devdbg (dev, "no read resubmitted");
497} 491}
498 492
499static void intr_complete (struct urb *urb) 493static void intr_complete (struct urb *urb)
@@ -510,15 +504,15 @@ static void intr_complete (struct urb *urb)
510 /* software-driven interface shutdown */ 504 /* software-driven interface shutdown */
511 case -ENOENT: /* urb killed */ 505 case -ENOENT: /* urb killed */
512 case -ESHUTDOWN: /* hardware gone */ 506 case -ESHUTDOWN: /* hardware gone */
513 if (netif_msg_ifdown (dev)) 507 netif_dbg(dev, ifdown, dev->net,
514 devdbg (dev, "intr shutdown, code %d", status); 508 "intr shutdown, code %d\n", status);
515 return; 509 return;
516 510
517 /* NOTE: not throttling like RX/TX, since this endpoint 511 /* NOTE: not throttling like RX/TX, since this endpoint
518 * already polls infrequently 512 * already polls infrequently
519 */ 513 */
520 default: 514 default:
521 devdbg (dev, "intr status %d", status); 515 netdev_dbg(dev->net, "intr status %d\n", status);
522 break; 516 break;
523 } 517 }
524 518
@@ -527,8 +521,9 @@ static void intr_complete (struct urb *urb)
527 521
528 memset(urb->transfer_buffer, 0, urb->transfer_buffer_length); 522 memset(urb->transfer_buffer, 0, urb->transfer_buffer_length);
529 status = usb_submit_urb (urb, GFP_ATOMIC); 523 status = usb_submit_urb (urb, GFP_ATOMIC);
530 if (status != 0 && netif_msg_timer (dev)) 524 if (status != 0)
531 deverr(dev, "intr resubmit --> %d", status); 525 netif_err(dev, timer, dev->net,
526 "intr resubmit --> %d\n", status);
532} 527}
533 528
534/*-------------------------------------------------------------------------*/ 529/*-------------------------------------------------------------------------*/
@@ -536,8 +531,7 @@ void usbnet_pause_rx(struct usbnet *dev)
536{ 531{
537 set_bit(EVENT_RX_PAUSED, &dev->flags); 532 set_bit(EVENT_RX_PAUSED, &dev->flags);
538 533
539 if (netif_msg_rx_status(dev)) 534 netif_dbg(dev, rx_status, dev->net, "paused rx queue enabled\n");
540 devdbg(dev, "paused rx queue enabled");
541} 535}
542EXPORT_SYMBOL_GPL(usbnet_pause_rx); 536EXPORT_SYMBOL_GPL(usbnet_pause_rx);
543 537
@@ -555,8 +549,8 @@ void usbnet_resume_rx(struct usbnet *dev)
555 549
556 tasklet_schedule(&dev->bh); 550 tasklet_schedule(&dev->bh);
557 551
558 if (netif_msg_rx_status(dev)) 552 netif_dbg(dev, rx_status, dev->net,
559 devdbg(dev, "paused rx queue disabled, %d skbs requeued", num); 553 "paused rx queue disabled, %d skbs requeued\n", num);
560} 554}
561EXPORT_SYMBOL_GPL(usbnet_resume_rx); 555EXPORT_SYMBOL_GPL(usbnet_resume_rx);
562 556
@@ -589,7 +583,7 @@ static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q)
589 // these (async) unlinks complete immediately 583 // these (async) unlinks complete immediately
590 retval = usb_unlink_urb (urb); 584 retval = usb_unlink_urb (urb);
591 if (retval != -EINPROGRESS && retval != 0) 585 if (retval != -EINPROGRESS && retval != 0)
592 devdbg (dev, "unlink urb err, %d", retval); 586 netdev_dbg(dev->net, "unlink urb err, %d\n", retval);
593 else 587 else
594 count++; 588 count++;
595 } 589 }
@@ -631,9 +625,8 @@ static void usbnet_terminate_urbs(struct usbnet *dev)
631 && !skb_queue_empty(&dev->done)) { 625 && !skb_queue_empty(&dev->done)) {
632 schedule_timeout(UNLINK_TIMEOUT_MS); 626 schedule_timeout(UNLINK_TIMEOUT_MS);
633 set_current_state(TASK_UNINTERRUPTIBLE); 627 set_current_state(TASK_UNINTERRUPTIBLE);
634 if (netif_msg_ifdown(dev)) 628 netif_dbg(dev, ifdown, dev->net,
635 devdbg(dev, "waited for %d urb completions", 629 "waited for %d urb completions\n", temp);
636 temp);
637 } 630 }
638 set_current_state(TASK_RUNNING); 631 set_current_state(TASK_RUNNING);
639 dev->wait = NULL; 632 dev->wait = NULL;
@@ -648,22 +641,21 @@ int usbnet_stop (struct net_device *net)
648 641
649 netif_stop_queue (net); 642 netif_stop_queue (net);
650 643
651 if (netif_msg_ifdown (dev)) 644 netif_info(dev, ifdown, dev->net,
652 devinfo (dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld", 645 "stop stats: rx/tx %ld/%ld, errs %ld/%ld\n",
653 net->stats.rx_packets, net->stats.tx_packets, 646 net->stats.rx_packets, net->stats.tx_packets,
654 net->stats.rx_errors, net->stats.tx_errors 647 net->stats.rx_errors, net->stats.tx_errors);
655 );
656 648
657 /* allow minidriver to stop correctly (wireless devices to turn off 649 /* allow minidriver to stop correctly (wireless devices to turn off
658 * radio etc) */ 650 * radio etc) */
659 if (info->stop) { 651 if (info->stop) {
660 retval = info->stop(dev); 652 retval = info->stop(dev);
661 if (retval < 0 && netif_msg_ifdown(dev)) 653 if (retval < 0)
662 devinfo(dev, 654 netif_info(dev, ifdown, dev->net,
663 "stop fail (%d) usbnet usb-%s-%s, %s", 655 "stop fail (%d) usbnet usb-%s-%s, %s\n",
664 retval, 656 retval,
665 dev->udev->bus->bus_name, dev->udev->devpath, 657 dev->udev->bus->bus_name, dev->udev->devpath,
666 info->description); 658 info->description);
667 } 659 }
668 660
669 if (!(info->flags & FLAG_AVOID_UNLINK_URBS)) 661 if (!(info->flags & FLAG_AVOID_UNLINK_URBS))
@@ -702,30 +694,29 @@ int usbnet_open (struct net_device *net)
702 struct driver_info *info = dev->driver_info; 694 struct driver_info *info = dev->driver_info;
703 695
704 if ((retval = usb_autopm_get_interface(dev->intf)) < 0) { 696 if ((retval = usb_autopm_get_interface(dev->intf)) < 0) {
705 if (netif_msg_ifup (dev)) 697 netif_info(dev, ifup, dev->net,
706 devinfo (dev, 698 "resumption fail (%d) usbnet usb-%s-%s, %s\n",
707 "resumption fail (%d) usbnet usb-%s-%s, %s", 699 retval,
708 retval, 700 dev->udev->bus->bus_name,
709 dev->udev->bus->bus_name, dev->udev->devpath, 701 dev->udev->devpath,
710 info->description); 702 info->description);
711 goto done_nopm; 703 goto done_nopm;
712 } 704 }
713 705
714 // put into "known safe" state 706 // put into "known safe" state
715 if (info->reset && (retval = info->reset (dev)) < 0) { 707 if (info->reset && (retval = info->reset (dev)) < 0) {
716 if (netif_msg_ifup (dev)) 708 netif_info(dev, ifup, dev->net,
717 devinfo (dev, 709 "open reset fail (%d) usbnet usb-%s-%s, %s\n",
718 "open reset fail (%d) usbnet usb-%s-%s, %s", 710 retval,
719 retval, 711 dev->udev->bus->bus_name,
720 dev->udev->bus->bus_name, dev->udev->devpath, 712 dev->udev->devpath,
721 info->description); 713 info->description);
722 goto done; 714 goto done;
723 } 715 }
724 716
725 // insist peer be connected 717 // insist peer be connected
726 if (info->check_connect && (retval = info->check_connect (dev)) < 0) { 718 if (info->check_connect && (retval = info->check_connect (dev)) < 0) {
727 if (netif_msg_ifup (dev)) 719 netif_dbg(dev, ifup, dev->net, "can't open; %d\n", retval);
728 devdbg (dev, "can't open; %d", retval);
729 goto done; 720 goto done;
730 } 721 }
731 722
@@ -733,34 +724,23 @@ int usbnet_open (struct net_device *net)
733 if (dev->interrupt) { 724 if (dev->interrupt) {
734 retval = usb_submit_urb (dev->interrupt, GFP_KERNEL); 725 retval = usb_submit_urb (dev->interrupt, GFP_KERNEL);
735 if (retval < 0) { 726 if (retval < 0) {
736 if (netif_msg_ifup (dev)) 727 netif_err(dev, ifup, dev->net,
737 deverr (dev, "intr submit %d", retval); 728 "intr submit %d\n", retval);
738 goto done; 729 goto done;
739 } 730 }
740 } 731 }
741 732
742 netif_start_queue (net); 733 netif_start_queue (net);
743 if (netif_msg_ifup (dev)) { 734 netif_info(dev, ifup, dev->net,
744 char *framing; 735 "open: enable queueing (rx %d, tx %d) mtu %d %s framing\n",
745 736 (int)RX_QLEN(dev), (int)TX_QLEN(dev),
746 if (dev->driver_info->flags & FLAG_FRAMING_NC) 737 dev->net->mtu,
747 framing = "NetChip"; 738 (dev->driver_info->flags & FLAG_FRAMING_NC) ? "NetChip" :
748 else if (dev->driver_info->flags & FLAG_FRAMING_GL) 739 (dev->driver_info->flags & FLAG_FRAMING_GL) ? "GeneSys" :
749 framing = "GeneSys"; 740 (dev->driver_info->flags & FLAG_FRAMING_Z) ? "Zaurus" :
750 else if (dev->driver_info->flags & FLAG_FRAMING_Z) 741 (dev->driver_info->flags & FLAG_FRAMING_RN) ? "RNDIS" :
751 framing = "Zaurus"; 742 (dev->driver_info->flags & FLAG_FRAMING_AX) ? "ASIX" :
752 else if (dev->driver_info->flags & FLAG_FRAMING_RN) 743 "simple");
753 framing = "RNDIS";
754 else if (dev->driver_info->flags & FLAG_FRAMING_AX)
755 framing = "ASIX";
756 else
757 framing = "simple";
758
759 devinfo (dev, "open: enable queueing "
760 "(rx %d, tx %d) mtu %d %s framing",
761 (int)RX_QLEN (dev), (int)TX_QLEN (dev), dev->net->mtu,
762 framing);
763 }
764 744
765 // delay posting reads until we're fully open 745 // delay posting reads until we're fully open
766 tasklet_schedule (&dev->bh); 746 tasklet_schedule (&dev->bh);
@@ -771,6 +751,7 @@ int usbnet_open (struct net_device *net)
771 usb_autopm_put_interface(dev->intf); 751 usb_autopm_put_interface(dev->intf);
772 } 752 }
773 return retval; 753 return retval;
754
774done: 755done:
775 usb_autopm_put_interface(dev->intf); 756 usb_autopm_put_interface(dev->intf);
776done_nopm: 757done_nopm:
@@ -908,8 +889,8 @@ kevent (struct work_struct *work)
908 status != -ESHUTDOWN) { 889 status != -ESHUTDOWN) {
909 if (netif_msg_tx_err (dev)) 890 if (netif_msg_tx_err (dev))
910fail_pipe: 891fail_pipe:
911 deverr (dev, "can't clear tx halt, status %d", 892 netdev_err(dev->net, "can't clear tx halt, status %d\n",
912 status); 893 status);
913 } else { 894 } else {
914 clear_bit (EVENT_TX_HALT, &dev->flags); 895 clear_bit (EVENT_TX_HALT, &dev->flags);
915 if (status != -ESHUTDOWN) 896 if (status != -ESHUTDOWN)
@@ -928,8 +909,8 @@ fail_pipe:
928 status != -ESHUTDOWN) { 909 status != -ESHUTDOWN) {
929 if (netif_msg_rx_err (dev)) 910 if (netif_msg_rx_err (dev))
930fail_halt: 911fail_halt:
931 deverr (dev, "can't clear rx halt, status %d", 912 netdev_err(dev->net, "can't clear rx halt, status %d\n",
932 status); 913 status);
933 } else { 914 } else {
934 clear_bit (EVENT_RX_HALT, &dev->flags); 915 clear_bit (EVENT_RX_HALT, &dev->flags);
935 tasklet_schedule (&dev->bh); 916 tasklet_schedule (&dev->bh);
@@ -967,18 +948,18 @@ fail_lowmem:
967 if(info->link_reset && (retval = info->link_reset(dev)) < 0) { 948 if(info->link_reset && (retval = info->link_reset(dev)) < 0) {
968 usb_autopm_put_interface(dev->intf); 949 usb_autopm_put_interface(dev->intf);
969skip_reset: 950skip_reset:
970 devinfo(dev, "link reset failed (%d) usbnet usb-%s-%s, %s", 951 netdev_info(dev->net, "link reset failed (%d) usbnet usb-%s-%s, %s\n",
971 retval, 952 retval,
972 dev->udev->bus->bus_name, dev->udev->devpath, 953 dev->udev->bus->bus_name,
973 info->description); 954 dev->udev->devpath,
955 info->description);
974 } else { 956 } else {
975 usb_autopm_put_interface(dev->intf); 957 usb_autopm_put_interface(dev->intf);
976 } 958 }
977 } 959 }
978 960
979 if (dev->flags) 961 if (dev->flags)
980 devdbg (dev, "kevent done, flags = 0x%lx", 962 netdev_dbg(dev->net, "kevent done, flags = 0x%lx\n", dev->flags);
981 dev->flags);
982} 963}
983 964
984/*-------------------------------------------------------------------------*/ 965/*-------------------------------------------------------------------------*/
@@ -1014,15 +995,14 @@ static void tx_complete (struct urb *urb)
1014 if (!timer_pending (&dev->delay)) { 995 if (!timer_pending (&dev->delay)) {
1015 mod_timer (&dev->delay, 996 mod_timer (&dev->delay,
1016 jiffies + THROTTLE_JIFFIES); 997 jiffies + THROTTLE_JIFFIES);
1017 if (netif_msg_link (dev)) 998 netif_dbg(dev, link, dev->net,
1018 devdbg (dev, "tx throttle %d", 999 "tx throttle %d\n", urb->status);
1019 urb->status);
1020 } 1000 }
1021 netif_stop_queue (dev->net); 1001 netif_stop_queue (dev->net);
1022 break; 1002 break;
1023 default: 1003 default:
1024 if (netif_msg_tx_err (dev)) 1004 netif_dbg(dev, tx_err, dev->net,
1025 devdbg (dev, "tx err %d", entry->urb->status); 1005 "tx err %d\n", entry->urb->status);
1026 break; 1006 break;
1027 } 1007 }
1028 } 1008 }
@@ -1064,16 +1044,14 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1064 if (info->tx_fixup) { 1044 if (info->tx_fixup) {
1065 skb = info->tx_fixup (dev, skb, GFP_ATOMIC); 1045 skb = info->tx_fixup (dev, skb, GFP_ATOMIC);
1066 if (!skb) { 1046 if (!skb) {
1067 if (netif_msg_tx_err (dev)) 1047 netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n");
1068 devdbg (dev, "can't tx_fixup skb");
1069 goto drop; 1048 goto drop;
1070 } 1049 }
1071 } 1050 }
1072 length = skb->len; 1051 length = skb->len;
1073 1052
1074 if (!(urb = usb_alloc_urb (0, GFP_ATOMIC))) { 1053 if (!(urb = usb_alloc_urb (0, GFP_ATOMIC))) {
1075 if (netif_msg_tx_err (dev)) 1054 netif_dbg(dev, tx_err, dev->net, "no urb\n");
1076 devdbg (dev, "no urb");
1077 goto drop; 1055 goto drop;
1078 } 1056 }
1079 1057
@@ -1113,7 +1091,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1113 /* no use to process more packets */ 1091 /* no use to process more packets */
1114 netif_stop_queue(net); 1092 netif_stop_queue(net);
1115 spin_unlock_irqrestore(&dev->txq.lock, flags); 1093 spin_unlock_irqrestore(&dev->txq.lock, flags);
1116 devdbg(dev, "Delaying transmission for resumption"); 1094 netdev_dbg(dev->net, "Delaying transmission for resumption\n");
1117 goto deferred; 1095 goto deferred;
1118 } 1096 }
1119#endif 1097#endif
@@ -1126,8 +1104,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1126 break; 1104 break;
1127 default: 1105 default:
1128 usb_autopm_put_interface_async(dev->intf); 1106 usb_autopm_put_interface_async(dev->intf);
1129 if (netif_msg_tx_err (dev)) 1107 netif_dbg(dev, tx_err, dev->net,
1130 devdbg (dev, "tx: submit urb err %d", retval); 1108 "tx: submit urb err %d\n", retval);
1131 break; 1109 break;
1132 case 0: 1110 case 0:
1133 net->trans_start = jiffies; 1111 net->trans_start = jiffies;
@@ -1138,17 +1116,15 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1138 spin_unlock_irqrestore (&dev->txq.lock, flags); 1116 spin_unlock_irqrestore (&dev->txq.lock, flags);
1139 1117
1140 if (retval) { 1118 if (retval) {
1141 if (netif_msg_tx_err (dev)) 1119 netif_dbg(dev, tx_err, dev->net, "drop, code %d\n", retval);
1142 devdbg (dev, "drop, code %d", retval);
1143drop: 1120drop:
1144 dev->net->stats.tx_dropped++; 1121 dev->net->stats.tx_dropped++;
1145 if (skb) 1122 if (skb)
1146 dev_kfree_skb_any (skb); 1123 dev_kfree_skb_any (skb);
1147 usb_free_urb (urb); 1124 usb_free_urb (urb);
1148 } else if (netif_msg_tx_queued (dev)) { 1125 } else
1149 devdbg (dev, "> tx, len %d, type 0x%x", 1126 netif_dbg(dev, tx_queued, dev->net,
1150 length, skb->protocol); 1127 "> tx, len %d, type 0x%x\n", length, skb->protocol);
1151 }
1152#ifdef CONFIG_PM 1128#ifdef CONFIG_PM
1153deferred: 1129deferred:
1154#endif 1130#endif
@@ -1179,7 +1155,7 @@ static void usbnet_bh (unsigned long param)
1179 dev_kfree_skb (skb); 1155 dev_kfree_skb (skb);
1180 continue; 1156 continue;
1181 default: 1157 default:
1182 devdbg (dev, "bogus skb state %d", entry->state); 1158 netdev_dbg(dev->net, "bogus skb state %d\n", entry->state);
1183 } 1159 }
1184 } 1160 }
1185 1161
@@ -1207,9 +1183,10 @@ static void usbnet_bh (unsigned long param)
1207 if (urb != NULL) 1183 if (urb != NULL)
1208 rx_submit (dev, urb, GFP_ATOMIC); 1184 rx_submit (dev, urb, GFP_ATOMIC);
1209 } 1185 }
1210 if (temp != dev->rxq.qlen && netif_msg_link (dev)) 1186 if (temp != dev->rxq.qlen)
1211 devdbg (dev, "rxqlen %d --> %d", 1187 netif_dbg(dev, link, dev->net,
1212 temp, dev->rxq.qlen); 1188 "rxqlen %d --> %d\n",
1189 temp, dev->rxq.qlen);
1213 if (dev->rxq.qlen < qlen) 1190 if (dev->rxq.qlen < qlen)
1214 tasklet_schedule (&dev->bh); 1191 tasklet_schedule (&dev->bh);
1215 } 1192 }
@@ -1240,11 +1217,10 @@ void usbnet_disconnect (struct usb_interface *intf)
1240 1217
1241 xdev = interface_to_usbdev (intf); 1218 xdev = interface_to_usbdev (intf);
1242 1219
1243 if (netif_msg_probe (dev)) 1220 netif_info(dev, probe, dev->net, "unregister '%s' usb-%s-%s, %s\n",
1244 devinfo (dev, "unregister '%s' usb-%s-%s, %s", 1221 intf->dev.driver->name,
1245 intf->dev.driver->name, 1222 xdev->bus->bus_name, xdev->devpath,
1246 xdev->bus->bus_name, xdev->devpath, 1223 dev->driver_info->description);
1247 dev->driver_info->description);
1248 1224
1249 net = dev->net; 1225 net = dev->net;
1250 unregister_netdev (net); 1226 unregister_netdev (net);
@@ -1407,12 +1383,12 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1407 status = register_netdev (net); 1383 status = register_netdev (net);
1408 if (status) 1384 if (status)
1409 goto out3; 1385 goto out3;
1410 if (netif_msg_probe (dev)) 1386 netif_info(dev, probe, dev->net,
1411 devinfo (dev, "register '%s' at usb-%s-%s, %s, %pM", 1387 "register '%s' at usb-%s-%s, %s, %pM\n",
1412 udev->dev.driver->name, 1388 udev->dev.driver->name,
1413 xdev->bus->bus_name, xdev->devpath, 1389 xdev->bus->bus_name, xdev->devpath,
1414 dev->driver_info->description, 1390 dev->driver_info->description,
1415 net->dev_addr); 1391 net->dev_addr);
1416 1392
1417 // ok, it's ready to go. 1393 // ok, it's ready to go.
1418 usb_set_intfdata (udev, dev); 1394 usb_set_intfdata (udev, dev);