aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/atm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/atm')
-rw-r--r--drivers/usb/atm/cxacru.c11
-rw-r--r--drivers/usb/atm/speedtch.c10
-rw-r--r--drivers/usb/atm/ueagle-atm.c5
-rw-r--r--drivers/usb/atm/usbatm.c23
-rw-r--r--drivers/usb/atm/usbatm.h22
-rw-r--r--drivers/usb/atm/xusbatm.c10
6 files changed, 40 insertions, 41 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 101ffc965ee0..593fc5e2d2e6 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -564,7 +564,7 @@ static void cxacru_timeout_kill(unsigned long data)
564} 564}
565 565
566static int cxacru_start_wait_urb(struct urb *urb, struct completion *done, 566static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
567 int* actual_length) 567 int *actual_length)
568{ 568{
569 struct timer_list timer; 569 struct timer_list timer;
570 570
@@ -952,7 +952,7 @@ static int cxacru_fw(struct usb_device *usb_dev, enum cxacru_fw_request fw,
952 put_unaligned(cpu_to_le32(addr), (__le32 *)(buf + offb)); 952 put_unaligned(cpu_to_le32(addr), (__le32 *)(buf + offb));
953 offb += 4; 953 offb += 4;
954 addr += l; 954 addr += l;
955 if(l) 955 if (l)
956 memcpy(buf + offb, data + offd, l); 956 memcpy(buf + offb, data + offd, l);
957 if (l < stride) 957 if (l < stride)
958 memset(buf + offb + l, 0, stride - l); 958 memset(buf + offb + l, 0, stride - l);
@@ -967,7 +967,7 @@ static int cxacru_fw(struct usb_device *usb_dev, enum cxacru_fw_request fw,
967 } 967 }
968 offb = 0; 968 offb = 0;
969 } 969 }
970 } while(offd < size); 970 } while (offd < size);
971 dbg("sent fw %#x", fw); 971 dbg("sent fw %#x", fw);
972 972
973 ret = 0; 973 ret = 0;
@@ -1043,8 +1043,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance,
1043 if (instance->modem_type->boot_rom_patch) { 1043 if (instance->modem_type->boot_rom_patch) {
1044 val = cpu_to_le32(BR_ADDR); 1044 val = cpu_to_le32(BR_ADDR);
1045 ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4); 1045 ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4);
1046 } 1046 } else {
1047 else {
1048 ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0); 1047 ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0);
1049 } 1048 }
1050 if (ret) { 1049 if (ret) {
@@ -1068,7 +1067,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance,
1068} 1067}
1069 1068
1070static int cxacru_find_firmware(struct cxacru_data *instance, 1069static int cxacru_find_firmware(struct cxacru_data *instance,
1071 char* phase, const struct firmware **fw_p) 1070 char *phase, const struct firmware **fw_p)
1072{ 1071{
1073 struct usbatm_data *usbatm = instance->usbatm; 1072 struct usbatm_data *usbatm = instance->usbatm;
1074 struct device *dev = &usbatm->usb_intf->dev; 1073 struct device *dev = &usbatm->usb_intf->dev;
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 80f9617d3a15..4716e707de59 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -753,11 +753,13 @@ static struct usb_driver speedtch_usb_driver = {
753 .id_table = speedtch_usb_ids 753 .id_table = speedtch_usb_ids
754}; 754};
755 755
756static void speedtch_release_interfaces(struct usb_device *usb_dev, int num_interfaces) { 756static void speedtch_release_interfaces(struct usb_device *usb_dev,
757 int num_interfaces)
758{
757 struct usb_interface *cur_intf; 759 struct usb_interface *cur_intf;
758 int i; 760 int i;
759 761
760 for(i = 0; i < num_interfaces; i++) 762 for (i = 0; i < num_interfaces; i++)
761 if ((cur_intf = usb_ifnum_to_if(usb_dev, i))) { 763 if ((cur_intf = usb_ifnum_to_if(usb_dev, i))) {
762 usb_set_intfdata(cur_intf, NULL); 764 usb_set_intfdata(cur_intf, NULL);
763 usb_driver_release_interface(&speedtch_usb_driver, cur_intf); 765 usb_driver_release_interface(&speedtch_usb_driver, cur_intf);
@@ -792,7 +794,7 @@ static int speedtch_bind(struct usbatm_data *usbatm,
792 794
793 /* claim all interfaces */ 795 /* claim all interfaces */
794 796
795 for (i=0; i < num_interfaces; i++) { 797 for (i = 0; i < num_interfaces; i++) {
796 cur_intf = usb_ifnum_to_if(usb_dev, i); 798 cur_intf = usb_ifnum_to_if(usb_dev, i);
797 799
798 if ((i != ifnum) && cur_intf) { 800 if ((i != ifnum) && cur_intf) {
@@ -842,7 +844,7 @@ static int speedtch_bind(struct usbatm_data *usbatm,
842 844
843 use_isoc = 0; /* fall back to bulk if endpoint not found */ 845 use_isoc = 0; /* fall back to bulk if endpoint not found */
844 846
845 for (i=0; i<desc->desc.bNumEndpoints; i++) { 847 for (i = 0; i < desc->desc.bNumEndpoints; i++) {
846 const struct usb_endpoint_descriptor *endpoint_desc = &desc->endpoint[i].desc; 848 const struct usb_endpoint_descriptor *endpoint_desc = &desc->endpoint[i].desc;
847 849
848 if ((endpoint_desc->bEndpointAddress == target_address)) { 850 if ((endpoint_desc->bEndpointAddress == target_address)) {
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index ebae94480140..5b3f555e01c9 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -67,6 +67,7 @@
67#include <linux/mutex.h> 67#include <linux/mutex.h>
68#include <linux/freezer.h> 68#include <linux/freezer.h>
69#include <linux/slab.h> 69#include <linux/slab.h>
70#include <linux/kernel.h>
70 71
71#include <asm/unaligned.h> 72#include <asm/unaligned.h>
72 73
@@ -2436,7 +2437,6 @@ UEA_ATTR(firmid, 0);
2436 2437
2437/* Retrieve the device End System Identifier (MAC) */ 2438/* Retrieve the device End System Identifier (MAC) */
2438 2439
2439#define htoi(x) (isdigit(x) ? x-'0' : toupper(x)-'A'+10)
2440static int uea_getesi(struct uea_softc *sc, u_char * esi) 2440static int uea_getesi(struct uea_softc *sc, u_char * esi)
2441{ 2441{
2442 unsigned char mac_str[2 * ETH_ALEN + 1]; 2442 unsigned char mac_str[2 * ETH_ALEN + 1];
@@ -2447,7 +2447,8 @@ static int uea_getesi(struct uea_softc *sc, u_char * esi)
2447 return 1; 2447 return 1;
2448 2448
2449 for (i = 0; i < ETH_ALEN; i++) 2449 for (i = 0; i < ETH_ALEN; i++)
2450 esi[i] = htoi(mac_str[2 * i]) * 16 + htoi(mac_str[2 * i + 1]); 2450 esi[i] = hex_to_bin(mac_str[2 * i]) * 16 +
2451 hex_to_bin(mac_str[2 * i + 1]);
2451 2452
2452 return 0; 2453 return 0;
2453} 2454}
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 9b53e8df4648..05bf5a27b5b0 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -84,8 +84,8 @@
84 84
85#ifdef VERBOSE_DEBUG 85#ifdef VERBOSE_DEBUG
86static int usbatm_print_packet(const unsigned char *data, int len); 86static int usbatm_print_packet(const unsigned char *data, int len);
87#define PACKETDEBUG(arg...) usbatm_print_packet (arg) 87#define PACKETDEBUG(arg...) usbatm_print_packet(arg)
88#define vdbg(arg...) dbg (arg) 88#define vdbg(arg...) dbg(arg)
89#else 89#else
90#define PACKETDEBUG(arg...) 90#define PACKETDEBUG(arg...)
91#define vdbg(arg...) 91#define vdbg(arg...)
@@ -273,8 +273,7 @@ static void usbatm_complete(struct urb *urb)
273 273
274 if (unlikely(status) && 274 if (unlikely(status) &&
275 (!(channel->usbatm->flags & UDSL_IGNORE_EILSEQ) || 275 (!(channel->usbatm->flags & UDSL_IGNORE_EILSEQ) ||
276 status != -EILSEQ )) 276 status != -EILSEQ)) {
277 {
278 if (status == -ESHUTDOWN) 277 if (status == -ESHUTDOWN)
279 return; 278 return;
280 279
@@ -494,7 +493,7 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance,
494 ptr += data_len; 493 ptr += data_len;
495 __skb_pull(skb, data_len); 494 __skb_pull(skb, data_len);
496 495
497 if(!left) 496 if (!left)
498 continue; 497 continue;
499 498
500 memset(ptr, 0, left); 499 memset(ptr, 0, left);
@@ -506,7 +505,7 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance,
506 trailer[2] = ctrl->len >> 8; 505 trailer[2] = ctrl->len >> 8;
507 trailer[3] = ctrl->len; 506 trailer[3] = ctrl->len;
508 507
509 ctrl->crc = ~ crc32_be(ctrl->crc, ptr, left - 4); 508 ctrl->crc = ~crc32_be(ctrl->crc, ptr, left - 4);
510 509
511 trailer[4] = ctrl->crc >> 24; 510 trailer[4] = ctrl->crc >> 24;
512 trailer[5] = ctrl->crc >> 16; 511 trailer[5] = ctrl->crc >> 16;
@@ -516,8 +515,7 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance,
516 target[3] |= 0x2; /* adjust PTI */ 515 target[3] |= 0x2; /* adjust PTI */
517 516
518 ctrl->len = 0; /* tag this skb finished */ 517 ctrl->len = 0; /* tag this skb finished */
519 } 518 } else
520 else
521 ctrl->crc = crc32_be(ctrl->crc, ptr, left); 519 ctrl->crc = crc32_be(ctrl->crc, ptr, left);
522 } 520 }
523 521
@@ -1146,7 +1144,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
1146 instance->tx_channel.endpoint = usb_sndbulkpipe(usb_dev, driver->bulk_out); 1144 instance->tx_channel.endpoint = usb_sndbulkpipe(usb_dev, driver->bulk_out);
1147 1145
1148 /* tx buffer size must be a positive multiple of the stride */ 1146 /* tx buffer size must be a positive multiple of the stride */
1149 instance->tx_channel.buf_size = max (instance->tx_channel.stride, 1147 instance->tx_channel.buf_size = max(instance->tx_channel.stride,
1150 snd_buf_bytes - (snd_buf_bytes % instance->tx_channel.stride)); 1148 snd_buf_bytes - (snd_buf_bytes % instance->tx_channel.stride));
1151 1149
1152 /* rx buffer size must be a positive multiple of the endpoint maxpacket */ 1150 /* rx buffer size must be a positive multiple of the endpoint maxpacket */
@@ -1159,7 +1157,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
1159 goto fail_unbind; 1157 goto fail_unbind;
1160 } 1158 }
1161 1159
1162 num_packets = max (1U, (rcv_buf_bytes + maxpacket / 2) / maxpacket); /* round */ 1160 num_packets = max(1U, (rcv_buf_bytes + maxpacket / 2) / maxpacket); /* round */
1163 1161
1164 if (num_packets * maxpacket > UDSL_MAX_BUF_SIZE) 1162 if (num_packets * maxpacket > UDSL_MAX_BUF_SIZE)
1165 num_packets--; 1163 num_packets--;
@@ -1262,7 +1260,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
1262 usb_free_urb(instance->urbs[i]); 1260 usb_free_urb(instance->urbs[i]);
1263 } 1261 }
1264 1262
1265 kfree (instance); 1263 kfree(instance);
1266 1264
1267 return error; 1265 return error;
1268} 1266}
@@ -1390,9 +1388,8 @@ static int usbatm_print_packet(const unsigned char *data, int len)
1390 for (i = 0; i < len;) { 1388 for (i = 0; i < len;) {
1391 buffer[0] = '\0'; 1389 buffer[0] = '\0';
1392 sprintf(buffer, "%.3d :", i); 1390 sprintf(buffer, "%.3d :", i);
1393 for (j = 0; (j < 16) && (i < len); j++, i++) { 1391 for (j = 0; (j < 16) && (i < len); j++, i++)
1394 sprintf(buffer, "%s %2.2x", buffer, data[i]); 1392 sprintf(buffer, "%s %2.2x", buffer, data[i]);
1395 }
1396 dbg("%s", buffer); 1393 dbg("%s", buffer);
1397 } 1394 }
1398 return i; 1395 return i;
diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h
index 0863f85fcc26..5fc489405217 100644
--- a/drivers/usb/atm/usbatm.h
+++ b/drivers/usb/atm/usbatm.h
@@ -48,7 +48,7 @@
48 dev_warn(&(instance)->usb_intf->dev, \ 48 dev_warn(&(instance)->usb_intf->dev, \
49 "failed assertion '%s' at line %d", \ 49 "failed assertion '%s' at line %d", \
50 __stringify(x), __LINE__); \ 50 __stringify(x), __LINE__); \
51 } while(0) 51 } while (0)
52#endif 52#endif
53 53
54#define usb_err(instance, format, arg...) \ 54#define usb_err(instance, format, arg...) \
@@ -59,7 +59,7 @@
59 dev_warn(&(instance)->usb_intf->dev , format , ## arg) 59 dev_warn(&(instance)->usb_intf->dev , format , ## arg)
60#ifdef DEBUG 60#ifdef DEBUG
61#define usb_dbg(instance, format, arg...) \ 61#define usb_dbg(instance, format, arg...) \
62 dev_printk(KERN_DEBUG , &(instance)->usb_intf->dev , format , ## arg) 62 dev_printk(KERN_DEBUG , &(instance)->usb_intf->dev , format , ## arg)
63#else 63#else
64#define usb_dbg(instance, format, arg...) \ 64#define usb_dbg(instance, format, arg...) \
65 do {} while (0) 65 do {} while (0)
@@ -104,21 +104,21 @@ struct usbatm_data;
104/* 104/*
105* Assuming all methods exist and succeed, they are called in this order: 105* Assuming all methods exist and succeed, they are called in this order:
106* 106*
107* bind, heavy_init, atm_start, ..., atm_stop, unbind 107* bind, heavy_init, atm_start, ..., atm_stop, unbind
108*/ 108*/
109 109
110struct usbatm_driver { 110struct usbatm_driver {
111 const char *driver_name; 111 const char *driver_name;
112 112
113 /* init device ... can sleep, or cause probe() failure */ 113 /* init device ... can sleep, or cause probe() failure */
114 int (*bind) (struct usbatm_data *, struct usb_interface *, 114 int (*bind) (struct usbatm_data *, struct usb_interface *,
115 const struct usb_device_id *id); 115 const struct usb_device_id *id);
116 116
117 /* additional device initialization that is too slow to be done in probe() */ 117 /* additional device initialization that is too slow to be done in probe() */
118 int (*heavy_init) (struct usbatm_data *, struct usb_interface *); 118 int (*heavy_init) (struct usbatm_data *, struct usb_interface *);
119 119
120 /* cleanup device ... can sleep, but can't fail */ 120 /* cleanup device ... can sleep, but can't fail */
121 void (*unbind) (struct usbatm_data *, struct usb_interface *); 121 void (*unbind) (struct usbatm_data *, struct usb_interface *);
122 122
123 /* init ATM device ... can sleep, or cause ATM initialization failure */ 123 /* init ATM device ... can sleep, or cause ATM initialization failure */
124 int (*atm_start) (struct usbatm_data *, struct atm_dev *); 124 int (*atm_start) (struct usbatm_data *, struct atm_dev *);
@@ -126,9 +126,9 @@ struct usbatm_driver {
126 /* cleanup ATM device ... can sleep, but can't fail */ 126 /* cleanup ATM device ... can sleep, but can't fail */
127 void (*atm_stop) (struct usbatm_data *, struct atm_dev *); 127 void (*atm_stop) (struct usbatm_data *, struct atm_dev *);
128 128
129 int bulk_in; /* bulk rx endpoint */ 129 int bulk_in; /* bulk rx endpoint */
130 int isoc_in; /* isochronous rx endpoint */ 130 int isoc_in; /* isochronous rx endpoint */
131 int bulk_out; /* bulk tx endpoint */ 131 int bulk_out; /* bulk tx endpoint */
132 132
133 unsigned rx_padding; 133 unsigned rx_padding;
134 unsigned tx_padding; 134 unsigned tx_padding;
@@ -156,7 +156,7 @@ struct usbatm_channel {
156struct usbatm_data { 156struct usbatm_data {
157 /****************** 157 /******************
158 * public fields * 158 * public fields *
159 ******************/ 159 ******************/
160 160
161 /* mini driver */ 161 /* mini driver */
162 struct usbatm_driver *driver; 162 struct usbatm_driver *driver;
@@ -174,7 +174,7 @@ struct usbatm_data {
174 174
175 /******************************** 175 /********************************
176 * private fields - do not use * 176 * private fields - do not use *
177 ********************************/ 177 ********************************/
178 178
179 struct kref refcount; 179 struct kref refcount;
180 struct mutex serialize; 180 struct mutex serialize;
diff --git a/drivers/usb/atm/xusbatm.c b/drivers/usb/atm/xusbatm.c
index 17d167bbd2dc..48ee0c5ff282 100644
--- a/drivers/usb/atm/xusbatm.c
+++ b/drivers/usb/atm/xusbatm.c
@@ -49,13 +49,13 @@ static struct usbatm_driver xusbatm_drivers[XUSBATM_DRIVERS_MAX];
49static struct usb_device_id xusbatm_usb_ids[XUSBATM_DRIVERS_MAX + 1]; 49static struct usb_device_id xusbatm_usb_ids[XUSBATM_DRIVERS_MAX + 1];
50static struct usb_driver xusbatm_usb_driver; 50static struct usb_driver xusbatm_usb_driver;
51 51
52static struct usb_interface *xusbatm_find_intf (struct usb_device *usb_dev, int altsetting, u8 ep) 52static struct usb_interface *xusbatm_find_intf(struct usb_device *usb_dev, int altsetting, u8 ep)
53{ 53{
54 struct usb_host_interface *alt; 54 struct usb_host_interface *alt;
55 struct usb_interface *intf; 55 struct usb_interface *intf;
56 int i, j; 56 int i, j;
57 57
58 for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) 58 for (i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++)
59 if ((intf = usb_dev->actconfig->interface[i]) && (alt = usb_altnum_to_altsetting(intf, altsetting))) 59 if ((intf = usb_dev->actconfig->interface[i]) && (alt = usb_altnum_to_altsetting(intf, altsetting)))
60 for (j = 0; j < alt->desc.bNumEndpoints; j++) 60 for (j = 0; j < alt->desc.bNumEndpoints; j++)
61 if (alt->endpoint[j].desc.bEndpointAddress == ep) 61 if (alt->endpoint[j].desc.bEndpointAddress == ep)
@@ -63,7 +63,7 @@ static struct usb_interface *xusbatm_find_intf (struct usb_device *usb_dev, int
63 return NULL; 63 return NULL;
64} 64}
65 65
66static int xusbatm_capture_intf (struct usbatm_data *usbatm, struct usb_device *usb_dev, 66static int xusbatm_capture_intf(struct usbatm_data *usbatm, struct usb_device *usb_dev,
67 struct usb_interface *intf, int altsetting, int claim) 67 struct usb_interface *intf, int altsetting, int claim)
68{ 68{
69 int ifnum = intf->altsetting->desc.bInterfaceNumber; 69 int ifnum = intf->altsetting->desc.bInterfaceNumber;
@@ -80,7 +80,7 @@ static int xusbatm_capture_intf (struct usbatm_data *usbatm, struct usb_device *
80 return 0; 80 return 0;
81} 81}
82 82
83static void xusbatm_release_intf (struct usb_device *usb_dev, struct usb_interface *intf, int claimed) 83static void xusbatm_release_intf(struct usb_device *usb_dev, struct usb_interface *intf, int claimed)
84{ 84{
85 if (claimed) { 85 if (claimed) {
86 usb_set_intfdata(intf, NULL); 86 usb_set_intfdata(intf, NULL);
@@ -147,7 +147,7 @@ static void xusbatm_unbind(struct usbatm_data *usbatm,
147 147
148 usb_dbg(usbatm, "%s entered\n", __func__); 148 usb_dbg(usbatm, "%s entered\n", __func__);
149 149
150 for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) { 150 for (i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) {
151 struct usb_interface *cur_intf = usb_dev->actconfig->interface[i]; 151 struct usb_interface *cur_intf = usb_dev->actconfig->interface[i];
152 152
153 if (cur_intf && (usb_get_intfdata(cur_intf) == usbatm)) { 153 if (cur_intf && (usb_get_intfdata(cur_intf) == usbatm)) {