diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org.(none)> | 2005-04-19 10:28:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org.(none)> | 2005-04-19 10:28:57 -0400 |
commit | a9e4820c4c170b3df0d2185f7b4130b0b2daed2c (patch) | |
tree | 962bc52ba0e8e585d88e1fb9a9be9a67072767dd /drivers/usb | |
parent | c0698f2f6e4839ce9463ce731c892993215ea067 (diff) | |
parent | e838a0d4d5260bce452c96914a6e86b217c53c55 (diff) |
Merge with Greg's USB tree at kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6.git/
Yah, it does work to merge. Knock wood.
Diffstat (limited to 'drivers/usb')
59 files changed, 462 insertions, 418 deletions
diff --git a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c index f432b7d5b235..f8f21567cc22 100644 --- a/drivers/usb/class/audio.c +++ b/drivers/usb/class/audio.c | |||
@@ -649,14 +649,10 @@ static void usbin_stop(struct usb_audiodev *as) | |||
649 | } | 649 | } |
650 | } | 650 | } |
651 | set_current_state(TASK_RUNNING); | 651 | set_current_state(TASK_RUNNING); |
652 | if (u->durb[0].urb->transfer_buffer) | 652 | kfree(u->durb[0].urb->transfer_buffer); |
653 | kfree(u->durb[0].urb->transfer_buffer); | 653 | kfree(u->durb[1].urb->transfer_buffer); |
654 | if (u->durb[1].urb->transfer_buffer) | 654 | kfree(u->surb[0].urb->transfer_buffer); |
655 | kfree(u->durb[1].urb->transfer_buffer); | 655 | kfree(u->surb[1].urb->transfer_buffer); |
656 | if (u->surb[0].urb->transfer_buffer) | ||
657 | kfree(u->surb[0].urb->transfer_buffer); | ||
658 | if (u->surb[1].urb->transfer_buffer) | ||
659 | kfree(u->surb[1].urb->transfer_buffer); | ||
660 | u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = | 656 | u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = |
661 | u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; | 657 | u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; |
662 | } | 658 | } |
@@ -1009,21 +1005,17 @@ static int usbin_start(struct usb_audiodev *as) | |||
1009 | u->phase = 0; | 1005 | u->phase = 0; |
1010 | maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); | 1006 | maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); |
1011 | bufsz = DESCFRAMES * maxsze; | 1007 | bufsz = DESCFRAMES * maxsze; |
1012 | if (u->durb[0].urb->transfer_buffer) | 1008 | kfree(u->durb[0].urb->transfer_buffer); |
1013 | kfree(u->durb[0].urb->transfer_buffer); | ||
1014 | u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); | 1009 | u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); |
1015 | u->durb[0].urb->transfer_buffer_length = bufsz; | 1010 | u->durb[0].urb->transfer_buffer_length = bufsz; |
1016 | if (u->durb[1].urb->transfer_buffer) | 1011 | kfree(u->durb[1].urb->transfer_buffer); |
1017 | kfree(u->durb[1].urb->transfer_buffer); | ||
1018 | u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); | 1012 | u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); |
1019 | u->durb[1].urb->transfer_buffer_length = bufsz; | 1013 | u->durb[1].urb->transfer_buffer_length = bufsz; |
1020 | if (u->syncpipe) { | 1014 | if (u->syncpipe) { |
1021 | if (u->surb[0].urb->transfer_buffer) | 1015 | kfree(u->surb[0].urb->transfer_buffer); |
1022 | kfree(u->surb[0].urb->transfer_buffer); | ||
1023 | u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); | 1016 | u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); |
1024 | u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; | 1017 | u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; |
1025 | if (u->surb[1].urb->transfer_buffer) | 1018 | kfree(u->surb[1].urb->transfer_buffer); |
1026 | kfree(u->surb[1].urb->transfer_buffer); | ||
1027 | u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); | 1019 | u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); |
1028 | u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; | 1020 | u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; |
1029 | } | 1021 | } |
@@ -1128,14 +1120,10 @@ static void usbout_stop(struct usb_audiodev *as) | |||
1128 | } | 1120 | } |
1129 | } | 1121 | } |
1130 | set_current_state(TASK_RUNNING); | 1122 | set_current_state(TASK_RUNNING); |
1131 | if (u->durb[0].urb->transfer_buffer) | 1123 | kfree(u->durb[0].urb->transfer_buffer); |
1132 | kfree(u->durb[0].urb->transfer_buffer); | 1124 | kfree(u->durb[1].urb->transfer_buffer); |
1133 | if (u->durb[1].urb->transfer_buffer) | 1125 | kfree(u->surb[0].urb->transfer_buffer); |
1134 | kfree(u->durb[1].urb->transfer_buffer); | 1126 | kfree(u->surb[1].urb->transfer_buffer); |
1135 | if (u->surb[0].urb->transfer_buffer) | ||
1136 | kfree(u->surb[0].urb->transfer_buffer); | ||
1137 | if (u->surb[1].urb->transfer_buffer) | ||
1138 | kfree(u->surb[1].urb->transfer_buffer); | ||
1139 | u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = | 1127 | u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = |
1140 | u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; | 1128 | u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; |
1141 | } | 1129 | } |
@@ -1376,21 +1364,17 @@ static int usbout_start(struct usb_audiodev *as) | |||
1376 | u->phase = 0; | 1364 | u->phase = 0; |
1377 | maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); | 1365 | maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); |
1378 | bufsz = DESCFRAMES * maxsze; | 1366 | bufsz = DESCFRAMES * maxsze; |
1379 | if (u->durb[0].urb->transfer_buffer) | 1367 | kfree(u->durb[0].urb->transfer_buffer); |
1380 | kfree(u->durb[0].urb->transfer_buffer); | ||
1381 | u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); | 1368 | u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); |
1382 | u->durb[0].urb->transfer_buffer_length = bufsz; | 1369 | u->durb[0].urb->transfer_buffer_length = bufsz; |
1383 | if (u->durb[1].urb->transfer_buffer) | 1370 | kfree(u->durb[1].urb->transfer_buffer); |
1384 | kfree(u->durb[1].urb->transfer_buffer); | ||
1385 | u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); | 1371 | u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); |
1386 | u->durb[1].urb->transfer_buffer_length = bufsz; | 1372 | u->durb[1].urb->transfer_buffer_length = bufsz; |
1387 | if (u->syncpipe) { | 1373 | if (u->syncpipe) { |
1388 | if (u->surb[0].urb->transfer_buffer) | 1374 | kfree(u->surb[0].urb->transfer_buffer); |
1389 | kfree(u->surb[0].urb->transfer_buffer); | ||
1390 | u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); | 1375 | u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); |
1391 | u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; | 1376 | u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; |
1392 | if (u->surb[1].urb->transfer_buffer) | 1377 | kfree(u->surb[1].urb->transfer_buffer); |
1393 | kfree(u->surb[1].urb->transfer_buffer); | ||
1394 | u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); | 1378 | u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); |
1395 | u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; | 1379 | u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; |
1396 | } | 1380 | } |
diff --git a/drivers/usb/class/bluetty.c b/drivers/usb/class/bluetty.c index 6bac65e0ade7..524023327c49 100644 --- a/drivers/usb/class/bluetty.c +++ b/drivers/usb/class/bluetty.c | |||
@@ -309,7 +309,7 @@ static int bluetooth_ctrl_msg (struct usb_bluetooth *bluetooth, int request, int | |||
309 | } | 309 | } |
310 | } | 310 | } |
311 | if (urb->transfer_buffer_length < len) { | 311 | if (urb->transfer_buffer_length < len) { |
312 | kfree (urb->transfer_buffer); | 312 | kfree(urb->transfer_buffer); |
313 | urb->transfer_buffer = kmalloc (len, GFP_KERNEL); | 313 | urb->transfer_buffer = kmalloc (len, GFP_KERNEL); |
314 | if (urb->transfer_buffer == NULL) { | 314 | if (urb->transfer_buffer == NULL) { |
315 | err ("%s - out of memory", __FUNCTION__); | 315 | err ("%s - out of memory", __FUNCTION__); |
@@ -535,7 +535,7 @@ static int bluetooth_write (struct tty_struct * tty, const unsigned char *buf, i | |||
535 | } | 535 | } |
536 | 536 | ||
537 | exit: | 537 | exit: |
538 | kfree (temp_buffer); | 538 | kfree(temp_buffer); |
539 | 539 | ||
540 | return retval; | 540 | return retval; |
541 | } | 541 | } |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 0b092bdf98f3..99595e07b653 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -10,7 +10,8 @@ | |||
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
11 | #include <linux/device.h> | 11 | #include <linux/device.h> |
12 | #include <asm/byteorder.h> | 12 | #include <asm/byteorder.h> |
13 | 13 | #include "usb.h" | |
14 | #include "hcd.h" | ||
14 | 15 | ||
15 | #define USB_MAXALTSETTING 128 /* Hard limit */ | 16 | #define USB_MAXALTSETTING 128 /* Hard limit */ |
16 | #define USB_MAXENDPOINTS 30 /* Hard limit */ | 17 | #define USB_MAXENDPOINTS 30 /* Hard limit */ |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 8b61bcd742ca..ef0b35731ff0 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <linux/usbdevice_fs.h> | 59 | #include <linux/usbdevice_fs.h> |
60 | #include <asm/uaccess.h> | 60 | #include <asm/uaccess.h> |
61 | 61 | ||
62 | #include "usb.h" | ||
62 | #include "hcd.h" | 63 | #include "hcd.h" |
63 | 64 | ||
64 | #define MAX_TOPO_LEVEL 6 | 65 | #define MAX_TOPO_LEVEL 6 |
@@ -636,11 +637,8 @@ static int usb_device_open(struct inode *inode, struct file *file) | |||
636 | 637 | ||
637 | static int usb_device_release(struct inode *inode, struct file *file) | 638 | static int usb_device_release(struct inode *inode, struct file *file) |
638 | { | 639 | { |
639 | if (file->private_data) { | 640 | kfree(file->private_data); |
640 | kfree(file->private_data); | 641 | file->private_data = NULL; |
641 | file->private_data = NULL; | ||
642 | } | ||
643 | |||
644 | return 0; | 642 | return 0; |
645 | } | 643 | } |
646 | 644 | ||
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index a047bc392983..6bfab4bcaa9e 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -213,12 +213,10 @@ static struct async *alloc_async(unsigned int numisoframes) | |||
213 | 213 | ||
214 | static void free_async(struct async *as) | 214 | static void free_async(struct async *as) |
215 | { | 215 | { |
216 | if (as->urb->transfer_buffer) | 216 | kfree(as->urb->transfer_buffer); |
217 | kfree(as->urb->transfer_buffer); | 217 | kfree(as->urb->setup_packet); |
218 | if (as->urb->setup_packet) | ||
219 | kfree(as->urb->setup_packet); | ||
220 | usb_free_urb(as->urb); | 218 | usb_free_urb(as->urb); |
221 | kfree(as); | 219 | kfree(as); |
222 | } | 220 | } |
223 | 221 | ||
224 | static inline void async_newpending(struct async *as) | 222 | static inline void async_newpending(struct async *as) |
@@ -938,17 +936,13 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
938 | return -EINVAL; | 936 | return -EINVAL; |
939 | } | 937 | } |
940 | if (!(as = alloc_async(uurb->number_of_packets))) { | 938 | if (!(as = alloc_async(uurb->number_of_packets))) { |
941 | if (isopkt) | 939 | kfree(isopkt); |
942 | kfree(isopkt); | 940 | kfree(dr); |
943 | if (dr) | ||
944 | kfree(dr); | ||
945 | return -ENOMEM; | 941 | return -ENOMEM; |
946 | } | 942 | } |
947 | if (!(as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL))) { | 943 | if (!(as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL))) { |
948 | if (isopkt) | 944 | kfree(isopkt); |
949 | kfree(isopkt); | 945 | kfree(dr); |
950 | if (dr) | ||
951 | kfree(dr); | ||
952 | free_async(as); | 946 | free_async(as); |
953 | return -ENOMEM; | 947 | return -ENOMEM; |
954 | } | 948 | } |
@@ -967,8 +961,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
967 | as->urb->iso_frame_desc[u].length = isopkt[u].length; | 961 | as->urb->iso_frame_desc[u].length = isopkt[u].length; |
968 | totlen += isopkt[u].length; | 962 | totlen += isopkt[u].length; |
969 | } | 963 | } |
970 | if (isopkt) | 964 | kfree(isopkt); |
971 | kfree(isopkt); | ||
972 | as->ps = ps; | 965 | as->ps = ps; |
973 | as->userurb = arg; | 966 | as->userurb = arg; |
974 | if (uurb->endpoint & USB_DIR_IN) | 967 | if (uurb->endpoint & USB_DIR_IN) |
@@ -1032,15 +1025,15 @@ static int processcompl(struct async *as, void __user * __user *arg) | |||
1032 | if (put_user(urb->error_count, &userurb->error_count)) | 1025 | if (put_user(urb->error_count, &userurb->error_count)) |
1033 | return -EFAULT; | 1026 | return -EFAULT; |
1034 | 1027 | ||
1035 | if (!(usb_pipeisoc(urb->pipe))) | 1028 | if (usb_pipeisoc(urb->pipe)) { |
1036 | return 0; | 1029 | for (i = 0; i < urb->number_of_packets; i++) { |
1037 | for (i = 0; i < urb->number_of_packets; i++) { | 1030 | if (put_user(urb->iso_frame_desc[i].actual_length, |
1038 | if (put_user(urb->iso_frame_desc[i].actual_length, | 1031 | &userurb->iso_frame_desc[i].actual_length)) |
1039 | &userurb->iso_frame_desc[i].actual_length)) | 1032 | return -EFAULT; |
1040 | return -EFAULT; | 1033 | if (put_user(urb->iso_frame_desc[i].status, |
1041 | if (put_user(urb->iso_frame_desc[i].status, | 1034 | &userurb->iso_frame_desc[i].status)) |
1042 | &userurb->iso_frame_desc[i].status)) | 1035 | return -EFAULT; |
1043 | return -EFAULT; | 1036 | } |
1044 | } | 1037 | } |
1045 | 1038 | ||
1046 | free_async(as); | 1039 | free_async(as); |
@@ -1126,7 +1119,7 @@ static int proc_submiturb_compat(struct dev_state *ps, void __user *arg) | |||
1126 | if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg)) | 1119 | if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg)) |
1127 | return -EFAULT; | 1120 | return -EFAULT; |
1128 | 1121 | ||
1129 | return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb __user *)arg)->iso_frame_desc, arg); | 1122 | return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, arg); |
1130 | } | 1123 | } |
1131 | 1124 | ||
1132 | static int processcompl_compat(struct async *as, void __user * __user *arg) | 1125 | static int processcompl_compat(struct async *as, void __user * __user *arg) |
@@ -1146,15 +1139,15 @@ static int processcompl_compat(struct async *as, void __user * __user *arg) | |||
1146 | if (put_user(urb->error_count, &userurb->error_count)) | 1139 | if (put_user(urb->error_count, &userurb->error_count)) |
1147 | return -EFAULT; | 1140 | return -EFAULT; |
1148 | 1141 | ||
1149 | if (!(usb_pipeisoc(urb->pipe))) | 1142 | if (usb_pipeisoc(urb->pipe)) { |
1150 | return 0; | 1143 | for (i = 0; i < urb->number_of_packets; i++) { |
1151 | for (i = 0; i < urb->number_of_packets; i++) { | 1144 | if (put_user(urb->iso_frame_desc[i].actual_length, |
1152 | if (put_user(urb->iso_frame_desc[i].actual_length, | 1145 | &userurb->iso_frame_desc[i].actual_length)) |
1153 | &userurb->iso_frame_desc[i].actual_length)) | 1146 | return -EFAULT; |
1154 | return -EFAULT; | 1147 | if (put_user(urb->iso_frame_desc[i].status, |
1155 | if (put_user(urb->iso_frame_desc[i].status, | 1148 | &userurb->iso_frame_desc[i].status)) |
1156 | &userurb->iso_frame_desc[i].status)) | 1149 | return -EFAULT; |
1157 | return -EFAULT; | 1150 | } |
1158 | } | 1151 | } |
1159 | 1152 | ||
1160 | free_async(as); | 1153 | free_async(as); |
@@ -1177,10 +1170,8 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg) | |||
1177 | { | 1170 | { |
1178 | struct async *as; | 1171 | struct async *as; |
1179 | 1172 | ||
1180 | printk("reapurbnblock\n"); | ||
1181 | if (!(as = async_getcompleted(ps))) | 1173 | if (!(as = async_getcompleted(ps))) |
1182 | return -EAGAIN; | 1174 | return -EAGAIN; |
1183 | printk("reap got as %p\n", as); | ||
1184 | return processcompl_compat(as, (void __user * __user *)arg); | 1175 | return processcompl_compat(as, (void __user * __user *)arg); |
1185 | } | 1176 | } |
1186 | 1177 | ||
@@ -1239,7 +1230,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg) | |||
1239 | return -ENOMEM; | 1230 | return -ENOMEM; |
1240 | if ((_IOC_DIR(ctrl.ioctl_code) & _IOC_WRITE)) { | 1231 | if ((_IOC_DIR(ctrl.ioctl_code) & _IOC_WRITE)) { |
1241 | if (copy_from_user (buf, ctrl.data, size)) { | 1232 | if (copy_from_user (buf, ctrl.data, size)) { |
1242 | kfree (buf); | 1233 | kfree(buf); |
1243 | return -EFAULT; | 1234 | return -EFAULT; |
1244 | } | 1235 | } |
1245 | } else { | 1236 | } else { |
@@ -1248,8 +1239,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg) | |||
1248 | } | 1239 | } |
1249 | 1240 | ||
1250 | if (!connected(ps->dev)) { | 1241 | if (!connected(ps->dev)) { |
1251 | if (buf) | 1242 | kfree(buf); |
1252 | kfree(buf); | ||
1253 | return -ENODEV; | 1243 | return -ENODEV; |
1254 | } | 1244 | } |
1255 | 1245 | ||
@@ -1311,8 +1301,8 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg) | |||
1311 | && size > 0 | 1301 | && size > 0 |
1312 | && copy_to_user (ctrl.data, buf, size) != 0) | 1302 | && copy_to_user (ctrl.data, buf, size) != 0) |
1313 | retval = -EFAULT; | 1303 | retval = -EFAULT; |
1314 | if (buf != NULL) | 1304 | |
1315 | kfree (buf); | 1305 | kfree(buf); |
1316 | return retval; | 1306 | return retval; |
1317 | } | 1307 | } |
1318 | 1308 | ||
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 80ce9644d0ee..38ed2220c9fc 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #endif | 28 | #endif |
29 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
30 | 30 | ||
31 | #include "usb.h" | ||
32 | |||
31 | #define MAX_USB_MINORS 256 | 33 | #define MAX_USB_MINORS 256 |
32 | static struct file_operations *usb_minors[MAX_USB_MINORS]; | 34 | static struct file_operations *usb_minors[MAX_USB_MINORS]; |
33 | static DEFINE_SPINLOCK(minor_lock); | 35 | static DEFINE_SPINLOCK(minor_lock); |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index b9a3dae07036..71b4a8d66318 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "hcd.h" | 33 | #include "hcd.h" |
34 | 34 | ||
35 | 35 | ||
36 | /* PCI-based HCs are normal, but custom bus glue should be ok */ | 36 | /* PCI-based HCs are common, but plenty of non-PCI HCs are used too */ |
37 | 37 | ||
38 | 38 | ||
39 | /*-------------------------------------------------------------------------*/ | 39 | /*-------------------------------------------------------------------------*/ |
@@ -67,8 +67,8 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
67 | 67 | ||
68 | if (pci_enable_device (dev) < 0) | 68 | if (pci_enable_device (dev) < 0) |
69 | return -ENODEV; | 69 | return -ENODEV; |
70 | dev->current_state = 0; | 70 | dev->current_state = PCI_D0; |
71 | dev->dev.power.power_state = 0; | 71 | dev->dev.power.power_state = PMSG_ON; |
72 | 72 | ||
73 | if (!dev->irq) { | 73 | if (!dev->irq) { |
74 | dev_err (&dev->dev, | 74 | dev_err (&dev->dev, |
@@ -186,26 +186,14 @@ EXPORT_SYMBOL (usb_hcd_pci_remove); | |||
186 | 186 | ||
187 | #ifdef CONFIG_PM | 187 | #ifdef CONFIG_PM |
188 | 188 | ||
189 | static char __attribute_used__ *pci_state(u32 state) | ||
190 | { | ||
191 | switch (state) { | ||
192 | case 0: return "D0"; | ||
193 | case 1: return "D1"; | ||
194 | case 2: return "D2"; | ||
195 | case 3: return "D3hot"; | ||
196 | case 4: return "D3cold"; | ||
197 | } | ||
198 | return NULL; | ||
199 | } | ||
200 | |||
201 | /** | 189 | /** |
202 | * usb_hcd_pci_suspend - power management suspend of a PCI-based HCD | 190 | * usb_hcd_pci_suspend - power management suspend of a PCI-based HCD |
203 | * @dev: USB Host Controller being suspended | 191 | * @dev: USB Host Controller being suspended |
204 | * @state: state that the controller is going into | 192 | * @message: semantics in flux |
205 | * | 193 | * |
206 | * Store this function in the HCD's struct pci_driver as suspend(). | 194 | * Store this function in the HCD's struct pci_driver as suspend(). |
207 | */ | 195 | */ |
208 | int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state) | 196 | int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) |
209 | { | 197 | { |
210 | struct usb_hcd *hcd; | 198 | struct usb_hcd *hcd; |
211 | int retval = 0; | 199 | int retval = 0; |
@@ -213,13 +201,23 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state) | |||
213 | 201 | ||
214 | hcd = pci_get_drvdata(dev); | 202 | hcd = pci_get_drvdata(dev); |
215 | 203 | ||
204 | /* FIXME until the generic PM interfaces change a lot more, this | ||
205 | * can't use PCI D1 and D2 states. For example, the confusion | ||
206 | * between messages and states will need to vanish, and messages | ||
207 | * will need to provide a target system state again. | ||
208 | * | ||
209 | * It'll be important to learn characteristics of the target state, | ||
210 | * especially on embedded hardware where the HCD will often be in | ||
211 | * charge of an external VBUS power supply and one or more clocks. | ||
212 | * Some target system states will leave them active; others won't. | ||
213 | * (With PCI, that's often handled by platform BIOS code.) | ||
214 | */ | ||
215 | |||
216 | /* even when the PCI layer rejects some of the PCI calls | 216 | /* even when the PCI layer rejects some of the PCI calls |
217 | * below, HCs can try global suspend and reduce DMA traffic. | 217 | * below, HCs can try global suspend and reduce DMA traffic. |
218 | * PM-sensitive HCDs may already have done this. | 218 | * PM-sensitive HCDs may already have done this. |
219 | */ | 219 | */ |
220 | has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM); | 220 | has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM); |
221 | if (state > 4) | ||
222 | state = 4; | ||
223 | 221 | ||
224 | switch (hcd->state) { | 222 | switch (hcd->state) { |
225 | 223 | ||
@@ -228,7 +226,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state) | |||
228 | */ | 226 | */ |
229 | case HC_STATE_RUNNING: | 227 | case HC_STATE_RUNNING: |
230 | hcd->state = HC_STATE_QUIESCING; | 228 | hcd->state = HC_STATE_QUIESCING; |
231 | retval = hcd->driver->suspend (hcd, state); | 229 | retval = hcd->driver->suspend (hcd, message); |
232 | if (retval) { | 230 | if (retval) { |
233 | dev_dbg (hcd->self.controller, | 231 | dev_dbg (hcd->self.controller, |
234 | "suspend fail, retval %d\n", | 232 | "suspend fail, retval %d\n", |
@@ -246,14 +244,11 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state) | |||
246 | * have been called, otherwise root hub timers still run ... | 244 | * have been called, otherwise root hub timers still run ... |
247 | */ | 245 | */ |
248 | case HC_STATE_SUSPENDED: | 246 | case HC_STATE_SUSPENDED: |
249 | if (state <= dev->current_state) | 247 | /* no DMA or IRQs except when HC is active */ |
250 | break; | 248 | if (dev->current_state == PCI_D0) { |
251 | 249 | free_irq (hcd->irq, hcd); | |
252 | /* no DMA or IRQs except in D0 */ | ||
253 | if (!dev->current_state) { | ||
254 | pci_save_state (dev); | 250 | pci_save_state (dev); |
255 | pci_disable_device (dev); | 251 | pci_disable_device (dev); |
256 | free_irq (hcd->irq, hcd); | ||
257 | } | 252 | } |
258 | 253 | ||
259 | if (!has_pci_pm) { | 254 | if (!has_pci_pm) { |
@@ -261,25 +256,19 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state) | |||
261 | break; | 256 | break; |
262 | } | 257 | } |
263 | 258 | ||
264 | /* POLICY: ignore D1/D2/D3hot differences; | 259 | /* NOTE: dev->current_state becomes nonzero only here, and |
265 | * we know D3hot will always work. | 260 | * only for devices that support PCI PM. Also, exiting |
261 | * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset | ||
262 | * some device state (e.g. as part of clock reinit). | ||
266 | */ | 263 | */ |
267 | retval = pci_set_power_state (dev, state); | 264 | retval = pci_set_power_state (dev, PCI_D3hot); |
268 | if (retval < 0 && state < 3) { | ||
269 | retval = pci_set_power_state (dev, 3); | ||
270 | if (retval == 0) | ||
271 | state = 3; | ||
272 | } | ||
273 | if (retval == 0) { | 265 | if (retval == 0) { |
274 | dev_dbg (hcd->self.controller, "--> PCI %s\n", | 266 | dev_dbg (hcd->self.controller, "--> PCI D3\n"); |
275 | pci_state(dev->current_state)); | 267 | pci_enable_wake (dev, PCI_D3hot, hcd->remote_wakeup); |
276 | #ifdef CONFIG_USB_SUSPEND | 268 | pci_enable_wake (dev, PCI_D3cold, hcd->remote_wakeup); |
277 | pci_enable_wake (dev, state, hcd->remote_wakeup); | ||
278 | pci_enable_wake (dev, 4, hcd->remote_wakeup); | ||
279 | #endif | ||
280 | } else if (retval < 0) { | 269 | } else if (retval < 0) { |
281 | dev_dbg (&dev->dev, "PCI %s suspend fail, %d\n", | 270 | dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n", |
282 | pci_state(state), retval); | 271 | retval); |
283 | (void) usb_hcd_pci_resume (dev); | 272 | (void) usb_hcd_pci_resume (dev); |
284 | break; | 273 | break; |
285 | } | 274 | } |
@@ -287,13 +276,14 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state) | |||
287 | default: | 276 | default: |
288 | dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n", | 277 | dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n", |
289 | hcd->state); | 278 | hcd->state); |
279 | WARN_ON(1); | ||
290 | retval = -EINVAL; | 280 | retval = -EINVAL; |
291 | break; | 281 | break; |
292 | } | 282 | } |
293 | 283 | ||
294 | /* update power_state **ONLY** to make sysfs happier */ | 284 | /* update power_state **ONLY** to make sysfs happier */ |
295 | if (retval == 0) | 285 | if (retval == 0) |
296 | dev->dev.power.power_state = state; | 286 | dev->dev.power.power_state = message; |
297 | return retval; | 287 | return retval; |
298 | } | 288 | } |
299 | EXPORT_SYMBOL (usb_hcd_pci_suspend); | 289 | EXPORT_SYMBOL (usb_hcd_pci_suspend); |
@@ -308,7 +298,6 @@ int usb_hcd_pci_resume (struct pci_dev *dev) | |||
308 | { | 298 | { |
309 | struct usb_hcd *hcd; | 299 | struct usb_hcd *hcd; |
310 | int retval; | 300 | int retval; |
311 | int has_pci_pm; | ||
312 | 301 | ||
313 | hcd = pci_get_drvdata(dev); | 302 | hcd = pci_get_drvdata(dev); |
314 | if (hcd->state != HC_STATE_SUSPENDED) { | 303 | if (hcd->state != HC_STATE_SUSPENDED) { |
@@ -316,31 +305,73 @@ int usb_hcd_pci_resume (struct pci_dev *dev) | |||
316 | "can't resume, not suspended!\n"); | 305 | "can't resume, not suspended!\n"); |
317 | return 0; | 306 | return 0; |
318 | } | 307 | } |
319 | has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM); | ||
320 | 308 | ||
321 | /* D3cold resume isn't usually reported this way... */ | 309 | /* NOTE: chip docs cover clean "real suspend" cases (what Linux |
322 | dev_dbg(hcd->self.controller, "resume from PCI %s%s\n", | 310 | * calls "standby", "suspend to RAM", and so on). There are also |
323 | pci_state(dev->current_state), | 311 | * dirty cases when swsusp fakes a suspend in "shutdown" mode. |
324 | has_pci_pm ? "" : " (legacy)"); | 312 | */ |
313 | if (dev->current_state != PCI_D0) { | ||
314 | #ifdef DEBUG | ||
315 | int pci_pm; | ||
316 | u16 pmcr; | ||
317 | |||
318 | pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM); | ||
319 | pci_read_config_word(dev, pci_pm + PCI_PM_CTRL, &pmcr); | ||
320 | pmcr &= PCI_PM_CTRL_STATE_MASK; | ||
321 | if (pmcr) { | ||
322 | /* Clean case: power to USB and to HC registers was | ||
323 | * maintained; remote wakeup is easy. | ||
324 | */ | ||
325 | dev_dbg(hcd->self.controller, "resume from PCI D%d\n", | ||
326 | pmcr); | ||
327 | } else { | ||
328 | /* Clean: HC lost Vcc power, D0 uninitialized | ||
329 | * + Vaux may have preserved port and transceiver | ||
330 | * state ... for remote wakeup from D3cold | ||
331 | * + or not; HCD must reinit + re-enumerate | ||
332 | * | ||
333 | * Dirty: D0 semi-initialized cases with swsusp | ||
334 | * + after BIOS init | ||
335 | * + after Linux init (HCD statically linked) | ||
336 | */ | ||
337 | dev_dbg(hcd->self.controller, | ||
338 | "PCI D0, from previous PCI D%d\n", | ||
339 | dev->current_state); | ||
340 | } | ||
341 | #endif | ||
342 | pci_enable_wake (dev, dev->current_state, 0); | ||
343 | pci_enable_wake (dev, PCI_D3cold, 0); | ||
344 | } else { | ||
345 | /* Same basic cases: clean (powered/not), dirty */ | ||
346 | dev_dbg(hcd->self.controller, "PCI legacy resume\n"); | ||
347 | } | ||
348 | |||
349 | /* NOTE: the PCI API itself is asymmetric here. We don't need to | ||
350 | * pci_set_power_state(PCI_D0) since that's part of re-enabling; | ||
351 | * but that won't re-enable bus mastering. Yet pci_disable_device() | ||
352 | * explicitly disables bus mastering... | ||
353 | */ | ||
354 | retval = pci_enable_device (dev); | ||
355 | if (retval < 0) { | ||
356 | dev_err (hcd->self.controller, | ||
357 | "can't re-enable after resume, %d!\n", retval); | ||
358 | return retval; | ||
359 | } | ||
360 | pci_set_master (dev); | ||
361 | pci_restore_state (dev); | ||
362 | |||
363 | dev->dev.power.power_state = PMSG_ON; | ||
325 | 364 | ||
326 | hcd->state = HC_STATE_RESUMING; | 365 | hcd->state = HC_STATE_RESUMING; |
327 | 366 | hcd->saw_irq = 0; | |
328 | if (has_pci_pm) | ||
329 | pci_set_power_state (dev, 0); | ||
330 | dev->dev.power.power_state = 0; | ||
331 | retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ, | 367 | retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ, |
332 | hcd->driver->description, hcd); | 368 | hcd->irq_descr, hcd); |
333 | if (retval < 0) { | 369 | if (retval < 0) { |
334 | dev_err (hcd->self.controller, | 370 | dev_err (hcd->self.controller, |
335 | "can't restore IRQ after resume!\n"); | 371 | "can't restore IRQ after resume!\n"); |
372 | usb_hc_died (hcd); | ||
336 | return retval; | 373 | return retval; |
337 | } | 374 | } |
338 | hcd->saw_irq = 0; | ||
339 | pci_restore_state (dev); | ||
340 | #ifdef CONFIG_USB_SUSPEND | ||
341 | pci_enable_wake (dev, dev->current_state, 0); | ||
342 | pci_enable_wake (dev, 4, 0); | ||
343 | #endif | ||
344 | 375 | ||
345 | retval = hcd->driver->resume (hcd); | 376 | retval = hcd->driver->resume (hcd); |
346 | if (!HC_IS_RUNNING (hcd->state)) { | 377 | if (!HC_IS_RUNNING (hcd->state)) { |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 6c625b35fa0c..f67cf1e634fc 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -177,7 +177,7 @@ struct hc_driver { | |||
177 | * a whole, not just the root hub; they're for bus glue. | 177 | * a whole, not just the root hub; they're for bus glue. |
178 | */ | 178 | */ |
179 | /* called after all devices were suspended */ | 179 | /* called after all devices were suspended */ |
180 | int (*suspend) (struct usb_hcd *hcd, u32 state); | 180 | int (*suspend) (struct usb_hcd *hcd, pm_message_t message); |
181 | 181 | ||
182 | /* called before any devices get resumed */ | 182 | /* called before any devices get resumed */ |
183 | int (*resume) (struct usb_hcd *hcd); | 183 | int (*resume) (struct usb_hcd *hcd); |
@@ -226,7 +226,7 @@ extern int usb_hcd_pci_probe (struct pci_dev *dev, | |||
226 | extern void usb_hcd_pci_remove (struct pci_dev *dev); | 226 | extern void usb_hcd_pci_remove (struct pci_dev *dev); |
227 | 227 | ||
228 | #ifdef CONFIG_PM | 228 | #ifdef CONFIG_PM |
229 | extern int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state); | 229 | extern int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t state); |
230 | extern int usb_hcd_pci_resume (struct pci_dev *dev); | 230 | extern int usb_hcd_pci_resume (struct pci_dev *dev); |
231 | #endif /* CONFIG_PM */ | 231 | #endif /* CONFIG_PM */ |
232 | 232 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index fa0dc4f6de47..d2d648ee8640 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -381,7 +381,7 @@ static void hub_tt_kevent (void *arg) | |||
381 | dev_err (&hdev->dev, | 381 | dev_err (&hdev->dev, |
382 | "clear tt %d (%04x) error %d\n", | 382 | "clear tt %d (%04x) error %d\n", |
383 | clear->tt, clear->devinfo, status); | 383 | clear->tt, clear->devinfo, status); |
384 | kfree (clear); | 384 | kfree(clear); |
385 | } | 385 | } |
386 | spin_unlock_irqrestore (&hub->tt.lock, flags); | 386 | spin_unlock_irqrestore (&hub->tt.lock, flags); |
387 | } | 387 | } |
@@ -728,15 +728,11 @@ static void hub_disconnect(struct usb_interface *intf) | |||
728 | list_del_init(&hub->event_list); | 728 | list_del_init(&hub->event_list); |
729 | spin_unlock_irq(&hub_event_lock); | 729 | spin_unlock_irq(&hub_event_lock); |
730 | 730 | ||
731 | if (hub->descriptor) { | 731 | kfree(hub->descriptor); |
732 | kfree(hub->descriptor); | 732 | hub->descriptor = NULL; |
733 | hub->descriptor = NULL; | ||
734 | } | ||
735 | 733 | ||
736 | if (hub->status) { | 734 | kfree(hub->status); |
737 | kfree(hub->status); | 735 | hub->status = NULL; |
738 | hub->status = NULL; | ||
739 | } | ||
740 | 736 | ||
741 | if (hub->buffer) { | 737 | if (hub->buffer) { |
742 | usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer, | 738 | usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer, |
@@ -1456,7 +1452,7 @@ static void hub_port_logical_disconnect(struct usb_hub *hub, int port1) | |||
1456 | /* FIXME let caller ask to power down the port: | 1452 | /* FIXME let caller ask to power down the port: |
1457 | * - some devices won't enumerate without a VBUS power cycle | 1453 | * - some devices won't enumerate without a VBUS power cycle |
1458 | * - SRP saves power that way | 1454 | * - SRP saves power that way |
1459 | * - usb_suspend_device(dev,PM_SUSPEND_DISK) | 1455 | * - usb_suspend_device(dev, PMSG_SUSPEND) |
1460 | * That's easy if this hub can switch power per-port, and | 1456 | * That's easy if this hub can switch power per-port, and |
1461 | * khubd reactivates the port later (timer, SRP, etc). | 1457 | * khubd reactivates the port later (timer, SRP, etc). |
1462 | * Powerdown must be optional, because of reset/DFU. | 1458 | * Powerdown must be optional, because of reset/DFU. |
@@ -1531,7 +1527,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1, | |||
1531 | 1527 | ||
1532 | /* | 1528 | /* |
1533 | * Devices on USB hub ports have only one "suspend" state, corresponding | 1529 | * Devices on USB hub ports have only one "suspend" state, corresponding |
1534 | * to ACPI D2 (PM_SUSPEND_MEM), "may cause the device to lose some context". | 1530 | * to ACPI D2, "may cause the device to lose some context". |
1535 | * State transitions include: | 1531 | * State transitions include: |
1536 | * | 1532 | * |
1537 | * - suspend, resume ... when the VBUS power link stays live | 1533 | * - suspend, resume ... when the VBUS power link stays live |
@@ -1731,7 +1727,7 @@ static int finish_port_resume(struct usb_device *udev) | |||
1731 | struct usb_driver *driver; | 1727 | struct usb_driver *driver; |
1732 | 1728 | ||
1733 | intf = udev->actconfig->interface[i]; | 1729 | intf = udev->actconfig->interface[i]; |
1734 | if (intf->dev.power.power_state == PM_SUSPEND_ON) | 1730 | if (intf->dev.power.power_state == PMSG_SUSPEND) |
1735 | continue; | 1731 | continue; |
1736 | if (!intf->dev.driver) { | 1732 | if (!intf->dev.driver) { |
1737 | /* FIXME maybe force to alt 0 */ | 1733 | /* FIXME maybe force to alt 0 */ |
@@ -1745,7 +1741,7 @@ static int finish_port_resume(struct usb_device *udev) | |||
1745 | 1741 | ||
1746 | /* can we do better than just logging errors? */ | 1742 | /* can we do better than just logging errors? */ |
1747 | status = driver->resume(intf); | 1743 | status = driver->resume(intf); |
1748 | if (intf->dev.power.power_state != PM_SUSPEND_ON | 1744 | if (intf->dev.power.power_state != PMSG_ON |
1749 | || status) | 1745 | || status) |
1750 | dev_dbg(&intf->dev, | 1746 | dev_dbg(&intf->dev, |
1751 | "resume fail, state %d code %d\n", | 1747 | "resume fail, state %d code %d\n", |
@@ -2354,7 +2350,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1) | |||
2354 | schedule_work (&hub->leds); | 2350 | schedule_work (&hub->leds); |
2355 | } | 2351 | } |
2356 | } | 2352 | } |
2357 | kfree (qual); | 2353 | kfree(qual); |
2358 | } | 2354 | } |
2359 | 2355 | ||
2360 | static unsigned | 2356 | static unsigned |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index d913407bcdc1..f9f9561c6bad 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/parser.h> | 41 | #include <linux/parser.h> |
42 | #include <asm/byteorder.h> | 42 | #include <asm/byteorder.h> |
43 | #include "usb.h" | 43 | #include "usb.h" |
44 | #include "hcd.h" | ||
44 | 45 | ||
45 | static struct super_operations usbfs_ops; | 46 | static struct super_operations usbfs_ops; |
46 | static struct file_operations default_file_operations; | 47 | static struct file_operations default_file_operations; |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 40bdb38e7bcb..e12c5be1e0a3 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1133,29 +1133,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1133 | /* prevent submissions using previous endpoint settings */ | 1133 | /* prevent submissions using previous endpoint settings */ |
1134 | usb_disable_interface(dev, iface); | 1134 | usb_disable_interface(dev, iface); |
1135 | 1135 | ||
1136 | /* 9.1.1.5 says: | ||
1137 | * | ||
1138 | * Configuring a device or changing an alternate setting | ||
1139 | * causes all of the status and configuration values | ||
1140 | * associated with endpoints in the affected interfaces to | ||
1141 | * be set to their default values. This includes setting | ||
1142 | * the data toggle of any endpoint using data toggles to | ||
1143 | * the value DATA0. | ||
1144 | * | ||
1145 | * Some devices take this too literally and don't reset the data | ||
1146 | * toggles if the new altsetting is the same as the old one (the | ||
1147 | * command isn't "changing" an alternate setting). We will manually | ||
1148 | * reset the toggles when the new and old altsettings are the same. | ||
1149 | * Most devices won't need this, but fortunately it doesn't happen | ||
1150 | * often. | ||
1151 | */ | ||
1152 | if (iface->cur_altsetting == alt) | ||
1153 | manual = 1; | ||
1154 | iface->cur_altsetting = alt; | 1136 | iface->cur_altsetting = alt; |
1155 | 1137 | ||
1156 | /* If the interface only has one altsetting and the device didn't | 1138 | /* If the interface only has one altsetting and the device didn't |
1157 | * accept the request (or whenever the old altsetting is the same | 1139 | * accept the request, we attempt to carry out the equivalent action |
1158 | * as the new one), we attempt to carry out the equivalent action | ||
1159 | * by manually clearing the HALT feature for each endpoint in the | 1140 | * by manually clearing the HALT feature for each endpoint in the |
1160 | * new altsetting. | 1141 | * new altsetting. |
1161 | */ | 1142 | */ |
@@ -1202,7 +1183,9 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1202 | * | 1183 | * |
1203 | * Because this affects multiple interfaces, avoid using this with composite | 1184 | * Because this affects multiple interfaces, avoid using this with composite |
1204 | * (multi-interface) devices. Instead, the driver for each interface may | 1185 | * (multi-interface) devices. Instead, the driver for each interface may |
1205 | * use usb_set_interface() on the interfaces it claims. Resetting the whole | 1186 | * use usb_set_interface() on the interfaces it claims. Be careful though; |
1187 | * some devices don't support the SET_INTERFACE request, and others won't | ||
1188 | * reset all the interface state (notably data toggles). Resetting the whole | ||
1206 | * configuration would affect other drivers' interfaces. | 1189 | * configuration would affect other drivers' interfaces. |
1207 | * | 1190 | * |
1208 | * The caller must own the device lock. | 1191 | * The caller must own the device lock. |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index dc838f81742c..16972159a57a 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -420,12 +420,16 @@ int usb_submit_urb(struct urb *urb, int mem_flags) | |||
420 | * | 420 | * |
421 | * Host Controller Drivers (HCDs) place all the URBs for a particular | 421 | * Host Controller Drivers (HCDs) place all the URBs for a particular |
422 | * endpoint in a queue. Normally the queue advances as the controller | 422 | * endpoint in a queue. Normally the queue advances as the controller |
423 | * hardware processes each request. But when an URB terminates with any | 423 | * hardware processes each request. But when an URB terminates with an |
424 | * fault (such as an error, or being unlinked) its queue stops, at least | 424 | * error its queue stops, at least until that URB's completion routine |
425 | * until that URB's completion routine returns. It is guaranteed that | 425 | * returns. It is guaranteed that the queue will not restart until all |
426 | * the queue will not restart until all its unlinked URBs have been fully | 426 | * its unlinked URBs have been fully retired, with their completion |
427 | * retired, with their completion routines run, even if that's not until | 427 | * routines run, even if that's not until some time after the original |
428 | * some time after the original completion handler returns. | 428 | * completion handler returns. Normally the same behavior and guarantees |
429 | * apply when an URB terminates because it was unlinked; however if an | ||
430 | * URB is unlinked before the hardware has started to execute it, then | ||
431 | * its queue is not guaranteed to stop until all the preceding URBs have | ||
432 | * completed. | ||
429 | * | 433 | * |
430 | * This means that USB device drivers can safely build deep queues for | 434 | * This means that USB device drivers can safely build deep queues for |
431 | * large or complex transfers, and clean them up reliably after any sort | 435 | * large or complex transfers, and clean them up reliably after any sort |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index f0534ee06490..c231b4bef314 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -50,13 +50,6 @@ | |||
50 | #include "hcd.h" | 50 | #include "hcd.h" |
51 | #include "usb.h" | 51 | #include "usb.h" |
52 | 52 | ||
53 | extern int usb_hub_init(void); | ||
54 | extern void usb_hub_cleanup(void); | ||
55 | extern int usb_major_init(void); | ||
56 | extern void usb_major_cleanup(void); | ||
57 | extern int usb_host_init(void); | ||
58 | extern void usb_host_cleanup(void); | ||
59 | |||
60 | 53 | ||
61 | const char *usbcore_name = "usbcore"; | 54 | const char *usbcore_name = "usbcore"; |
62 | 55 | ||
@@ -1382,13 +1375,13 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, | |||
1382 | usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 1375 | usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); |
1383 | } | 1376 | } |
1384 | 1377 | ||
1385 | static int usb_generic_suspend(struct device *dev, u32 state) | 1378 | static int usb_generic_suspend(struct device *dev, pm_message_t message) |
1386 | { | 1379 | { |
1387 | struct usb_interface *intf; | 1380 | struct usb_interface *intf; |
1388 | struct usb_driver *driver; | 1381 | struct usb_driver *driver; |
1389 | 1382 | ||
1390 | if (dev->driver == &usb_generic_driver) | 1383 | if (dev->driver == &usb_generic_driver) |
1391 | return usb_suspend_device (to_usb_device(dev), state); | 1384 | return usb_suspend_device (to_usb_device(dev), message); |
1392 | 1385 | ||
1393 | if ((dev->driver == NULL) || | 1386 | if ((dev->driver == NULL) || |
1394 | (dev->driver_data == &usb_generic_driver_data)) | 1387 | (dev->driver_data == &usb_generic_driver_data)) |
@@ -1402,7 +1395,7 @@ static int usb_generic_suspend(struct device *dev, u32 state) | |||
1402 | return 0; | 1395 | return 0; |
1403 | 1396 | ||
1404 | if (driver->suspend) | 1397 | if (driver->suspend) |
1405 | return driver->suspend(intf, state); | 1398 | return driver->suspend(intf, message); |
1406 | return 0; | 1399 | return 0; |
1407 | } | 1400 | } |
1408 | 1401 | ||
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 4c33eee52001..2c690f6d4c18 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
@@ -21,6 +21,13 @@ extern void usb_unlock_all_devices(void); | |||
21 | extern void usb_kick_khubd(struct usb_device *dev); | 21 | extern void usb_kick_khubd(struct usb_device *dev); |
22 | extern void usb_resume_root_hub(struct usb_device *dev); | 22 | extern void usb_resume_root_hub(struct usb_device *dev); |
23 | 23 | ||
24 | extern int usb_hub_init(void); | ||
25 | extern void usb_hub_cleanup(void); | ||
26 | extern int usb_major_init(void); | ||
27 | extern void usb_major_cleanup(void); | ||
28 | extern int usb_host_init(void); | ||
29 | extern void usb_host_cleanup(void); | ||
30 | |||
24 | /* for labeling diagnostics */ | 31 | /* for labeling diagnostics */ |
25 | extern const char *usbcore_name; | 32 | extern const char *usbcore_name; |
26 | 33 | ||
@@ -30,6 +37,7 @@ extern struct file_operations usbfs_devices_fops; | |||
30 | extern struct file_operations usbfs_device_file_operations; | 37 | extern struct file_operations usbfs_device_file_operations; |
31 | extern void usbfs_conn_disc_event(void); | 38 | extern void usbfs_conn_disc_event(void); |
32 | 39 | ||
40 | |||
33 | struct dev_state { | 41 | struct dev_state { |
34 | struct list_head list; /* state list */ | 42 | struct list_head list; /* state list */ |
35 | struct usb_device *dev; | 43 | struct usb_device *dev; |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index cff9fb0b73cc..3993156c2e82 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -100,6 +100,8 @@ static const char driver_desc [] = DRIVER_DESC; | |||
100 | 100 | ||
101 | /* CDC and RNDIS support the same host-chosen outgoing packet filters. */ | 101 | /* CDC and RNDIS support the same host-chosen outgoing packet filters. */ |
102 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ | 102 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ |
103 | |USB_CDC_PACKET_TYPE_ALL_MULTICAST \ | ||
104 | |USB_CDC_PACKET_TYPE_PROMISCUOUS \ | ||
103 | |USB_CDC_PACKET_TYPE_DIRECTED) | 105 | |USB_CDC_PACKET_TYPE_DIRECTED) |
104 | 106 | ||
105 | 107 | ||
@@ -322,12 +324,18 @@ module_param (qmult, uint, S_IRUGO|S_IWUSR); | |||
322 | /* also defer IRQs on highspeed TX */ | 324 | /* also defer IRQs on highspeed TX */ |
323 | #define TX_DELAY qmult | 325 | #define TX_DELAY qmult |
324 | 326 | ||
325 | #define BITRATE(g) (((g)->speed == USB_SPEED_HIGH) ? HS_BPS : FS_BPS) | 327 | static inline int BITRATE(struct usb_gadget *g) |
328 | { | ||
329 | return (g->speed == USB_SPEED_HIGH) ? HS_BPS : FS_BPS; | ||
330 | } | ||
326 | 331 | ||
327 | #else /* full speed (low speed doesn't do bulk) */ | 332 | #else /* full speed (low speed doesn't do bulk) */ |
328 | #define qlen(gadget) DEFAULT_QLEN | 333 | #define qlen(gadget) DEFAULT_QLEN |
329 | 334 | ||
330 | #define BITRATE(g) FS_BPS | 335 | static inline int BITRATE(struct usb_gadget *g) |
336 | { | ||
337 | return FS_BPS; | ||
338 | } | ||
331 | #endif | 339 | #endif |
332 | 340 | ||
333 | 341 | ||
@@ -1167,7 +1175,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags) | |||
1167 | eth_reset_config (dev); | 1175 | eth_reset_config (dev); |
1168 | 1176 | ||
1169 | /* default: pass all packets, no multicast filtering */ | 1177 | /* default: pass all packets, no multicast filtering */ |
1170 | dev->cdc_filter = 0x000f; | 1178 | dev->cdc_filter = DEFAULT_FILTER; |
1171 | 1179 | ||
1172 | switch (number) { | 1180 | switch (number) { |
1173 | case DEV_CONFIG_VALUE: | 1181 | case DEV_CONFIG_VALUE: |
@@ -1343,9 +1351,9 @@ eth_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1343 | struct eth_dev *dev = get_gadget_data (gadget); | 1351 | struct eth_dev *dev = get_gadget_data (gadget); |
1344 | struct usb_request *req = dev->req; | 1352 | struct usb_request *req = dev->req; |
1345 | int value = -EOPNOTSUPP; | 1353 | int value = -EOPNOTSUPP; |
1346 | u16 wIndex = ctrl->wIndex; | 1354 | u16 wIndex = (__force u16) ctrl->wIndex; |
1347 | u16 wValue = ctrl->wValue; | 1355 | u16 wValue = (__force u16) ctrl->wValue; |
1348 | u16 wLength = ctrl->wLength; | 1356 | u16 wLength = (__force u16) ctrl->wLength; |
1349 | 1357 | ||
1350 | /* descriptors just go into the pre-allocated ep0 buffer, | 1358 | /* descriptors just go into the pre-allocated ep0 buffer, |
1351 | * while config change events may enable network traffic. | 1359 | * while config change events may enable network traffic. |
@@ -1693,7 +1701,7 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, int gfp_flags) | |||
1693 | 1701 | ||
1694 | /* Some platforms perform better when IP packets are aligned, | 1702 | /* Some platforms perform better when IP packets are aligned, |
1695 | * but on at least one, checksumming fails otherwise. Note: | 1703 | * but on at least one, checksumming fails otherwise. Note: |
1696 | * this doesn't account for variable-sized RNDIS headers. | 1704 | * RNDIS headers involve variable numbers of LE32 values. |
1697 | */ | 1705 | */ |
1698 | skb_reserve(skb, NET_IP_ALIGN); | 1706 | skb_reserve(skb, NET_IP_ALIGN); |
1699 | 1707 | ||
@@ -1730,9 +1738,11 @@ static void rx_complete (struct usb_ep *ep, struct usb_request *req) | |||
1730 | #ifdef CONFIG_USB_ETH_RNDIS | 1738 | #ifdef CONFIG_USB_ETH_RNDIS |
1731 | /* we know MaxPacketsPerTransfer == 1 here */ | 1739 | /* we know MaxPacketsPerTransfer == 1 here */ |
1732 | if (dev->rndis) | 1740 | if (dev->rndis) |
1733 | rndis_rm_hdr (req->buf, &(skb->len)); | 1741 | status = rndis_rm_hdr (skb); |
1734 | #endif | 1742 | #endif |
1735 | if (ETH_HLEN > skb->len || skb->len > ETH_FRAME_LEN) { | 1743 | if (status < 0 |
1744 | || ETH_HLEN > skb->len | ||
1745 | || skb->len > ETH_FRAME_LEN) { | ||
1736 | dev->stats.rx_errors++; | 1746 | dev->stats.rx_errors++; |
1737 | dev->stats.rx_length_errors++; | 1747 | dev->stats.rx_length_errors++; |
1738 | DEBUG (dev, "rx length %d\n", skb->len); | 1748 | DEBUG (dev, "rx length %d\n", skb->len); |
@@ -2047,38 +2057,20 @@ rndis_control_ack_complete (struct usb_ep *ep, struct usb_request *req) | |||
2047 | DEBUG ((struct eth_dev *) ep->driver_data, | 2057 | DEBUG ((struct eth_dev *) ep->driver_data, |
2048 | "rndis control ack complete --> %d, %d/%d\n", | 2058 | "rndis control ack complete --> %d, %d/%d\n", |
2049 | req->status, req->actual, req->length); | 2059 | req->status, req->actual, req->length); |
2050 | |||
2051 | usb_ep_free_buffer(ep, req->buf, req->dma, 8); | ||
2052 | usb_ep_free_request(ep, req); | ||
2053 | } | 2060 | } |
2054 | 2061 | ||
2055 | static int rndis_control_ack (struct net_device *net) | 2062 | static int rndis_control_ack (struct net_device *net) |
2056 | { | 2063 | { |
2057 | struct eth_dev *dev = netdev_priv(net); | 2064 | struct eth_dev *dev = netdev_priv(net); |
2058 | u32 length; | 2065 | u32 length; |
2059 | struct usb_request *resp; | 2066 | struct usb_request *resp = dev->stat_req; |
2060 | 2067 | ||
2061 | /* in case RNDIS calls this after disconnect */ | 2068 | /* in case RNDIS calls this after disconnect */ |
2062 | if (!dev->status_ep) { | 2069 | if (!dev->status) { |
2063 | DEBUG (dev, "status ENODEV\n"); | 2070 | DEBUG (dev, "status ENODEV\n"); |
2064 | return -ENODEV; | 2071 | return -ENODEV; |
2065 | } | 2072 | } |
2066 | 2073 | ||
2067 | /* Allocate memory for notification ie. ACK */ | ||
2068 | resp = usb_ep_alloc_request (dev->status_ep, GFP_ATOMIC); | ||
2069 | if (!resp) { | ||
2070 | DEBUG (dev, "status ENOMEM\n"); | ||
2071 | return -ENOMEM; | ||
2072 | } | ||
2073 | |||
2074 | resp->buf = usb_ep_alloc_buffer (dev->status_ep, 8, | ||
2075 | &resp->dma, GFP_ATOMIC); | ||
2076 | if (!resp->buf) { | ||
2077 | DEBUG (dev, "status buf ENOMEM\n"); | ||
2078 | usb_ep_free_request (dev->status_ep, resp); | ||
2079 | return -ENOMEM; | ||
2080 | } | ||
2081 | |||
2082 | /* Send RNDIS RESPONSE_AVAILABLE notification; | 2074 | /* Send RNDIS RESPONSE_AVAILABLE notification; |
2083 | * USB_CDC_NOTIFY_RESPONSE_AVAILABLE should work too | 2075 | * USB_CDC_NOTIFY_RESPONSE_AVAILABLE should work too |
2084 | */ | 2076 | */ |
@@ -2113,7 +2105,7 @@ static void eth_start (struct eth_dev *dev, int gfp_flags) | |||
2113 | if (dev->rndis) { | 2105 | if (dev->rndis) { |
2114 | rndis_set_param_medium (dev->rndis_config, | 2106 | rndis_set_param_medium (dev->rndis_config, |
2115 | NDIS_MEDIUM_802_3, | 2107 | NDIS_MEDIUM_802_3, |
2116 | BITRATE(dev->gadget)); | 2108 | BITRATE(dev->gadget)/100); |
2117 | rndis_send_media_state (dev, 1); | 2109 | rndis_send_media_state (dev, 1); |
2118 | } | 2110 | } |
2119 | #endif | 2111 | #endif |
@@ -2307,8 +2299,8 @@ eth_bind (struct usb_gadget *gadget) | |||
2307 | device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210); | 2299 | device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210); |
2308 | } else if (gadget_is_pxa27x(gadget)) { | 2300 | } else if (gadget_is_pxa27x(gadget)) { |
2309 | device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211); | 2301 | device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211); |
2310 | } else if (gadget_is_s3c2410(gadget)) { | 2302 | } else if (gadget_is_s3c2410(gadget)) { |
2311 | device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212); | 2303 | device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212); |
2312 | } else if (gadget_is_at91(gadget)) { | 2304 | } else if (gadget_is_at91(gadget)) { |
2313 | device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213); | 2305 | device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213); |
2314 | } else { | 2306 | } else { |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index b66ea5a6ed79..98cbcbc16cc1 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -2809,17 +2809,15 @@ static int __exit omap_udc_remove(struct device *dev) | |||
2809 | return 0; | 2809 | return 0; |
2810 | } | 2810 | } |
2811 | 2811 | ||
2812 | /* suspend/resume/wakeup from sysfs (echo > power/state) */ | 2812 | static int omap_udc_suspend(struct device *dev, pm_message_t state, u32 level) |
2813 | |||
2814 | static int omap_udc_suspend(struct device *dev, u32 state, u32 level) | ||
2815 | { | 2813 | { |
2816 | if (level != 0) | 2814 | if (level != 0) |
2817 | return 0; | 2815 | return 0; |
2818 | 2816 | ||
2819 | DBG("suspend, state %d\n", state); | 2817 | DBG("suspend, state %d\n", state); |
2820 | omap_pullup(&udc->gadget, 0); | 2818 | omap_pullup(&udc->gadget, 0); |
2821 | udc->gadget.dev.power.power_state = 3; | 2819 | udc->gadget.dev.power.power_state = PMSG_SUSPEND; |
2822 | udc->gadget.dev.parent->power.power_state = 3; | 2820 | udc->gadget.dev.parent->power.power_state = PMSG_SUSPEND; |
2823 | return 0; | 2821 | return 0; |
2824 | } | 2822 | } |
2825 | 2823 | ||
@@ -2829,8 +2827,8 @@ static int omap_udc_resume(struct device *dev, u32 level) | |||
2829 | return 0; | 2827 | return 0; |
2830 | 2828 | ||
2831 | DBG("resume + wakeup/SRP\n"); | 2829 | DBG("resume + wakeup/SRP\n"); |
2832 | udc->gadget.dev.parent->power.power_state = 0; | 2830 | udc->gadget.dev.parent->power.power_state = PMSG_ON; |
2833 | udc->gadget.dev.power.power_state = 0; | 2831 | udc->gadget.dev.power.power_state = PMSG_ON; |
2834 | omap_pullup(&udc->gadget, 1); | 2832 | omap_pullup(&udc->gadget, 1); |
2835 | 2833 | ||
2836 | /* maybe the host would enumerate us if we nudged it */ | 2834 | /* maybe the host would enumerate us if we nudged it */ |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 6c5197850edc..7457268d5f28 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/io.h> | 37 | #include <asm/io.h> |
38 | #include <asm/byteorder.h> | 38 | #include <asm/byteorder.h> |
39 | #include <asm/system.h> | 39 | #include <asm/system.h> |
40 | #include <asm/unaligned.h> | ||
40 | 41 | ||
41 | 42 | ||
42 | #undef RNDIS_PM | 43 | #undef RNDIS_PM |
@@ -165,7 +166,7 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) | |||
165 | 166 | ||
166 | /* mandatory */ | 167 | /* mandatory */ |
167 | case OID_GEN_LINK_SPEED: | 168 | case OID_GEN_LINK_SPEED: |
168 | DEBUG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__); | 169 | // DEBUG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__); |
169 | length = 4; | 170 | length = 4; |
170 | if (rndis_per_dev_params [configNr].media_state | 171 | if (rndis_per_dev_params [configNr].media_state |
171 | == NDIS_MEDIA_STATE_DISCONNECTED) | 172 | == NDIS_MEDIA_STATE_DISCONNECTED) |
@@ -729,7 +730,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, | |||
729 | retval = 0; | 730 | retval = 0; |
730 | 731 | ||
731 | /* FIXME use these NDIS_PACKET_TYPE_* bitflags to | 732 | /* FIXME use these NDIS_PACKET_TYPE_* bitflags to |
732 | * filter packets in hard_start_xmit() | 733 | * set the cdc_filter; it's not RNDIS-specific |
733 | * NDIS_PACKET_TYPE_x == USB_CDC_PACKET_TYPE_x for x in: | 734 | * NDIS_PACKET_TYPE_x == USB_CDC_PACKET_TYPE_x for x in: |
734 | * PROMISCUOUS, DIRECTED, | 735 | * PROMISCUOUS, DIRECTED, |
735 | * MULTICAST, ALL_MULTICAST, BROADCAST | 736 | * MULTICAST, ALL_MULTICAST, BROADCAST |
@@ -1194,10 +1195,10 @@ void rndis_add_hdr (struct sk_buff *skb) | |||
1194 | return; | 1195 | return; |
1195 | header = (void *) skb_push (skb, sizeof *header); | 1196 | header = (void *) skb_push (skb, sizeof *header); |
1196 | memset (header, 0, sizeof *header); | 1197 | memset (header, 0, sizeof *header); |
1197 | header->MessageType = __constant_cpu_to_le32 (1); | 1198 | header->MessageType = __constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG); |
1198 | header->MessageLength = cpu_to_le32(skb->len); | 1199 | header->MessageLength = cpu_to_le32(skb->len); |
1199 | header->DataOffset = __constant_cpu_to_le32 (36); | 1200 | header->DataOffset = __constant_cpu_to_le32 (36); |
1200 | header->OOBDataOffset = cpu_to_le32(skb->len - 44); | 1201 | header->DataLength = cpu_to_le32(skb->len - sizeof *header); |
1201 | } | 1202 | } |
1202 | 1203 | ||
1203 | void rndis_free_response (int configNr, u8 *buf) | 1204 | void rndis_free_response (int configNr, u8 *buf) |
@@ -1253,26 +1254,23 @@ static rndis_resp_t *rndis_add_response (int configNr, u32 length) | |||
1253 | return r; | 1254 | return r; |
1254 | } | 1255 | } |
1255 | 1256 | ||
1256 | int rndis_rm_hdr (u8 *buf, u32 *length) | 1257 | int rndis_rm_hdr(struct sk_buff *skb) |
1257 | { | 1258 | { |
1258 | u32 i, messageLen, dataOffset; | 1259 | /* tmp points to a struct rndis_packet_msg_type */ |
1259 | __le32 *tmp; | 1260 | __le32 *tmp = (void *) skb->data; |
1260 | |||
1261 | tmp = (__le32 *) buf; | ||
1262 | 1261 | ||
1263 | if (!buf || !length) return -1; | 1262 | /* MessageType, MessageLength */ |
1264 | if (le32_to_cpup(tmp++) != 1) return -1; | 1263 | if (__constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG) |
1265 | 1264 | != get_unaligned(tmp++)) | |
1266 | messageLen = le32_to_cpup(tmp++); | 1265 | return -EINVAL; |
1267 | dataOffset = le32_to_cpup(tmp++) + 8; | 1266 | tmp++; |
1267 | |||
1268 | /* DataOffset, DataLength */ | ||
1269 | if (!skb_pull(skb, le32_to_cpu(get_unaligned(tmp++)) | ||
1270 | + 8 /* offset of DataOffset */)) | ||
1271 | return -EOVERFLOW; | ||
1272 | skb_trim(skb, le32_to_cpu(get_unaligned(tmp++))); | ||
1268 | 1273 | ||
1269 | if (messageLen < dataOffset || messageLen > *length) return -1; | ||
1270 | |||
1271 | for (i = dataOffset; i < messageLen; i++) | ||
1272 | buf [i - dataOffset] = buf [i]; | ||
1273 | |||
1274 | *length = messageLen - dataOffset; | ||
1275 | |||
1276 | return 0; | 1274 | return 0; |
1277 | } | 1275 | } |
1278 | 1276 | ||
diff --git a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h index 822501852c50..2b5b55df3cfd 100644 --- a/drivers/usb/gadget/rndis.h +++ b/drivers/usb/gadget/rndis.h | |||
@@ -38,6 +38,7 @@ | |||
38 | */ | 38 | */ |
39 | 39 | ||
40 | /* Message Set for Connectionless (802.3) Devices */ | 40 | /* Message Set for Connectionless (802.3) Devices */ |
41 | #define REMOTE_NDIS_PACKET_MSG 0x00000001U | ||
41 | #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */ | 42 | #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */ |
42 | #define REMOTE_NDIS_HALT_MSG 0x00000003U | 43 | #define REMOTE_NDIS_HALT_MSG 0x00000003U |
43 | #define REMOTE_NDIS_QUERY_MSG 0x00000004U | 44 | #define REMOTE_NDIS_QUERY_MSG 0x00000004U |
@@ -333,7 +334,7 @@ int rndis_set_param_vendor (u8 configNr, u32 vendorID, | |||
333 | const char *vendorDescr); | 334 | const char *vendorDescr); |
334 | int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed); | 335 | int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed); |
335 | void rndis_add_hdr (struct sk_buff *skb); | 336 | void rndis_add_hdr (struct sk_buff *skb); |
336 | int rndis_rm_hdr (u8 *buf, u32 *length); | 337 | int rndis_rm_hdr (struct sk_buff *skb); |
337 | u8 *rndis_get_next_response (int configNr, u32 *length); | 338 | u8 *rndis_get_next_response (int configNr, u32 *length); |
338 | void rndis_free_response (int configNr, u8 *buf); | 339 | void rndis_free_response (int configNr, u8 *buf); |
339 | 340 | ||
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 2af3f785d5a1..f1762ed6db63 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -2312,9 +2312,8 @@ static struct gs_buf *gs_buf_alloc(unsigned int size, int kmalloc_flags) | |||
2312 | */ | 2312 | */ |
2313 | void gs_buf_free(struct gs_buf *gb) | 2313 | void gs_buf_free(struct gs_buf *gb) |
2314 | { | 2314 | { |
2315 | if (gb != NULL) { | 2315 | if (gb) { |
2316 | if (gb->buf_buf != NULL) | 2316 | kfree(gb->buf_buf); |
2317 | kfree(gb->buf_buf); | ||
2318 | kfree(gb); | 2317 | kfree(gb); |
2319 | } | 2318 | } |
2320 | } | 2319 | } |
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 495e2a3ef6f1..9b347d765383 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -394,7 +394,7 @@ static void qh_lines ( | |||
394 | mark = ' '; | 394 | mark = ' '; |
395 | if (hw_curr == td->qtd_dma) | 395 | if (hw_curr == td->qtd_dma) |
396 | mark = '*'; | 396 | mark = '*'; |
397 | else if (qh->hw_qtd_next == td->qtd_dma) | 397 | else if (qh->hw_qtd_next == cpu_to_le32(td->qtd_dma)) |
398 | mark = '+'; | 398 | mark = '+'; |
399 | else if (QTD_LENGTH (scratch)) { | 399 | else if (QTD_LENGTH (scratch)) { |
400 | if (td->hw_alt_next == ehci->async->hw_alt_next) | 400 | if (td->hw_alt_next == ehci->async->hw_alt_next) |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index a63bb792e2c7..84d2b93aca37 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -721,7 +721,7 @@ static int ehci_get_frame (struct usb_hcd *hcd) | |||
721 | * the right sort of wakeup. | 721 | * the right sort of wakeup. |
722 | */ | 722 | */ |
723 | 723 | ||
724 | static int ehci_suspend (struct usb_hcd *hcd, u32 state) | 724 | static int ehci_suspend (struct usb_hcd *hcd, pm_message_t message) |
725 | { | 725 | { |
726 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 726 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
727 | 727 | ||
@@ -729,7 +729,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state) | |||
729 | msleep (100); | 729 | msleep (100); |
730 | 730 | ||
731 | #ifdef CONFIG_USB_SUSPEND | 731 | #ifdef CONFIG_USB_SUSPEND |
732 | (void) usb_suspend_device (hcd->self.root_hub, state); | 732 | (void) usb_suspend_device (hcd->self.root_hub, message); |
733 | #else | 733 | #else |
734 | usb_lock_device (hcd->self.root_hub); | 734 | usb_lock_device (hcd->self.root_hub); |
735 | (void) ehci_hub_suspend (hcd); | 735 | (void) ehci_hub_suspend (hcd); |
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index 9938697ff361..5c38ad869485 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c | |||
@@ -156,8 +156,7 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci) | |||
156 | ehci->periodic = NULL; | 156 | ehci->periodic = NULL; |
157 | 157 | ||
158 | /* shadow periodic table */ | 158 | /* shadow periodic table */ |
159 | if (ehci->pshadow) | 159 | kfree(ehci->pshadow); |
160 | kfree (ehci->pshadow); | ||
161 | ehci->pshadow = NULL; | 160 | ehci->pshadow = NULL; |
162 | } | 161 | } |
163 | 162 | ||
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index f6c86354e304..2fa1ffee5ff3 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -310,9 +310,9 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
310 | 310 | ||
311 | for (i = qh->start; i < ehci->periodic_size; i += period) { | 311 | for (i = qh->start; i < ehci->periodic_size; i += period) { |
312 | union ehci_shadow *prev = &ehci->pshadow [i]; | 312 | union ehci_shadow *prev = &ehci->pshadow [i]; |
313 | u32 *hw_p = &ehci->periodic [i]; | 313 | __le32 *hw_p = &ehci->periodic [i]; |
314 | union ehci_shadow here = *prev; | 314 | union ehci_shadow here = *prev; |
315 | u32 type = 0; | 315 | __le32 type = 0; |
316 | 316 | ||
317 | /* skip the iso nodes at list head */ | 317 | /* skip the iso nodes at list head */ |
318 | while (here.ptr) { | 318 | while (here.ptr) { |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 67988dba9eb7..e763a8399a75 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -364,7 +364,7 @@ union ehci_shadow { | |||
364 | struct ehci_itd *itd; /* Q_TYPE_ITD */ | 364 | struct ehci_itd *itd; /* Q_TYPE_ITD */ |
365 | struct ehci_sitd *sitd; /* Q_TYPE_SITD */ | 365 | struct ehci_sitd *sitd; /* Q_TYPE_SITD */ |
366 | struct ehci_fstn *fstn; /* Q_TYPE_FSTN */ | 366 | struct ehci_fstn *fstn; /* Q_TYPE_FSTN */ |
367 | u32 *hw_next; /* (all types) */ | 367 | __le32 *hw_next; /* (all types) */ |
368 | void *ptr; | 368 | void *ptr; |
369 | }; | 369 | }; |
370 | 370 | ||
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 90285f180f87..8aab5907afe9 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -458,9 +458,11 @@ static int ohci_hcd_omap_drv_remove(struct device *dev) | |||
458 | 458 | ||
459 | /* states match PCI usage, always suspending the root hub except that | 459 | /* states match PCI usage, always suspending the root hub except that |
460 | * 4 ~= D3cold (ACPI D3) with clock off (resume sees reset). | 460 | * 4 ~= D3cold (ACPI D3) with clock off (resume sees reset). |
461 | * | ||
462 | * FIXME: above comment is not right, and code is wrong, too :-(. | ||
461 | */ | 463 | */ |
462 | 464 | ||
463 | static int ohci_omap_suspend(struct device *dev, u32 state, u32 level) | 465 | static int ohci_omap_suspend(struct device *dev, pm_message_t state, u32 level) |
464 | { | 466 | { |
465 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); | 467 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); |
466 | int status = -EINVAL; | 468 | int status = -EINVAL; |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index b611582e6bcf..57fd07d00549 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -54,7 +54,7 @@ ohci_pci_start (struct usb_hcd *hcd) | |||
54 | if (pdev->vendor == PCI_VENDOR_ID_AMD | 54 | if (pdev->vendor == PCI_VENDOR_ID_AMD |
55 | && pdev->device == 0x740c) { | 55 | && pdev->device == 0x740c) { |
56 | ohci->flags = OHCI_QUIRK_AMD756; | 56 | ohci->flags = OHCI_QUIRK_AMD756; |
57 | ohci_info (ohci, "AMD756 erratum 4 workaround\n"); | 57 | ohci_dbg (ohci, "AMD756 erratum 4 workaround\n"); |
58 | // also somewhat erratum 10 (suspend/resume issues) | 58 | // also somewhat erratum 10 (suspend/resume issues) |
59 | } | 59 | } |
60 | 60 | ||
@@ -68,7 +68,7 @@ ohci_pci_start (struct usb_hcd *hcd) | |||
68 | */ | 68 | */ |
69 | else if (pdev->vendor == PCI_VENDOR_ID_OPTI | 69 | else if (pdev->vendor == PCI_VENDOR_ID_OPTI |
70 | && pdev->device == 0xc861) { | 70 | && pdev->device == 0xc861) { |
71 | ohci_info (ohci, | 71 | ohci_dbg (ohci, |
72 | "WARNING: OPTi workarounds unavailable\n"); | 72 | "WARNING: OPTi workarounds unavailable\n"); |
73 | } | 73 | } |
74 | 74 | ||
@@ -84,9 +84,20 @@ ohci_pci_start (struct usb_hcd *hcd) | |||
84 | if (b && b->device == PCI_DEVICE_ID_NS_87560_LIO | 84 | if (b && b->device == PCI_DEVICE_ID_NS_87560_LIO |
85 | && b->vendor == PCI_VENDOR_ID_NS) { | 85 | && b->vendor == PCI_VENDOR_ID_NS) { |
86 | ohci->flags |= OHCI_QUIRK_SUPERIO; | 86 | ohci->flags |= OHCI_QUIRK_SUPERIO; |
87 | ohci_info (ohci, "Using NSC SuperIO setup\n"); | 87 | ohci_dbg (ohci, "Using NSC SuperIO setup\n"); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | |||
91 | /* Check for Compaq's ZFMicro chipset, which needs short | ||
92 | * delays before control or bulk queues get re-activated | ||
93 | * in finish_unlinks() | ||
94 | */ | ||
95 | else if (pdev->vendor == PCI_VENDOR_ID_COMPAQ | ||
96 | && pdev->device == 0xa0f8) { | ||
97 | ohci->flags |= OHCI_QUIRK_ZFMICRO; | ||
98 | ohci_dbg (ohci, | ||
99 | "enabled Compaq ZFMicro chipset quirk\n"); | ||
100 | } | ||
90 | } | 101 | } |
91 | 102 | ||
92 | /* NOTE: there may have already been a first reset, to | 103 | /* NOTE: there may have already been a first reset, to |
@@ -102,7 +113,7 @@ ohci_pci_start (struct usb_hcd *hcd) | |||
102 | 113 | ||
103 | #ifdef CONFIG_PM | 114 | #ifdef CONFIG_PM |
104 | 115 | ||
105 | static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state) | 116 | static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) |
106 | { | 117 | { |
107 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 118 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
108 | 119 | ||
@@ -111,7 +122,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state) | |||
111 | msleep (100); | 122 | msleep (100); |
112 | 123 | ||
113 | #ifdef CONFIG_USB_SUSPEND | 124 | #ifdef CONFIG_USB_SUSPEND |
114 | (void) usb_suspend_device (hcd->self.root_hub, state); | 125 | (void) usb_suspend_device (hcd->self.root_hub, message); |
115 | #else | 126 | #else |
116 | usb_lock_device (hcd->self.root_hub); | 127 | usb_lock_device (hcd->self.root_hub); |
117 | (void) ohci_hub_suspend (hcd); | 128 | (void) ohci_hub_suspend (hcd); |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 6f3464a95779..e5bc1789d18a 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -337,7 +337,7 @@ static int ohci_hcd_pxa27x_drv_remove(struct device *dev) | |||
337 | return 0; | 337 | return 0; |
338 | } | 338 | } |
339 | 339 | ||
340 | static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, u32 state, u32 level) | 340 | static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state, u32 level) |
341 | { | 341 | { |
342 | // struct platform_device *pdev = to_platform_device(dev); | 342 | // struct platform_device *pdev = to_platform_device(dev); |
343 | // struct usb_hcd *hcd = dev_get_drvdata(dev); | 343 | // struct usb_hcd *hcd = dev_get_drvdata(dev); |
@@ -346,7 +346,7 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, u32 state, u32 level) | |||
346 | return 0; | 346 | return 0; |
347 | } | 347 | } |
348 | 348 | ||
349 | static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 state) | 349 | static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 level) |
350 | { | 350 | { |
351 | // struct platform_device *pdev = to_platform_device(dev); | 351 | // struct platform_device *pdev = to_platform_device(dev); |
352 | // struct usb_hcd *hcd = dev_get_drvdata(dev); | 352 | // struct usb_hcd *hcd = dev_get_drvdata(dev); |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index c90114a77277..e372306ed0da 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
@@ -1021,6 +1021,8 @@ rescan_this: | |||
1021 | 1021 | ||
1022 | if (ohci->ed_controltail) { | 1022 | if (ohci->ed_controltail) { |
1023 | command |= OHCI_CLF; | 1023 | command |= OHCI_CLF; |
1024 | if (ohci->flags & OHCI_QUIRK_ZFMICRO) | ||
1025 | mdelay(1); | ||
1024 | if (!(ohci->hc_control & OHCI_CTRL_CLE)) { | 1026 | if (!(ohci->hc_control & OHCI_CTRL_CLE)) { |
1025 | control |= OHCI_CTRL_CLE; | 1027 | control |= OHCI_CTRL_CLE; |
1026 | ohci_writel (ohci, 0, | 1028 | ohci_writel (ohci, 0, |
@@ -1029,6 +1031,8 @@ rescan_this: | |||
1029 | } | 1031 | } |
1030 | if (ohci->ed_bulktail) { | 1032 | if (ohci->ed_bulktail) { |
1031 | command |= OHCI_BLF; | 1033 | command |= OHCI_BLF; |
1034 | if (ohci->flags & OHCI_QUIRK_ZFMICRO) | ||
1035 | mdelay(1); | ||
1032 | if (!(ohci->hc_control & OHCI_CTRL_BLE)) { | 1036 | if (!(ohci->hc_control & OHCI_CTRL_BLE)) { |
1033 | control |= OHCI_CTRL_BLE; | 1037 | control |= OHCI_CTRL_BLE; |
1034 | ohci_writel (ohci, 0, | 1038 | ohci_writel (ohci, 0, |
@@ -1039,12 +1043,17 @@ rescan_this: | |||
1039 | /* CLE/BLE to enable, CLF/BLF to (maybe) kickstart */ | 1043 | /* CLE/BLE to enable, CLF/BLF to (maybe) kickstart */ |
1040 | if (control) { | 1044 | if (control) { |
1041 | ohci->hc_control |= control; | 1045 | ohci->hc_control |= control; |
1046 | if (ohci->flags & OHCI_QUIRK_ZFMICRO) | ||
1047 | mdelay(1); | ||
1042 | ohci_writel (ohci, ohci->hc_control, | 1048 | ohci_writel (ohci, ohci->hc_control, |
1043 | &ohci->regs->control); | 1049 | &ohci->regs->control); |
1044 | } | 1050 | } |
1045 | if (command) | 1051 | if (command) { |
1052 | if (ohci->flags & OHCI_QUIRK_ZFMICRO) | ||
1053 | mdelay(1); | ||
1046 | ohci_writel (ohci, command, &ohci->regs->cmdstatus); | 1054 | ohci_writel (ohci, command, &ohci->regs->cmdstatus); |
1047 | } | 1055 | } |
1056 | } | ||
1048 | } | 1057 | } |
1049 | 1058 | ||
1050 | 1059 | ||
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 2ba6e2b0210c..22e1ac138ac0 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -396,6 +396,7 @@ struct ohci_hcd { | |||
396 | #define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */ | 396 | #define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */ |
397 | #define OHCI_QUIRK_INITRESET 0x04 /* SiS, OPTi, ... */ | 397 | #define OHCI_QUIRK_INITRESET 0x04 /* SiS, OPTi, ... */ |
398 | #define OHCI_BIG_ENDIAN 0x08 /* big endian HC */ | 398 | #define OHCI_BIG_ENDIAN 0x08 /* big endian HC */ |
399 | #define OHCI_QUIRK_ZFMICRO 0x10 /* Compaq ZFMicro chipset*/ | ||
399 | // there are also chip quirks/bugs in init logic | 400 | // there are also chip quirks/bugs in init logic |
400 | 401 | ||
401 | }; | 402 | }; |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 324a1a9bbdb2..49bd83ee0c75 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -716,7 +716,7 @@ static void uhci_stop(struct usb_hcd *hcd) | |||
716 | } | 716 | } |
717 | 717 | ||
718 | #ifdef CONFIG_PM | 718 | #ifdef CONFIG_PM |
719 | static int uhci_suspend(struct usb_hcd *hcd, u32 state) | 719 | static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message) |
720 | { | 720 | { |
721 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 721 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
722 | 722 | ||
@@ -890,8 +890,7 @@ up_failed: | |||
890 | debugfs_remove(uhci_debugfs_root); | 890 | debugfs_remove(uhci_debugfs_root); |
891 | 891 | ||
892 | debug_failed: | 892 | debug_failed: |
893 | if (errbuf) | 893 | kfree(errbuf); |
894 | kfree(errbuf); | ||
895 | 894 | ||
896 | errbuf_failed: | 895 | errbuf_failed: |
897 | 896 | ||
@@ -906,9 +905,7 @@ static void __exit uhci_hcd_cleanup(void) | |||
906 | warn("not all urb_priv's were freed!"); | 905 | warn("not all urb_priv's were freed!"); |
907 | 906 | ||
908 | debugfs_remove(uhci_debugfs_root); | 907 | debugfs_remove(uhci_debugfs_root); |
909 | 908 | kfree(errbuf); | |
910 | if (errbuf) | ||
911 | kfree(errbuf); | ||
912 | } | 909 | } |
913 | 910 | ||
914 | module_init(uhci_hcd_init); | 911 | module_init(uhci_hcd_init); |
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index d7fea9ea301b..2d76be62f4e0 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
@@ -2138,6 +2138,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2138 | aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor); | 2138 | aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor); |
2139 | aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct); | 2139 | aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct); |
2140 | aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice); | 2140 | aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice); |
2141 | aiptek->inputdev.dev = &intf->dev; | ||
2141 | 2142 | ||
2142 | aiptek->usbdev = usbdev; | 2143 | aiptek->usbdev = usbdev; |
2143 | aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; | 2144 | aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 7662cf4e2621..869ff73690ac 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -558,8 +558,7 @@ static void hid_free_device(struct hid_device *device) | |||
558 | } | 558 | } |
559 | } | 559 | } |
560 | 560 | ||
561 | if (device->rdesc) | 561 | kfree(device->rdesc); |
562 | kfree(device->rdesc); | ||
563 | kfree(device); | 562 | kfree(device); |
564 | } | 563 | } |
565 | 564 | ||
@@ -1790,12 +1789,12 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1790 | return 0; | 1789 | return 0; |
1791 | } | 1790 | } |
1792 | 1791 | ||
1793 | static int hid_suspend(struct usb_interface *intf, u32 state) | 1792 | static int hid_suspend(struct usb_interface *intf, pm_message_t message) |
1794 | { | 1793 | { |
1795 | struct hid_device *hid = usb_get_intfdata (intf); | 1794 | struct hid_device *hid = usb_get_intfdata (intf); |
1796 | 1795 | ||
1797 | usb_kill_urb(hid->urbin); | 1796 | usb_kill_urb(hid->urbin); |
1798 | intf->dev.power.power_state = state; | 1797 | intf->dev.power.power_state = PMSG_SUSPEND; |
1799 | dev_dbg(&intf->dev, "suspend\n"); | 1798 | dev_dbg(&intf->dev, "suspend\n"); |
1800 | return 0; | 1799 | return 0; |
1801 | } | 1800 | } |
@@ -1805,7 +1804,7 @@ static int hid_resume(struct usb_interface *intf) | |||
1805 | struct hid_device *hid = usb_get_intfdata (intf); | 1804 | struct hid_device *hid = usb_get_intfdata (intf); |
1806 | int status; | 1805 | int status; |
1807 | 1806 | ||
1808 | intf->dev.power.power_state = PM_SUSPEND_ON; | 1807 | intf->dev.power.power_state = PMSG_ON; |
1809 | if (hid->open) | 1808 | if (hid->open) |
1810 | status = usb_submit_urb(hid->urbin, GFP_NOIO); | 1809 | status = usb_submit_urb(hid->urbin, GFP_NOIO); |
1811 | else | 1810 | else |
diff --git a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c index 8823297d2191..6ca2fae99d2d 100644 --- a/drivers/usb/media/dabusb.c +++ b/drivers/usb/media/dabusb.c | |||
@@ -138,8 +138,7 @@ static int dabusb_free_queue (struct list_head *q) | |||
138 | #ifdef DEBUG | 138 | #ifdef DEBUG |
139 | dump_urb(b->purb); | 139 | dump_urb(b->purb); |
140 | #endif | 140 | #endif |
141 | if (b->purb->transfer_buffer) | 141 | kfree(b->purb->transfer_buffer); |
142 | kfree (b->purb->transfer_buffer); | ||
143 | usb_free_urb(b->purb); | 142 | usb_free_urb(b->purb); |
144 | tmp = p->next; | 143 | tmp = p->next; |
145 | list_del (p); | 144 | list_del (p); |
diff --git a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c index 0fd7ffed3a98..d6051822416e 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/usb/media/ov511.c | |||
@@ -3915,10 +3915,8 @@ ov51x_do_dealloc(struct usb_ov511 *ov) | |||
3915 | ov->tempfbuf = NULL; | 3915 | ov->tempfbuf = NULL; |
3916 | 3916 | ||
3917 | for (i = 0; i < OV511_NUMSBUF; i++) { | 3917 | for (i = 0; i < OV511_NUMSBUF; i++) { |
3918 | if (ov->sbuf[i].data) { | 3918 | kfree(ov->sbuf[i].data); |
3919 | kfree(ov->sbuf[i].data); | 3919 | ov->sbuf[i].data = NULL; |
3920 | ov->sbuf[i].data = NULL; | ||
3921 | } | ||
3922 | } | 3920 | } |
3923 | 3921 | ||
3924 | for (i = 0; i < OV511_NUMFRAMES; i++) { | 3922 | for (i = 0; i < OV511_NUMFRAMES; i++) { |
@@ -5954,10 +5952,8 @@ error: | |||
5954 | up(&ov->cbuf_lock); | 5952 | up(&ov->cbuf_lock); |
5955 | } | 5953 | } |
5956 | 5954 | ||
5957 | if (ov) { | 5955 | kfree(ov); |
5958 | kfree(ov); | 5956 | ov = NULL; |
5959 | ov = NULL; | ||
5960 | } | ||
5961 | 5957 | ||
5962 | error_out: | 5958 | error_out: |
5963 | err("Camera initialization failed"); | 5959 | err("Camera initialization failed"); |
diff --git a/drivers/usb/media/se401.c b/drivers/usb/media/se401.c index 685bdae5cb62..f69e443cd1bc 100644 --- a/drivers/usb/media/se401.c +++ b/drivers/usb/media/se401.c | |||
@@ -868,13 +868,14 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) | |||
868 | 868 | ||
869 | se401->dev = NULL; | 869 | se401->dev = NULL; |
870 | 870 | ||
871 | for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) { | 871 | for (i=0; i<SE401_NUMSBUF; i++) |
872 | usb_kill_urb(se401->urb[i]); | 872 | if (se401->urb[i]) { |
873 | usb_free_urb(se401->urb[i]); | 873 | usb_kill_urb(se401->urb[i]); |
874 | se401->urb[i] = NULL; | 874 | usb_free_urb(se401->urb[i]); |
875 | kfree(se401->sbuf[i].data); | 875 | se401->urb[i] = NULL; |
876 | } | 876 | kfree(se401->sbuf[i].data); |
877 | for (i=0; i<SE401_NUMSCRATCH; i++) if (se401->scratch[i].data) { | 877 | } |
878 | for (i=0; i<SE401_NUMSCRATCH; i++) { | ||
878 | kfree(se401->scratch[i].data); | 879 | kfree(se401->scratch[i].data); |
879 | } | 880 | } |
880 | if (se401->inturb) { | 881 | if (se401->inturb) { |
diff --git a/drivers/usb/media/usbvideo.c b/drivers/usb/media/usbvideo.c index 298484aa27d2..24efb21969c6 100644 --- a/drivers/usb/media/usbvideo.c +++ b/drivers/usb/media/usbvideo.c | |||
@@ -1169,10 +1169,8 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) | |||
1169 | } | 1169 | } |
1170 | RingQueue_Free(&uvd->dp); | 1170 | RingQueue_Free(&uvd->dp); |
1171 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { | 1171 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { |
1172 | if (uvd->sbuf[i].data != NULL) { | 1172 | kfree(uvd->sbuf[i].data); |
1173 | kfree (uvd->sbuf[i].data); | 1173 | uvd->sbuf[i].data = NULL; |
1174 | uvd->sbuf[i].data = NULL; | ||
1175 | } | ||
1176 | } | 1174 | } |
1177 | } | 1175 | } |
1178 | } | 1176 | } |
diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index 689e79e4bcee..ca9f3a30634f 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c | |||
@@ -3624,10 +3624,8 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3624 | return 0; | 3624 | return 0; |
3625 | 3625 | ||
3626 | fail: /* Free unused memory */ | 3626 | fail: /* Free unused memory */ |
3627 | if (cam->control_buffer) | 3627 | kfree(cam->control_buffer); |
3628 | kfree(cam->control_buffer); | 3628 | kfree(cam->data_buffer); |
3629 | if (cam->data_buffer) | ||
3630 | kfree(cam->data_buffer); | ||
3631 | if (cam->v4ldev) | 3629 | if (cam->v4ldev) |
3632 | video_device_release(cam->v4ldev); | 3630 | video_device_release(cam->v4ldev); |
3633 | up(&cam->dev_sem); | 3631 | up(&cam->dev_sem); |
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index a530bb976e43..6f7994f5a714 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c | |||
@@ -705,16 +705,12 @@ static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsi | |||
705 | /* free a single auerbuf */ | 705 | /* free a single auerbuf */ |
706 | static void auerbuf_free (pauerbuf_t bp) | 706 | static void auerbuf_free (pauerbuf_t bp) |
707 | { | 707 | { |
708 | if (bp->bufp) { | 708 | kfree(bp->bufp); |
709 | kfree (bp->bufp); | 709 | kfree(bp->dr); |
710 | } | ||
711 | if (bp->dr) { | ||
712 | kfree (bp->dr); | ||
713 | } | ||
714 | if (bp->urbp) { | 710 | if (bp->urbp) { |
715 | usb_free_urb (bp->urbp); | 711 | usb_free_urb(bp->urbp); |
716 | } | 712 | } |
717 | kfree (bp); | 713 | kfree(bp); |
718 | } | 714 | } |
719 | 715 | ||
720 | /* free the buffers from an auerbuf list */ | 716 | /* free the buffers from an auerbuf list */ |
@@ -1093,14 +1089,12 @@ exit: | |||
1093 | */ | 1089 | */ |
1094 | static void auerswald_int_free (pauerswald_t cp) | 1090 | static void auerswald_int_free (pauerswald_t cp) |
1095 | { | 1091 | { |
1096 | if (cp->inturbp) { | 1092 | if (cp->inturbp) { |
1097 | usb_free_urb (cp->inturbp); | 1093 | usb_free_urb(cp->inturbp); |
1098 | cp->inturbp = NULL; | 1094 | cp->inturbp = NULL; |
1099 | } | 1095 | } |
1100 | if (cp->intbufp) { | 1096 | kfree(cp->intbufp); |
1101 | kfree (cp->intbufp); | 1097 | cp->intbufp = NULL; |
1102 | cp->intbufp = NULL; | ||
1103 | } | ||
1104 | } | 1098 | } |
1105 | 1099 | ||
1106 | /* This function is called to activate the interrupt | 1100 | /* This function is called to activate the interrupt |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index be163b330167..57b82d53a940 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -3104,6 +3104,7 @@ static void sisusb_disconnect(struct usb_interface *intf) | |||
3104 | 3104 | ||
3105 | static struct usb_device_id sisusb_table [] = { | 3105 | static struct usb_device_id sisusb_table [] = { |
3106 | { USB_DEVICE(0x0711, 0x0900) }, | 3106 | { USB_DEVICE(0x0711, 0x0900) }, |
3107 | { USB_DEVICE(0x182d, 0x021c) }, | ||
3107 | { } | 3108 | { } |
3108 | }; | 3109 | }; |
3109 | 3110 | ||
@@ -3114,7 +3115,7 @@ static struct usb_driver sisusb_driver = { | |||
3114 | .name = "sisusb", | 3115 | .name = "sisusb", |
3115 | .probe = sisusb_probe, | 3116 | .probe = sisusb_probe, |
3116 | .disconnect = sisusb_disconnect, | 3117 | .disconnect = sisusb_disconnect, |
3117 | .id_table = sisusb_table | 3118 | .id_table = sisusb_table, |
3118 | }; | 3119 | }; |
3119 | 3120 | ||
3120 | static int __init usb_sisusb_init(void) | 3121 | static int __init usb_sisusb_init(void) |
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index f6c19d73b7da..a02be795d63e 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -1364,11 +1364,18 @@ static void pegasus_disconnect(struct usb_interface *intf) | |||
1364 | free_netdev(pegasus->net); | 1364 | free_netdev(pegasus->net); |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | static int pegasus_suspend (struct usb_interface *intf, pm_message_t state) | 1367 | static int pegasus_suspend (struct usb_interface *intf, pm_message_t message) |
1368 | { | 1368 | { |
1369 | struct pegasus *pegasus = usb_get_intfdata(intf); | 1369 | struct pegasus *pegasus = usb_get_intfdata(intf); |
1370 | 1370 | ||
1371 | netif_device_detach (pegasus->net); | 1371 | netif_device_detach (pegasus->net); |
1372 | if (netif_running(pegasus->net)) { | ||
1373 | cancel_delayed_work(&pegasus->carrier_check); | ||
1374 | |||
1375 | usb_kill_urb(pegasus->rx_urb); | ||
1376 | usb_kill_urb(pegasus->intr_urb); | ||
1377 | } | ||
1378 | intf->dev.power.power_state = PMSG_SUSPEND; | ||
1372 | return 0; | 1379 | return 0; |
1373 | } | 1380 | } |
1374 | 1381 | ||
@@ -1376,7 +1383,20 @@ static int pegasus_resume (struct usb_interface *intf) | |||
1376 | { | 1383 | { |
1377 | struct pegasus *pegasus = usb_get_intfdata(intf); | 1384 | struct pegasus *pegasus = usb_get_intfdata(intf); |
1378 | 1385 | ||
1386 | intf->dev.power.power_state = PMSG_ON; | ||
1379 | netif_device_attach (pegasus->net); | 1387 | netif_device_attach (pegasus->net); |
1388 | if (netif_running(pegasus->net)) { | ||
1389 | pegasus->rx_urb->status = 0; | ||
1390 | pegasus->rx_urb->actual_length = 0; | ||
1391 | read_bulk_callback(pegasus->rx_urb, 0); | ||
1392 | |||
1393 | pegasus->intr_urb->status = 0; | ||
1394 | pegasus->intr_urb->actual_length = 0; | ||
1395 | intr_callback(pegasus->intr_urb, 0); | ||
1396 | |||
1397 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, | ||
1398 | CARRIER_CHECK_DELAY); | ||
1399 | } | ||
1380 | return 0; | 1400 | return 0; |
1381 | } | 1401 | } |
1382 | 1402 | ||
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index dd8b4456ea35..bbaef047d532 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c | |||
@@ -426,7 +426,7 @@ static void skb_return (struct usbnet *dev, struct sk_buff *skb) | |||
426 | dev->stats.rx_bytes += skb->len; | 426 | dev->stats.rx_bytes += skb->len; |
427 | 427 | ||
428 | if (netif_msg_rx_status (dev)) | 428 | if (netif_msg_rx_status (dev)) |
429 | devdbg (dev, "< rx, len %d, type 0x%x", | 429 | devdbg (dev, "< rx, len %zd, type 0x%x", |
430 | skb->len + sizeof (struct ethhdr), skb->protocol); | 430 | skb->len + sizeof (struct ethhdr), skb->protocol); |
431 | memset (skb->cb, 0, sizeof (struct skb_data)); | 431 | memset (skb->cb, 0, sizeof (struct skb_data)); |
432 | status = netif_rx (skb); | 432 | status = netif_rx (skb); |
@@ -3732,11 +3732,17 @@ out: | |||
3732 | 3732 | ||
3733 | #ifdef CONFIG_PM | 3733 | #ifdef CONFIG_PM |
3734 | 3734 | ||
3735 | static int usbnet_suspend (struct usb_interface *intf, u32 state) | 3735 | static int usbnet_suspend (struct usb_interface *intf, pm_message_t message) |
3736 | { | 3736 | { |
3737 | struct usbnet *dev = usb_get_intfdata(intf); | 3737 | struct usbnet *dev = usb_get_intfdata(intf); |
3738 | 3738 | ||
3739 | /* accelerate emptying of the rx and queues, to avoid | ||
3740 | * having everything error out. | ||
3741 | */ | ||
3739 | netif_device_detach (dev->net); | 3742 | netif_device_detach (dev->net); |
3743 | (void) unlink_urbs (dev, &dev->rxq); | ||
3744 | (void) unlink_urbs (dev, &dev->txq); | ||
3745 | intf->dev.power.power_state = PMSG_SUSPEND; | ||
3740 | return 0; | 3746 | return 0; |
3741 | } | 3747 | } |
3742 | 3748 | ||
@@ -3744,7 +3750,9 @@ static int usbnet_resume (struct usb_interface *intf) | |||
3744 | { | 3750 | { |
3745 | struct usbnet *dev = usb_get_intfdata(intf); | 3751 | struct usbnet *dev = usb_get_intfdata(intf); |
3746 | 3752 | ||
3753 | intf->dev.power.power_state = PMSG_ON; | ||
3747 | netif_device_attach (dev->net); | 3754 | netif_device_attach (dev->net); |
3755 | tasklet_schedule (&dev->bh); | ||
3748 | return 0; | 3756 | return 0; |
3749 | } | 3757 | } |
3750 | 3758 | ||
@@ -4009,10 +4017,23 @@ static const struct usb_device_id products [] = { | |||
4009 | .idProduct = 0x9050, /* C-860 */ | 4017 | .idProduct = 0x9050, /* C-860 */ |
4010 | ZAURUS_MASTER_INTERFACE, | 4018 | ZAURUS_MASTER_INTERFACE, |
4011 | .driver_info = ZAURUS_PXA_INFO, | 4019 | .driver_info = ZAURUS_PXA_INFO, |
4020 | }, | ||
4021 | |||
4012 | #ifdef CONFIG_USB_ZAURUS | 4022 | #ifdef CONFIG_USB_ZAURUS |
4013 | /* at least some (reports vary) C-860 units have very different | 4023 | /* at least some (reports vary) PXA units have very different |
4014 | * lies about their standards support. | 4024 | * lies about their standards support: they claim to be cell |
4025 | * phones giving direct radio access (which they aren't). | ||
4015 | */ | 4026 | */ |
4027 | { | ||
4028 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | ||
4029 | | USB_DEVICE_ID_MATCH_DEVICE, | ||
4030 | .idVendor = 0x04DD, | ||
4031 | /* Sharp ROM v1.32 */ | ||
4032 | .idProduct = 0x8006, /* SL-5600 */ | ||
4033 | .bInterfaceClass = USB_CLASS_COMM, | ||
4034 | .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, | ||
4035 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
4036 | .driver_info = (unsigned long) &zaurus_pxa_mdlm_info, | ||
4016 | }, { | 4037 | }, { |
4017 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | 4038 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
4018 | | USB_DEVICE_ID_MATCH_DEVICE, | 4039 | | USB_DEVICE_ID_MATCH_DEVICE, |
@@ -4023,8 +4044,8 @@ static const struct usb_device_id products [] = { | |||
4023 | .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, | 4044 | .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, |
4024 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | 4045 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, |
4025 | .driver_info = (unsigned long) &zaurus_pxa_mdlm_info, | 4046 | .driver_info = (unsigned long) &zaurus_pxa_mdlm_info, |
4026 | #endif | ||
4027 | }, | 4047 | }, |
4048 | #endif | ||
4028 | 4049 | ||
4029 | /* Olympus has some models with a Zaurus-compatible option. | 4050 | /* Olympus has some models with a Zaurus-compatible option. |
4030 | * R-1000 uses a FreeScale i.MXL cpu (ARMv4T) | 4051 | * R-1000 uses a FreeScale i.MXL cpu (ARMv4T) |
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c index 938025e2c646..c81cd0a619bf 100644 --- a/drivers/usb/net/zd1201.c +++ b/drivers/usb/net/zd1201.c | |||
@@ -106,8 +106,7 @@ int zd1201_fw_upload(struct usb_device *dev, int apfw) | |||
106 | 106 | ||
107 | err = 0; | 107 | err = 0; |
108 | exit: | 108 | exit: |
109 | if (buf) | 109 | kfree(buf); |
110 | kfree(buf); | ||
111 | release_firmware(fw_entry); | 110 | release_firmware(fw_entry); |
112 | return err; | 111 | return err; |
113 | } | 112 | } |
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 86994d117c44..abb1b2c543bb 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c | |||
@@ -202,8 +202,7 @@ static void belkin_sa_shutdown (struct usb_serial *serial) | |||
202 | for (i=0; i < serial->num_ports; ++i) { | 202 | for (i=0; i < serial->num_ports; ++i) { |
203 | /* My special items, the standard routines free my urbs */ | 203 | /* My special items, the standard routines free my urbs */ |
204 | priv = usb_get_serial_port_data(serial->port[i]); | 204 | priv = usb_get_serial_port_data(serial->port[i]); |
205 | if (priv) | 205 | kfree(priv); |
206 | kfree(priv); | ||
207 | } | 206 | } |
208 | } | 207 | } |
209 | 208 | ||
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index db8f472d9e3f..d165f42d560d 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -1340,9 +1340,8 @@ static struct cypress_buf *cypress_buf_alloc(unsigned int size) | |||
1340 | 1340 | ||
1341 | static void cypress_buf_free(struct cypress_buf *cb) | 1341 | static void cypress_buf_free(struct cypress_buf *cb) |
1342 | { | 1342 | { |
1343 | if (cb != NULL) { | 1343 | if (cb) { |
1344 | if (cb->buf_buf != NULL) | 1344 | kfree(cb->buf_buf); |
1345 | kfree(cb->buf_buf); | ||
1346 | kfree(cb); | 1345 | kfree(cb); |
1347 | } | 1346 | } |
1348 | } | 1347 | } |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 25f92788a6d4..a19a47f6cf12 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -568,6 +568,9 @@ static struct usb_serial_device_type digi_acceleport_4_device = { | |||
568 | * and the sleep. In other words, spin_unlock_irqrestore and | 568 | * and the sleep. In other words, spin_unlock_irqrestore and |
569 | * interruptible_sleep_on_timeout are "atomic" with respect to | 569 | * interruptible_sleep_on_timeout are "atomic" with respect to |
570 | * wake ups. This is used to implement condition variables. | 570 | * wake ups. This is used to implement condition variables. |
571 | * | ||
572 | * interruptible_sleep_on_timeout is deprecated and has been replaced | ||
573 | * with the equivalent code. | ||
571 | */ | 574 | */ |
572 | 575 | ||
573 | static inline long cond_wait_interruptible_timeout_irqrestore( | 576 | static inline long cond_wait_interruptible_timeout_irqrestore( |
@@ -576,13 +579,12 @@ static inline long cond_wait_interruptible_timeout_irqrestore( | |||
576 | { | 579 | { |
577 | DEFINE_WAIT(wait); | 580 | DEFINE_WAIT(wait); |
578 | 581 | ||
579 | prepare_to_wait(q, &wait, TASK_UNINTERRUPTIBLE); | 582 | prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE); |
580 | spin_unlock_irqrestore(lock, flags); | 583 | spin_unlock_irqrestore(lock, flags); |
581 | timeout = schedule_timeout(timeout); | 584 | timeout = schedule_timeout(timeout); |
582 | finish_wait(q, &wait); | 585 | finish_wait(q, &wait); |
583 | 586 | ||
584 | return timeout; | 587 | return timeout; |
585 | |||
586 | } | 588 | } |
587 | 589 | ||
588 | 590 | ||
@@ -1596,7 +1598,7 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co | |||
1596 | dbg( "digi_close: write oob failed, ret=%d", ret ); | 1598 | dbg( "digi_close: write oob failed, ret=%d", ret ); |
1597 | 1599 | ||
1598 | /* wait for final commands on oob port to complete */ | 1600 | /* wait for final commands on oob port to complete */ |
1599 | prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_UNINTERRUPTIBLE); | 1601 | prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE); |
1600 | schedule_timeout(DIGI_CLOSE_TIMEOUT); | 1602 | schedule_timeout(DIGI_CLOSE_TIMEOUT); |
1601 | finish_wait(&priv->dp_flush_wait, &wait); | 1603 | finish_wait(&priv->dp_flush_wait, &wait); |
1602 | 1604 | ||
@@ -1995,7 +1997,7 @@ opcode, line, status, val ); | |||
1995 | 1997 | ||
1996 | } else if( opcode == DIGI_CMD_IFLUSH_FIFO ) { | 1998 | } else if( opcode == DIGI_CMD_IFLUSH_FIFO ) { |
1997 | 1999 | ||
1998 | wake_up( &priv->dp_flush_wait ); | 2000 | wake_up_interruptible( &priv->dp_flush_wait ); |
1999 | 2001 | ||
2000 | } | 2002 | } |
2001 | 2003 | ||
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 4d46394f351b..8d562ab454a8 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -550,8 +550,7 @@ failed_usb_register: | |||
550 | failed_usb_serial_register: | 550 | failed_usb_serial_register: |
551 | for (i = 0; i < NUM_URBS; ++i) { | 551 | for (i = 0; i < NUM_URBS; ++i) { |
552 | if (write_urb_pool[i]) { | 552 | if (write_urb_pool[i]) { |
553 | if (write_urb_pool[i]->transfer_buffer) | 553 | kfree(write_urb_pool[i]->transfer_buffer); |
554 | kfree(write_urb_pool[i]->transfer_buffer); | ||
555 | usb_free_urb(write_urb_pool[i]); | 554 | usb_free_urb(write_urb_pool[i]); |
556 | } | 555 | } |
557 | } | 556 | } |
@@ -575,8 +574,7 @@ static void __exit empeg_exit (void) | |||
575 | * the host controllers get fixed to set urb->dev = NULL after | 574 | * the host controllers get fixed to set urb->dev = NULL after |
576 | * the urb is finished. Otherwise this call oopses. */ | 575 | * the urb is finished. Otherwise this call oopses. */ |
577 | /* usb_kill_urb(write_urb_pool[i]); */ | 576 | /* usb_kill_urb(write_urb_pool[i]); */ |
578 | if (write_urb_pool[i]->transfer_buffer) | 577 | kfree(write_urb_pool[i]->transfer_buffer); |
579 | kfree(write_urb_pool[i]->transfer_buffer); | ||
580 | usb_free_urb (write_urb_pool[i]); | 578 | usb_free_urb (write_urb_pool[i]); |
581 | } | 579 | } |
582 | } | 580 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 4afd905fe2fe..4c788c767a97 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1347,9 +1347,7 @@ static int ftdi_common_startup (struct usb_serial *serial) | |||
1347 | priv->flags = ASYNC_LOW_LATENCY; | 1347 | priv->flags = ASYNC_LOW_LATENCY; |
1348 | 1348 | ||
1349 | /* Increase the size of read buffers */ | 1349 | /* Increase the size of read buffers */ |
1350 | if (port->bulk_in_buffer) { | 1350 | kfree(port->bulk_in_buffer); |
1351 | kfree (port->bulk_in_buffer); | ||
1352 | } | ||
1353 | port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL); | 1351 | port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL); |
1354 | if (!port->bulk_in_buffer) { | 1352 | if (!port->bulk_in_buffer) { |
1355 | kfree (priv); | 1353 | kfree (priv); |
@@ -1365,10 +1363,8 @@ static int ftdi_common_startup (struct usb_serial *serial) | |||
1365 | usb_free_urb (port->write_urb); | 1363 | usb_free_urb (port->write_urb); |
1366 | port->write_urb = NULL; | 1364 | port->write_urb = NULL; |
1367 | } | 1365 | } |
1368 | if (port->bulk_out_buffer) { | 1366 | kfree(port->bulk_out_buffer); |
1369 | kfree (port->bulk_out_buffer); | 1367 | port->bulk_out_buffer = NULL; |
1370 | port->bulk_out_buffer = NULL; | ||
1371 | } | ||
1372 | 1368 | ||
1373 | usb_set_serial_port_data(serial->port[0], priv); | 1369 | usb_set_serial_port_data(serial->port[0], priv); |
1374 | 1370 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index e35b5adcd5fe..04bfe279d763 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -951,9 +951,7 @@ static void edge_bulk_out_cmd_callback (struct urb *urb, struct pt_regs *regs) | |||
951 | 951 | ||
952 | 952 | ||
953 | /* clean up the transfer buffer */ | 953 | /* clean up the transfer buffer */ |
954 | if (urb->transfer_buffer != NULL) { | 954 | kfree(urb->transfer_buffer); |
955 | kfree(urb->transfer_buffer); | ||
956 | } | ||
957 | 955 | ||
958 | /* Free the command urb */ | 956 | /* Free the command urb */ |
959 | usb_free_urb (urb); | 957 | usb_free_urb (urb); |
@@ -1266,16 +1264,12 @@ static void edge_close (struct usb_serial_port *port, struct file * filp) | |||
1266 | 1264 | ||
1267 | if (edge_port->write_urb) { | 1265 | if (edge_port->write_urb) { |
1268 | /* if this urb had a transfer buffer already (old transfer) free it */ | 1266 | /* if this urb had a transfer buffer already (old transfer) free it */ |
1269 | if (edge_port->write_urb->transfer_buffer != NULL) { | 1267 | kfree(edge_port->write_urb->transfer_buffer); |
1270 | kfree(edge_port->write_urb->transfer_buffer); | 1268 | usb_free_urb(edge_port->write_urb); |
1271 | } | ||
1272 | usb_free_urb (edge_port->write_urb); | ||
1273 | edge_port->write_urb = NULL; | 1269 | edge_port->write_urb = NULL; |
1274 | } | 1270 | } |
1275 | if (edge_port->txfifo.fifo) { | 1271 | kfree(edge_port->txfifo.fifo); |
1276 | kfree(edge_port->txfifo.fifo); | 1272 | edge_port->txfifo.fifo = NULL; |
1277 | edge_port->txfifo.fifo = NULL; | ||
1278 | } | ||
1279 | 1273 | ||
1280 | dbg("%s exited", __FUNCTION__); | 1274 | dbg("%s exited", __FUNCTION__); |
1281 | } | 1275 | } |
@@ -1419,11 +1413,9 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge | |||
1419 | // get a pointer to the write_urb | 1413 | // get a pointer to the write_urb |
1420 | urb = edge_port->write_urb; | 1414 | urb = edge_port->write_urb; |
1421 | 1415 | ||
1422 | /* if this urb had a transfer buffer already (old transfer) free it */ | 1416 | /* make sure transfer buffer is freed */ |
1423 | if (urb->transfer_buffer != NULL) { | 1417 | kfree(urb->transfer_buffer); |
1424 | kfree(urb->transfer_buffer); | 1418 | urb->transfer_buffer = NULL; |
1425 | urb->transfer_buffer = NULL; | ||
1426 | } | ||
1427 | 1419 | ||
1428 | /* build the data header for the buffer and port that we are about to send out */ | 1420 | /* build the data header for the buffer and port that we are about to send out */ |
1429 | count = fifo->count; | 1421 | count = fifo->count; |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 6c96fdaec36e..ebf9967f7c86 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -2845,9 +2845,8 @@ static struct edge_buf *edge_buf_alloc(unsigned int size) | |||
2845 | 2845 | ||
2846 | void edge_buf_free(struct edge_buf *eb) | 2846 | void edge_buf_free(struct edge_buf *eb) |
2847 | { | 2847 | { |
2848 | if (eb != NULL) { | 2848 | if (eb) { |
2849 | if (eb->buf_buf != NULL) | 2849 | kfree(eb->buf_buf); |
2850 | kfree(eb->buf_buf); | ||
2851 | kfree(eb); | 2850 | kfree(eb); |
2852 | } | 2851 | } |
2853 | } | 2852 | } |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 49c602a0b4df..a11e829e38c8 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -341,8 +341,7 @@ static void klsi_105_shutdown (struct usb_serial *serial) | |||
341 | * finished. Otherwise this call | 341 | * finished. Otherwise this call |
342 | * oopses. */ | 342 | * oopses. */ |
343 | /* usb_kill_urb(write_urbs[j]); */ | 343 | /* usb_kill_urb(write_urbs[j]); */ |
344 | if (write_urbs[j]->transfer_buffer) | 344 | kfree(write_urbs[j]->transfer_buffer); |
345 | kfree(write_urbs[j]->transfer_buffer); | ||
346 | usb_free_urb (write_urbs[j]); | 345 | usb_free_urb (write_urbs[j]); |
347 | } | 346 | } |
348 | } | 347 | } |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index a1cba4b5fa23..b5f2c06d4f3e 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -178,7 +178,6 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp) | |||
178 | { | 178 | { |
179 | struct usb_serial *serial = port->serial; | 179 | struct usb_serial *serial = port->serial; |
180 | struct usb_serial_port *wport; | 180 | struct usb_serial_port *wport; |
181 | struct omninet_data *od; | ||
182 | 181 | ||
183 | dbg("%s - port %d", __FUNCTION__, port->number); | 182 | dbg("%s - port %d", __FUNCTION__, port->number); |
184 | 183 | ||
@@ -186,9 +185,7 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp) | |||
186 | usb_kill_urb(wport->write_urb); | 185 | usb_kill_urb(wport->write_urb); |
187 | usb_kill_urb(port->read_urb); | 186 | usb_kill_urb(port->read_urb); |
188 | 187 | ||
189 | od = usb_get_serial_port_data(port); | 188 | kfree(usb_get_serial_port_data(port)); |
190 | if (od) | ||
191 | kfree(od); | ||
192 | } | 189 | } |
193 | 190 | ||
194 | 191 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 3368d2b0412d..7eab5d4cf3a8 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -94,6 +94,7 @@ static struct usb_device_id id_table [] = { | |||
94 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, | 94 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, |
95 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, | 95 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, |
96 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, | 96 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, |
97 | { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, | ||
97 | { } /* Terminating entry */ | 98 | { } /* Terminating entry */ |
98 | }; | 99 | }; |
99 | 100 | ||
@@ -677,6 +678,9 @@ static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file, | |||
677 | unsigned long flags; | 678 | unsigned long flags; |
678 | u8 control; | 679 | u8 control; |
679 | 680 | ||
681 | if (!usb_get_intfdata(port->serial->interface)) | ||
682 | return -ENODEV; | ||
683 | |||
680 | spin_lock_irqsave (&priv->lock, flags); | 684 | spin_lock_irqsave (&priv->lock, flags); |
681 | if (set & TIOCM_RTS) | 685 | if (set & TIOCM_RTS) |
682 | priv->line_control |= CONTROL_RTS; | 686 | priv->line_control |= CONTROL_RTS; |
@@ -702,6 +706,9 @@ static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file) | |||
702 | 706 | ||
703 | dbg("%s (%d)", __FUNCTION__, port->number); | 707 | dbg("%s (%d)", __FUNCTION__, port->number); |
704 | 708 | ||
709 | if (!usb_get_intfdata(port->serial->interface)) | ||
710 | return -ENODEV; | ||
711 | |||
705 | spin_lock_irqsave (&priv->lock, flags); | 712 | spin_lock_irqsave (&priv->lock, flags); |
706 | mcr = priv->line_control; | 713 | mcr = priv->line_control; |
707 | status = priv->line_status; | 714 | status = priv->line_status; |
@@ -811,15 +818,40 @@ static void pl2303_shutdown (struct usb_serial *serial) | |||
811 | } | 818 | } |
812 | } | 819 | } |
813 | 820 | ||
821 | static void pl2303_update_line_status(struct usb_serial_port *port, | ||
822 | unsigned char *data, | ||
823 | unsigned int actual_length) | ||
824 | { | ||
825 | |||
826 | struct pl2303_private *priv = usb_get_serial_port_data(port); | ||
827 | unsigned long flags; | ||
828 | u8 status_idx = UART_STATE; | ||
829 | u8 length = UART_STATE; | ||
830 | |||
831 | if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && | ||
832 | (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65)) { | ||
833 | length = 1; | ||
834 | status_idx = 0; | ||
835 | } | ||
836 | |||
837 | if (actual_length < length) | ||
838 | goto exit; | ||
839 | |||
840 | /* Save off the uart status for others to look at */ | ||
841 | spin_lock_irqsave(&priv->lock, flags); | ||
842 | priv->line_status = data[status_idx]; | ||
843 | spin_unlock_irqrestore(&priv->lock, flags); | ||
844 | |||
845 | exit: | ||
846 | return; | ||
847 | } | ||
814 | 848 | ||
815 | static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs) | 849 | static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs) |
816 | { | 850 | { |
817 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; | 851 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; |
818 | struct pl2303_private *priv = usb_get_serial_port_data(port); | ||
819 | unsigned char *data = urb->transfer_buffer; | 852 | unsigned char *data = urb->transfer_buffer; |
820 | unsigned long flags; | 853 | unsigned int actual_length = urb->actual_length; |
821 | int status; | 854 | int status; |
822 | u8 uart_state; | ||
823 | 855 | ||
824 | dbg("%s (%d)", __FUNCTION__, port->number); | 856 | dbg("%s (%d)", __FUNCTION__, port->number); |
825 | 857 | ||
@@ -838,19 +870,9 @@ static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs) | |||
838 | goto exit; | 870 | goto exit; |
839 | } | 871 | } |
840 | 872 | ||
841 | |||
842 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer); | 873 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer); |
874 | pl2303_update_line_status(port, data, actual_length); | ||
843 | 875 | ||
844 | if (urb->actual_length < UART_STATE) | ||
845 | goto exit; | ||
846 | |||
847 | /* Save off the uart status for others to look at */ | ||
848 | uart_state = data[UART_STATE]; | ||
849 | spin_lock_irqsave(&priv->lock, flags); | ||
850 | uart_state |= (priv->line_status & UART_STATE_TRANSIENT_MASK); | ||
851 | priv->line_status = uart_state; | ||
852 | spin_unlock_irqrestore(&priv->lock, flags); | ||
853 | |||
854 | exit: | 876 | exit: |
855 | status = usb_submit_urb (urb, GFP_ATOMIC); | 877 | status = usb_submit_urb (urb, GFP_ATOMIC); |
856 | if (status) | 878 | if (status) |
@@ -1022,9 +1044,8 @@ static struct pl2303_buf *pl2303_buf_alloc(unsigned int size) | |||
1022 | 1044 | ||
1023 | static void pl2303_buf_free(struct pl2303_buf *pb) | 1045 | static void pl2303_buf_free(struct pl2303_buf *pb) |
1024 | { | 1046 | { |
1025 | if (pb != NULL) { | 1047 | if (pb) { |
1026 | if (pb->buf_buf != NULL) | 1048 | kfree(pb->buf_buf); |
1027 | kfree(pb->buf_buf); | ||
1028 | kfree(pb); | 1049 | kfree(pb); |
1029 | } | 1050 | } |
1030 | } | 1051 | } |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 6c1b4712dc2f..b734c4003c5a 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -55,3 +55,6 @@ | |||
55 | 55 | ||
56 | #define SIEMENS_VENDOR_ID 0x11f5 | 56 | #define SIEMENS_VENDOR_ID 0x11f5 |
57 | #define SIEMENS_PRODUCT_ID_X65 0x0003 | 57 | #define SIEMENS_PRODUCT_ID_X65 0x0003 |
58 | |||
59 | #define SYNTECH_VENDOR_ID 0x0745 | ||
60 | #define SYNTECH_PRODUCT_ID 0x0001 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 98054876cca2..59c88de3e7ae 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -517,8 +517,7 @@ static void ti_shutdown(struct usb_serial *serial) | |||
517 | } | 517 | } |
518 | } | 518 | } |
519 | 519 | ||
520 | if (tdev) | 520 | kfree(tdev); |
521 | kfree(tdev); | ||
522 | usb_set_serial_data(serial, NULL); | 521 | usb_set_serial_data(serial, NULL); |
523 | } | 522 | } |
524 | 523 | ||
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 69d313e98fad..31c57adcb623 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -215,6 +215,8 @@ static struct usb_device_id id_table [] = { | |||
215 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 215 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
216 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID), | 216 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID), |
217 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 217 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
218 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TREO_650), | ||
219 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | ||
218 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID), | 220 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID), |
219 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 221 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
220 | { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID), | 222 | { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID), |
@@ -237,6 +239,8 @@ static struct usb_device_id id_table [] = { | |||
237 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 239 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
238 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), | 240 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), |
239 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 241 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
242 | { USB_DEVICE(TAPWAVE_VENDOR_ID, TAPWAVE_ZODIAC_ID), | ||
243 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | ||
240 | { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID), | 244 | { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID), |
241 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 245 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
242 | { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID), | 246 | { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID), |
@@ -273,6 +277,7 @@ static struct usb_device_id id_table_combined [] = { | |||
273 | { USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) }, | 277 | { USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) }, |
274 | { USB_DEVICE(PALM_VENDOR_ID, PALM_M130_ID) }, | 278 | { USB_DEVICE(PALM_VENDOR_ID, PALM_M130_ID) }, |
275 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID) }, | 279 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID) }, |
280 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TREO_650) }, | ||
276 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID) }, | 281 | { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID) }, |
277 | { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID) }, | 282 | { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID) }, |
278 | { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID) }, | 283 | { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID) }, |
@@ -286,6 +291,7 @@ static struct usb_device_id id_table_combined [] = { | |||
286 | { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID) }, | 291 | { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID) }, |
287 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID) }, | 292 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID) }, |
288 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID) }, | 293 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID) }, |
294 | { USB_DEVICE(TAPWAVE_VENDOR_ID, TAPWAVE_ZODIAC_ID) }, | ||
289 | { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID) }, | 295 | { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID) }, |
290 | { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) }, | 296 | { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) }, |
291 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) }, | 297 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) }, |
diff --git a/drivers/usb/serial/visor.h b/drivers/usb/serial/visor.h index a2fa2c61a009..b84d1cb4c693 100644 --- a/drivers/usb/serial/visor.h +++ b/drivers/usb/serial/visor.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define PALM_M125_ID 0x0040 | 30 | #define PALM_M125_ID 0x0040 |
31 | #define PALM_M130_ID 0x0050 | 31 | #define PALM_M130_ID 0x0050 |
32 | #define PALM_TUNGSTEN_T_ID 0x0060 | 32 | #define PALM_TUNGSTEN_T_ID 0x0060 |
33 | #define PALM_TREO_650 0x0061 | ||
33 | #define PALM_TUNGSTEN_Z_ID 0x0031 | 34 | #define PALM_TUNGSTEN_Z_ID 0x0031 |
34 | #define PALM_ZIRE31_ID 0x0061 | 35 | #define PALM_ZIRE31_ID 0x0061 |
35 | #define PALM_ZIRE_ID 0x0070 | 36 | #define PALM_ZIRE_ID 0x0070 |
@@ -49,6 +50,9 @@ | |||
49 | #define SAMSUNG_SCH_I330_ID 0x8001 | 50 | #define SAMSUNG_SCH_I330_ID 0x8001 |
50 | #define SAMSUNG_SPH_I500_ID 0x6601 | 51 | #define SAMSUNG_SPH_I500_ID 0x6601 |
51 | 52 | ||
53 | #define TAPWAVE_VENDOR_ID 0x12EF | ||
54 | #define TAPWAVE_ZODIAC_ID 0x0100 | ||
55 | |||
52 | #define GARMIN_VENDOR_ID 0x091E | 56 | #define GARMIN_VENDOR_ID 0x091E |
53 | #define GARMIN_IQUE_3600_ID 0x0004 | 57 | #define GARMIN_IQUE_3600_ID 0x0004 |
54 | 58 | ||
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 229ca181716b..8451779f4269 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c | |||
@@ -119,10 +119,8 @@ static int sddr55_status(struct us_data *us) | |||
119 | /* expect to get short transfer if no card fitted */ | 119 | /* expect to get short transfer if no card fitted */ |
120 | if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) { | 120 | if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) { |
121 | /* had a short transfer, no card inserted, free map memory */ | 121 | /* had a short transfer, no card inserted, free map memory */ |
122 | if (info->lba_to_pba) | 122 | kfree(info->lba_to_pba); |
123 | kfree(info->lba_to_pba); | 123 | kfree(info->pba_to_lba); |
124 | if (info->pba_to_lba) | ||
125 | kfree(info->pba_to_lba); | ||
126 | info->lba_to_pba = NULL; | 124 | info->lba_to_pba = NULL; |
127 | info->pba_to_lba = NULL; | 125 | info->pba_to_lba = NULL; |
128 | 126 | ||
@@ -649,18 +647,14 @@ static int sddr55_read_map(struct us_data *us) { | |||
649 | return -1; | 647 | return -1; |
650 | } | 648 | } |
651 | 649 | ||
652 | if (info->lba_to_pba) | 650 | kfree(info->lba_to_pba); |
653 | kfree(info->lba_to_pba); | 651 | kfree(info->pba_to_lba); |
654 | if (info->pba_to_lba) | ||
655 | kfree(info->pba_to_lba); | ||
656 | info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO); | 652 | info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO); |
657 | info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO); | 653 | info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO); |
658 | 654 | ||
659 | if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) { | 655 | if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) { |
660 | if (info->lba_to_pba != NULL) | 656 | kfree(info->lba_to_pba); |
661 | kfree(info->lba_to_pba); | 657 | kfree(info->pba_to_lba); |
662 | if (info->pba_to_lba != NULL) | ||
663 | kfree(info->pba_to_lba); | ||
664 | info->lba_to_pba = NULL; | 658 | info->lba_to_pba = NULL; |
665 | info->pba_to_lba = NULL; | 659 | info->pba_to_lba = NULL; |
666 | kfree(buffer); | 660 | kfree(buffer); |
@@ -728,10 +722,8 @@ static void sddr55_card_info_destructor(void *extra) { | |||
728 | if (!extra) | 722 | if (!extra) |
729 | return; | 723 | return; |
730 | 724 | ||
731 | if (info->lba_to_pba) | 725 | kfree(info->lba_to_pba); |
732 | kfree(info->lba_to_pba); | 726 | kfree(info->pba_to_lba); |
733 | if (info->pba_to_lba) | ||
734 | kfree(info->pba_to_lba); | ||
735 | } | 727 | } |
736 | 728 | ||
737 | 729 | ||
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index d2c3d2fa082e..9743e289cd3b 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -996,7 +996,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
996 | * command phase and the data phase. Some devices need a little | 996 | * command phase and the data phase. Some devices need a little |
997 | * more than that, probably because of clock rate inaccuracies. */ | 997 | * more than that, probably because of clock rate inaccuracies. */ |
998 | if (unlikely(us->flags & US_FL_GO_SLOW)) | 998 | if (unlikely(us->flags & US_FL_GO_SLOW)) |
999 | udelay(110); | 999 | udelay(125); |
1000 | 1000 | ||
1001 | if (transfer_length) { | 1001 | if (transfer_length) { |
1002 | unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ? | 1002 | unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ? |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index d53f777c4f50..fa68dea6bc6f 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -763,6 +763,19 @@ UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff, | |||
763 | US_FL_SINGLE_LUN ), | 763 | US_FL_SINGLE_LUN ), |
764 | #endif | 764 | #endif |
765 | 765 | ||
766 | #ifdef CONFIG_USB_STORAGE_DATAFAB | ||
767 | /* Reported by Felix Moeller <felix@derklecks.de> | ||
768 | * in Germany this is sold by Hama with the productnumber 46952 | ||
769 | * as "DualSlot CompactFlash(TM) & MStick Drive USB" | ||
770 | */ | ||
771 | UNUSUAL_DEV( 0x07c4, 0xa10b, 0x0000, 0xffff, | ||
772 | "DataFab Systems Inc.", | ||
773 | "USB CF+MS", | ||
774 | US_SC_SCSI, US_PR_DATAFAB, NULL, | ||
775 | 0 ), | ||
776 | |||
777 | #endif | ||
778 | |||
766 | /* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100 | 779 | /* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100 |
767 | * Only revision 1.13 tested (same for all of the above devices, | 780 | * Only revision 1.13 tested (same for all of the above devices, |
768 | * based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY. | 781 | * based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY. |