aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/kaweth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb/kaweth.c')
-rw-r--r--drivers/net/usb/kaweth.c64
1 files changed, 38 insertions, 26 deletions
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index df2a2cf35a99..d8ad55284389 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -179,6 +179,7 @@ static struct usb_driver kaweth_driver = {
179 .resume = kaweth_resume, 179 .resume = kaweth_resume,
180 .id_table = usb_klsi_table, 180 .id_table = usb_klsi_table,
181 .supports_autosuspend = 1, 181 .supports_autosuspend = 1,
182 .disable_hub_initiated_lpm = 1,
182}; 183};
183 184
184typedef __u8 eth_addr_t[6]; 185typedef __u8 eth_addr_t[6];
@@ -400,12 +401,13 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
400 401
401 ret = request_firmware(&fw, fwname, &kaweth->dev->dev); 402 ret = request_firmware(&fw, fwname, &kaweth->dev->dev);
402 if (ret) { 403 if (ret) {
403 err("Firmware request failed\n"); 404 dev_err(&kaweth->intf->dev, "Firmware request failed\n");
404 return ret; 405 return ret;
405 } 406 }
406 407
407 if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) { 408 if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) {
408 err("Firmware too big: %zu", fw->size); 409 dev_err(&kaweth->intf->dev, "Firmware too big: %zu\n",
410 fw->size);
409 release_firmware(fw); 411 release_firmware(fw);
410 return -ENOSPC; 412 return -ENOSPC;
411 } 413 }
@@ -501,9 +503,10 @@ static void kaweth_resubmit_int_urb(struct kaweth_device *kaweth, gfp_t mf)
501 } 503 }
502 504
503 if (status) 505 if (status)
504 err ("can't resubmit intr, %s-%s, status %d", 506 dev_err(&kaweth->intf->dev,
505 kaweth->dev->bus->bus_name, 507 "can't resubmit intr, %s-%s, status %d\n",
506 kaweth->dev->devpath, status); 508 kaweth->dev->bus->bus_name,
509 kaweth->dev->devpath, status);
507} 510}
508 511
509static void int_callback(struct urb *u) 512static void int_callback(struct urb *u)
@@ -576,7 +579,8 @@ static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth,
576 kaweth->suspend_lowmem_rx = 1; 579 kaweth->suspend_lowmem_rx = 1;
577 schedule_delayed_work(&kaweth->lowmem_work, HZ/4); 580 schedule_delayed_work(&kaweth->lowmem_work, HZ/4);
578 } 581 }
579 err("resubmitting rx_urb %d failed", result); 582 dev_err(&kaweth->intf->dev, "resubmitting rx_urb %d failed\n",
583 result);
580 } else { 584 } else {
581 kaweth->suspend_lowmem_rx = 0; 585 kaweth->suspend_lowmem_rx = 0;
582 } 586 }
@@ -634,20 +638,21 @@ static void kaweth_usb_receive(struct urb *urb)
634 spin_unlock(&kaweth->device_lock); 638 spin_unlock(&kaweth->device_lock);
635 639
636 if(status && status != -EREMOTEIO && count != 1) { 640 if(status && status != -EREMOTEIO && count != 1) {
637 err("%s RX status: %d count: %d packet_len: %d", 641 dev_err(&kaweth->intf->dev,
638 net->name, 642 "%s RX status: %d count: %d packet_len: %d\n",
639 status, 643 net->name, status, count, (int)pkt_len);
640 count,
641 (int)pkt_len);
642 kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC); 644 kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC);
643 return; 645 return;
644 } 646 }
645 647
646 if(kaweth->net && (count > 2)) { 648 if(kaweth->net && (count > 2)) {
647 if(pkt_len > (count - 2)) { 649 if(pkt_len > (count - 2)) {
648 err("Packet length too long for USB frame (pkt_len: %x, count: %x)",pkt_len, count); 650 dev_err(&kaweth->intf->dev,
649 err("Packet len & 2047: %x", pkt_len & 2047); 651 "Packet length too long for USB frame (pkt_len: %x, count: %x)\n",
650 err("Count 2: %x", count2); 652 pkt_len, count);
653 dev_err(&kaweth->intf->dev, "Packet len & 2047: %x\n",
654 pkt_len & 2047);
655 dev_err(&kaweth->intf->dev, "Count 2: %x\n", count2);
651 kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC); 656 kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC);
652 return; 657 return;
653 } 658 }
@@ -686,7 +691,7 @@ static int kaweth_open(struct net_device *net)
686 691
687 res = usb_autopm_get_interface(kaweth->intf); 692 res = usb_autopm_get_interface(kaweth->intf);
688 if (res) { 693 if (res) {
689 err("Interface cannot be resumed."); 694 dev_err(&kaweth->intf->dev, "Interface cannot be resumed.\n");
690 return -EIO; 695 return -EIO;
691 } 696 }
692 res = kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL); 697 res = kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL);
@@ -907,7 +912,8 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
907 KAWETH_CONTROL_TIMEOUT); 912 KAWETH_CONTROL_TIMEOUT);
908 913
909 if(result < 0) { 914 if(result < 0) {
910 err("Failed to set Rx mode: %d", result); 915 dev_err(&kaweth->intf->dev, "Failed to set Rx mode: %d\n",
916 result);
911 } 917 }
912 else { 918 else {
913 dbg("Set Rx mode to %d", packet_filter_bitmap); 919 dbg("Set Rx mode to %d", packet_filter_bitmap);
@@ -1045,7 +1051,8 @@ static int kaweth_probe(
1045 "kaweth/new_code.bin", 1051 "kaweth/new_code.bin",
1046 100, 1052 100,
1047 2)) < 0) { 1053 2)) < 0) {
1048 err("Error downloading firmware (%d)", result); 1054 dev_err(&intf->dev, "Error downloading firmware (%d)\n",
1055 result);
1049 goto err_fw; 1056 goto err_fw;
1050 } 1057 }
1051 1058
@@ -1053,7 +1060,9 @@ static int kaweth_probe(
1053 "kaweth/new_code_fix.bin", 1060 "kaweth/new_code_fix.bin",
1054 100, 1061 100,
1055 3)) < 0) { 1062 3)) < 0) {
1056 err("Error downloading firmware fix (%d)", result); 1063 dev_err(&intf->dev,
1064 "Error downloading firmware fix (%d)\n",
1065 result);
1057 goto err_fw; 1066 goto err_fw;
1058 } 1067 }
1059 1068
@@ -1061,7 +1070,9 @@ static int kaweth_probe(
1061 "kaweth/trigger_code.bin", 1070 "kaweth/trigger_code.bin",
1062 126, 1071 126,
1063 2)) < 0) { 1072 2)) < 0) {
1064 err("Error downloading trigger code (%d)", result); 1073 dev_err(&intf->dev,
1074 "Error downloading trigger code (%d)\n",
1075 result);
1065 goto err_fw; 1076 goto err_fw;
1066 1077
1067 } 1078 }
@@ -1070,13 +1081,14 @@ static int kaweth_probe(
1070 "kaweth/trigger_code_fix.bin", 1081 "kaweth/trigger_code_fix.bin",
1071 126, 1082 126,
1072 3)) < 0) { 1083 3)) < 0) {
1073 err("Error downloading trigger code fix (%d)", result); 1084 dev_err(&intf->dev, "Error downloading trigger code fix (%d)\n", result);
1074 goto err_fw; 1085 goto err_fw;
1075 } 1086 }
1076 1087
1077 1088
1078 if ((result = kaweth_trigger_firmware(kaweth, 126)) < 0) { 1089 if ((result = kaweth_trigger_firmware(kaweth, 126)) < 0) {
1079 err("Error triggering firmware (%d)", result); 1090 dev_err(&intf->dev, "Error triggering firmware (%d)\n",
1091 result);
1080 goto err_fw; 1092 goto err_fw;
1081 } 1093 }
1082 1094
@@ -1091,7 +1103,7 @@ err_fw:
1091 result = kaweth_read_configuration(kaweth); 1103 result = kaweth_read_configuration(kaweth);
1092 1104
1093 if(result < 0) { 1105 if(result < 0) {
1094 err("Error reading configuration (%d), no net device created", result); 1106 dev_err(&intf->dev, "Error reading configuration (%d), no net device created\n", result);
1095 goto err_free_netdev; 1107 goto err_free_netdev;
1096 } 1108 }
1097 1109
@@ -1103,7 +1115,7 @@ err_fw:
1103 if(!memcmp(&kaweth->configuration.hw_addr, 1115 if(!memcmp(&kaweth->configuration.hw_addr,
1104 &bcast_addr, 1116 &bcast_addr,
1105 sizeof(bcast_addr))) { 1117 sizeof(bcast_addr))) {
1106 err("Firmware not functioning properly, no net device created"); 1118 dev_err(&intf->dev, "Firmware not functioning properly, no net device created\n");
1107 goto err_free_netdev; 1119 goto err_free_netdev;
1108 } 1120 }
1109 1121
@@ -1113,7 +1125,7 @@ err_fw:
1113 } 1125 }
1114 1126
1115 if(kaweth_set_sofs_wait(kaweth, KAWETH_SOFS_TO_WAIT) < 0) { 1127 if(kaweth_set_sofs_wait(kaweth, KAWETH_SOFS_TO_WAIT) < 0) {
1116 err("Error setting SOFS wait"); 1128 dev_err(&intf->dev, "Error setting SOFS wait\n");
1117 goto err_free_netdev; 1129 goto err_free_netdev;
1118 } 1130 }
1119 1131
@@ -1123,7 +1135,7 @@ err_fw:
1123 KAWETH_PACKET_FILTER_MULTICAST); 1135 KAWETH_PACKET_FILTER_MULTICAST);
1124 1136
1125 if(result < 0) { 1137 if(result < 0) {
1126 err("Error setting receive filter"); 1138 dev_err(&intf->dev, "Error setting receive filter\n");
1127 goto err_free_netdev; 1139 goto err_free_netdev;
1128 } 1140 }
1129 1141
@@ -1175,7 +1187,7 @@ err_fw:
1175 1187
1176 SET_NETDEV_DEV(netdev, &intf->dev); 1188 SET_NETDEV_DEV(netdev, &intf->dev);
1177 if (register_netdev(netdev) != 0) { 1189 if (register_netdev(netdev) != 0) {
1178 err("Error registering netdev."); 1190 dev_err(&intf->dev, "Error registering netdev.\n");
1179 goto err_intfdata; 1191 goto err_intfdata;
1180 } 1192 }
1181 1193