aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/sata_promise.c9
-rw-r--r--drivers/base/class.c59
-rw-r--r--drivers/base/core.c10
-rw-r--r--drivers/base/dd.c13
-rw-r--r--drivers/base/firmware_class.c4
-rw-r--r--drivers/block/loop.c100
-rw-r--r--drivers/cdrom/mcdx.c2
-rw-r--r--drivers/char/stallion.c81
-rw-r--r--drivers/isdn/hardware/eicon/divasfunc.c2
-rw-r--r--drivers/mmc/core/sd.c26
-rw-r--r--drivers/mmc/host/at91_mci.c5
-rw-r--r--drivers/mmc/host/au1xmmc.c3
-rw-r--r--drivers/tc/zs.c2
-rw-r--r--drivers/usb/atm/cxacru.c52
-rw-r--r--drivers/usb/class/usblp.c5
-rw-r--r--drivers/usb/core/Kconfig22
-rw-r--r--drivers/usb/core/config.c42
-rw-r--r--drivers/usb/gadget/epautoconf.c2
-rw-r--r--drivers/usb/gadget/inode.c8
-rw-r--r--drivers/usb/gadget/net2280.c6
-rw-r--r--drivers/usb/gadget/omap_udc.c6
-rw-r--r--drivers/usb/gadget/rndis.c35
-rw-r--r--drivers/usb/host/ohci-hub.c2
-rw-r--r--drivers/usb/storage/unusual_devs.h21
24 files changed, 320 insertions, 197 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 2b924a69b365..6dc0b011a6b7 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -784,9 +784,12 @@ static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
784 if (qc->dev->flags & ATA_DFLAG_CDB_INTR) 784 if (qc->dev->flags & ATA_DFLAG_CDB_INTR)
785 break; 785 break;
786 /*FALLTHROUGH*/ 786 /*FALLTHROUGH*/
787 case ATA_PROT_NODATA:
788 if (qc->tf.flags & ATA_TFLAG_POLLING)
789 break;
790 /*FALLTHROUGH*/
787 case ATA_PROT_ATAPI_DMA: 791 case ATA_PROT_ATAPI_DMA:
788 case ATA_PROT_DMA: 792 case ATA_PROT_DMA:
789 case ATA_PROT_NODATA:
790 pdc_packet_start(qc); 793 pdc_packet_start(qc);
791 return 0; 794 return 0;
792 795
@@ -800,7 +803,7 @@ static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
800static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 803static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
801{ 804{
802 WARN_ON (tf->protocol == ATA_PROT_DMA || 805 WARN_ON (tf->protocol == ATA_PROT_DMA ||
803 tf->protocol == ATA_PROT_NODATA); 806 tf->protocol == ATA_PROT_ATAPI_DMA);
804 ata_tf_load(ap, tf); 807 ata_tf_load(ap, tf);
805} 808}
806 809
@@ -808,7 +811,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
808static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 811static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
809{ 812{
810 WARN_ON (tf->protocol == ATA_PROT_DMA || 813 WARN_ON (tf->protocol == ATA_PROT_DMA ||
811 tf->protocol == ATA_PROT_NODATA); 814 tf->protocol == ATA_PROT_ATAPI_DMA);
812 ata_exec_command(ap, tf); 815 ata_exec_command(ap, tf);
813} 816}
814 817
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 20c4ea6eb50d..8c506dbe3913 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -369,36 +369,6 @@ char *make_class_name(const char *name, struct kobject *kobj)
369 return class_name; 369 return class_name;
370} 370}
371 371
372static int deprecated_class_uevent(char **envp, int num_envp, int *cur_index,
373 char *buffer, int buffer_size,
374 int *cur_len,
375 struct class_device *class_dev)
376{
377 struct device *dev = class_dev->dev;
378 char *path;
379
380 if (!dev)
381 return 0;
382
383 /* add device, backing this class device (deprecated) */
384 path = kobject_get_path(&dev->kobj, GFP_KERNEL);
385
386 add_uevent_var(envp, num_envp, cur_index, buffer, buffer_size,
387 cur_len, "PHYSDEVPATH=%s", path);
388 kfree(path);
389
390 if (dev->bus)
391 add_uevent_var(envp, num_envp, cur_index,
392 buffer, buffer_size, cur_len,
393 "PHYSDEVBUS=%s", dev->bus->name);
394
395 if (dev->driver)
396 add_uevent_var(envp, num_envp, cur_index,
397 buffer, buffer_size, cur_len,
398 "PHYSDEVDRIVER=%s", dev->driver->name);
399 return 0;
400}
401
402static int make_deprecated_class_device_links(struct class_device *class_dev) 372static int make_deprecated_class_device_links(struct class_device *class_dev)
403{ 373{
404 char *class_name; 374 char *class_name;
@@ -430,11 +400,6 @@ static void remove_deprecated_class_device_links(struct class_device *class_dev)
430 kfree(class_name); 400 kfree(class_name);
431} 401}
432#else 402#else
433static inline int deprecated_class_uevent(char **envp, int num_envp,
434 int *cur_index, char *buffer,
435 int buffer_size, int *cur_len,
436 struct class_device *class_dev)
437{ return 0; }
438static inline int make_deprecated_class_device_links(struct class_device *cd) 403static inline int make_deprecated_class_device_links(struct class_device *cd)
439{ return 0; } 404{ return 0; }
440static void remove_deprecated_class_device_links(struct class_device *cd) 405static void remove_deprecated_class_device_links(struct class_device *cd)
@@ -445,15 +410,13 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,
445 int num_envp, char *buffer, int buffer_size) 410 int num_envp, char *buffer, int buffer_size)
446{ 411{
447 struct class_device *class_dev = to_class_dev(kobj); 412 struct class_device *class_dev = to_class_dev(kobj);
413 struct device *dev = class_dev->dev;
448 int i = 0; 414 int i = 0;
449 int length = 0; 415 int length = 0;
450 int retval = 0; 416 int retval = 0;
451 417
452 pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); 418 pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id);
453 419
454 deprecated_class_uevent(envp, num_envp, &i, buffer, buffer_size,
455 &length, class_dev);
456
457 if (MAJOR(class_dev->devt)) { 420 if (MAJOR(class_dev->devt)) {
458 add_uevent_var(envp, num_envp, &i, 421 add_uevent_var(envp, num_envp, &i,
459 buffer, buffer_size, &length, 422 buffer, buffer_size, &length,
@@ -464,6 +427,26 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,
464 "MINOR=%u", MINOR(class_dev->devt)); 427 "MINOR=%u", MINOR(class_dev->devt));
465 } 428 }
466 429
430 if (dev) {
431 const char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
432 if (path) {
433 add_uevent_var(envp, num_envp, &i,
434 buffer, buffer_size, &length,
435 "PHYSDEVPATH=%s", path);
436 kfree(path);
437 }
438
439 if (dev->bus)
440 add_uevent_var(envp, num_envp, &i,
441 buffer, buffer_size, &length,
442 "PHYSDEVBUS=%s", dev->bus->name);
443
444 if (dev->driver)
445 add_uevent_var(envp, num_envp, &i,
446 buffer, buffer_size, &length,
447 "PHYSDEVDRIVER=%s", dev->driver->name);
448 }
449
467 /* terminate, set to next free slot, shrink available space */ 450 /* terminate, set to next free slot, shrink available space */
468 envp[i] = NULL; 451 envp[i] = NULL;
469 envp = &envp[i]; 452 envp = &envp[i];
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b78fc1e68264..dd40d78a023d 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -180,10 +180,12 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp,
180 const char *path; 180 const char *path;
181 181
182 path = kobject_get_path(&parent->kobj, GFP_KERNEL); 182 path = kobject_get_path(&parent->kobj, GFP_KERNEL);
183 add_uevent_var(envp, num_envp, &i, 183 if (path) {
184 buffer, buffer_size, &length, 184 add_uevent_var(envp, num_envp, &i,
185 "PHYSDEVPATH=%s", path); 185 buffer, buffer_size, &length,
186 kfree(path); 186 "PHYSDEVPATH=%s", path);
187 kfree(path);
188 }
187 189
188 add_uevent_var(envp, num_envp, &i, 190 add_uevent_var(envp, num_envp, &i,
189 buffer, buffer_size, &length, 191 buffer, buffer_size, &length,
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 92428e55b0c2..b0088b0efecd 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -207,19 +207,6 @@ static int __device_attach(struct device_driver * drv, void * data)
207 return driver_probe_device(drv, dev); 207 return driver_probe_device(drv, dev);
208} 208}
209 209
210static int device_probe_drivers(void *data)
211{
212 struct device *dev = data;
213 int ret = 0;
214
215 if (dev->bus) {
216 down(&dev->sem);
217 ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
218 up(&dev->sem);
219 }
220 return ret;
221}
222
223/** 210/**
224 * device_attach - try to attach device to a driver. 211 * device_attach - try to attach device to a driver.
225 * @dev: device. 212 * @dev: device.
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 97ab5bd1c4d6..89a5f4a54913 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * firmware_class.c - Multi purpose firmware loading support 2 * firmware_class.c - Multi purpose firmware loading support
3 * 3 *
4 * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> 4 * Copyright (c) 2003 Manuel Estrada Sainz
5 * 5 *
6 * Please see Documentation/firmware_class/ for more information. 6 * Please see Documentation/firmware_class/ for more information.
7 * 7 *
@@ -23,7 +23,7 @@
23 23
24#define to_dev(obj) container_of(obj, struct device, kobj) 24#define to_dev(obj) container_of(obj, struct device, kobj)
25 25
26MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>"); 26MODULE_AUTHOR("Manuel Estrada Sainz");
27MODULE_DESCRIPTION("Multi purpose firmware loading support"); 27MODULE_DESCRIPTION("Multi purpose firmware loading support");
28MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
29 29
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 5526eadb6592..0ed5470d2533 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1354,7 +1354,7 @@ static struct block_device_operations lo_fops = {
1354 */ 1354 */
1355static int max_loop; 1355static int max_loop;
1356module_param(max_loop, int, 0); 1356module_param(max_loop, int, 0);
1357MODULE_PARM_DESC(max_loop, "obsolete, loop device is created on-demand"); 1357MODULE_PARM_DESC(max_loop, "Maximum number of loop devices");
1358MODULE_LICENSE("GPL"); 1358MODULE_LICENSE("GPL");
1359MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); 1359MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
1360 1360
@@ -1394,16 +1394,11 @@ int loop_unregister_transfer(int number)
1394EXPORT_SYMBOL(loop_register_transfer); 1394EXPORT_SYMBOL(loop_register_transfer);
1395EXPORT_SYMBOL(loop_unregister_transfer); 1395EXPORT_SYMBOL(loop_unregister_transfer);
1396 1396
1397static struct loop_device *loop_init_one(int i) 1397static struct loop_device *loop_alloc(int i)
1398{ 1398{
1399 struct loop_device *lo; 1399 struct loop_device *lo;
1400 struct gendisk *disk; 1400 struct gendisk *disk;
1401 1401
1402 list_for_each_entry(lo, &loop_devices, lo_list) {
1403 if (lo->lo_number == i)
1404 return lo;
1405 }
1406
1407 lo = kzalloc(sizeof(*lo), GFP_KERNEL); 1402 lo = kzalloc(sizeof(*lo), GFP_KERNEL);
1408 if (!lo) 1403 if (!lo)
1409 goto out; 1404 goto out;
@@ -1427,8 +1422,6 @@ static struct loop_device *loop_init_one(int i)
1427 disk->private_data = lo; 1422 disk->private_data = lo;
1428 disk->queue = lo->lo_queue; 1423 disk->queue = lo->lo_queue;
1429 sprintf(disk->disk_name, "loop%d", i); 1424 sprintf(disk->disk_name, "loop%d", i);
1430 add_disk(disk);
1431 list_add_tail(&lo->lo_list, &loop_devices);
1432 return lo; 1425 return lo;
1433 1426
1434out_free_queue: 1427out_free_queue:
@@ -1439,15 +1432,37 @@ out:
1439 return NULL; 1432 return NULL;
1440} 1433}
1441 1434
1442static void loop_del_one(struct loop_device *lo) 1435static void loop_free(struct loop_device *lo)
1443{ 1436{
1444 del_gendisk(lo->lo_disk);
1445 blk_cleanup_queue(lo->lo_queue); 1437 blk_cleanup_queue(lo->lo_queue);
1446 put_disk(lo->lo_disk); 1438 put_disk(lo->lo_disk);
1447 list_del(&lo->lo_list); 1439 list_del(&lo->lo_list);
1448 kfree(lo); 1440 kfree(lo);
1449} 1441}
1450 1442
1443static struct loop_device *loop_init_one(int i)
1444{
1445 struct loop_device *lo;
1446
1447 list_for_each_entry(lo, &loop_devices, lo_list) {
1448 if (lo->lo_number == i)
1449 return lo;
1450 }
1451
1452 lo = loop_alloc(i);
1453 if (lo) {
1454 add_disk(lo->lo_disk);
1455 list_add_tail(&lo->lo_list, &loop_devices);
1456 }
1457 return lo;
1458}
1459
1460static void loop_del_one(struct loop_device *lo)
1461{
1462 del_gendisk(lo->lo_disk);
1463 loop_free(lo);
1464}
1465
1451static struct kobject *loop_probe(dev_t dev, int *part, void *data) 1466static struct kobject *loop_probe(dev_t dev, int *part, void *data)
1452{ 1467{
1453 struct loop_device *lo; 1468 struct loop_device *lo;
@@ -1464,28 +1479,77 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data)
1464 1479
1465static int __init loop_init(void) 1480static int __init loop_init(void)
1466{ 1481{
1467 if (register_blkdev(LOOP_MAJOR, "loop")) 1482 int i, nr;
1468 return -EIO; 1483 unsigned long range;
1469 blk_register_region(MKDEV(LOOP_MAJOR, 0), 1UL << MINORBITS, 1484 struct loop_device *lo, *next;
1470 THIS_MODULE, loop_probe, NULL, NULL); 1485
1486 /*
1487 * loop module now has a feature to instantiate underlying device
1488 * structure on-demand, provided that there is an access dev node.
1489 * However, this will not work well with user space tool that doesn't
1490 * know about such "feature". In order to not break any existing
1491 * tool, we do the following:
1492 *
1493 * (1) if max_loop is specified, create that many upfront, and this
1494 * also becomes a hard limit.
1495 * (2) if max_loop is not specified, create 8 loop device on module
1496 * load, user can further extend loop device by create dev node
1497 * themselves and have kernel automatically instantiate actual
1498 * device on-demand.
1499 */
1500 if (max_loop > 1UL << MINORBITS)
1501 return -EINVAL;
1471 1502
1472 if (max_loop) { 1503 if (max_loop) {
1473 printk(KERN_INFO "loop: the max_loop option is obsolete " 1504 nr = max_loop;
1474 "and will be removed in March 2008\n"); 1505 range = max_loop;
1506 } else {
1507 nr = 8;
1508 range = 1UL << MINORBITS;
1509 }
1510
1511 if (register_blkdev(LOOP_MAJOR, "loop"))
1512 return -EIO;
1475 1513
1514 for (i = 0; i < nr; i++) {
1515 lo = loop_alloc(i);
1516 if (!lo)
1517 goto Enomem;
1518 list_add_tail(&lo->lo_list, &loop_devices);
1476 } 1519 }
1520
1521 /* point of no return */
1522
1523 list_for_each_entry(lo, &loop_devices, lo_list)
1524 add_disk(lo->lo_disk);
1525
1526 blk_register_region(MKDEV(LOOP_MAJOR, 0), range,
1527 THIS_MODULE, loop_probe, NULL, NULL);
1528
1477 printk(KERN_INFO "loop: module loaded\n"); 1529 printk(KERN_INFO "loop: module loaded\n");
1478 return 0; 1530 return 0;
1531
1532Enomem:
1533 printk(KERN_INFO "loop: out of memory\n");
1534
1535 list_for_each_entry_safe(lo, next, &loop_devices, lo_list)
1536 loop_free(lo);
1537
1538 unregister_blkdev(LOOP_MAJOR, "loop");
1539 return -ENOMEM;
1479} 1540}
1480 1541
1481static void __exit loop_exit(void) 1542static void __exit loop_exit(void)
1482{ 1543{
1544 unsigned long range;
1483 struct loop_device *lo, *next; 1545 struct loop_device *lo, *next;
1484 1546
1547 range = max_loop ? max_loop : 1UL << MINORBITS;
1548
1485 list_for_each_entry_safe(lo, next, &loop_devices, lo_list) 1549 list_for_each_entry_safe(lo, next, &loop_devices, lo_list)
1486 loop_del_one(lo); 1550 loop_del_one(lo);
1487 1551
1488 blk_unregister_region(MKDEV(LOOP_MAJOR, 0), 1UL << MINORBITS); 1552 blk_unregister_region(MKDEV(LOOP_MAJOR, 0), range);
1489 if (unregister_blkdev(LOOP_MAJOR, "loop")) 1553 if (unregister_blkdev(LOOP_MAJOR, "loop"))
1490 printk(KERN_WARNING "loop: cannot unregister blkdev\n"); 1554 printk(KERN_WARNING "loop: cannot unregister blkdev\n");
1491} 1555}
diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index f574962f4288..4310cc84dfed 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -1053,11 +1053,11 @@ static void __exit mcdx_exit(void)
1053 if (unregister_blkdev(MAJOR_NR, "mcdx") != 0) { 1053 if (unregister_blkdev(MAJOR_NR, "mcdx") != 0) {
1054 xwarn("cleanup() unregister_blkdev() failed\n"); 1054 xwarn("cleanup() unregister_blkdev() failed\n");
1055 } 1055 }
1056 blk_cleanup_queue(mcdx_queue);
1057#if !MCDX_QUIET 1056#if !MCDX_QUIET
1058 else 1057 else
1059 xinfo("cleanup() succeeded\n"); 1058 xinfo("cleanup() succeeded\n");
1060#endif 1059#endif
1060 blk_cleanup_queue(mcdx_queue);
1061} 1061}
1062 1062
1063#ifdef MODULE 1063#ifdef MODULE
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index e45113a7a472..45bf2a262a85 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -2172,11 +2172,12 @@ static int __devinit stl_initech(struct stlbrd *brdp)
2172 } 2172 }
2173 status = inb(ioaddr + ECH_PNLSTATUS); 2173 status = inb(ioaddr + ECH_PNLSTATUS);
2174 if ((status & ECH_PNLIDMASK) != nxtid) 2174 if ((status & ECH_PNLIDMASK) != nxtid)
2175 goto err_fr; 2175 break;
2176 panelp = kzalloc(sizeof(struct stlpanel), GFP_KERNEL); 2176 panelp = kzalloc(sizeof(struct stlpanel), GFP_KERNEL);
2177 if (!panelp) { 2177 if (!panelp) {
2178 printk("STALLION: failed to allocate memory " 2178 printk("STALLION: failed to allocate memory "
2179 "(size=%Zd)\n", sizeof(struct stlpanel)); 2179 "(size=%Zd)\n", sizeof(struct stlpanel));
2180 retval = -ENOMEM;
2180 goto err_fr; 2181 goto err_fr;
2181 } 2182 }
2182 panelp->magic = STL_PANELMAGIC; 2183 panelp->magic = STL_PANELMAGIC;
@@ -2223,8 +2224,10 @@ static int __devinit stl_initech(struct stlbrd *brdp)
2223 brdp->nrports += panelp->nrports; 2224 brdp->nrports += panelp->nrports;
2224 brdp->panels[panelnr++] = panelp; 2225 brdp->panels[panelnr++] = panelp;
2225 if ((brdp->brdtype != BRD_ECHPCI) && 2226 if ((brdp->brdtype != BRD_ECHPCI) &&
2226 (ioaddr >= (brdp->ioaddr2 + brdp->iosize2))) 2227 (ioaddr >= (brdp->ioaddr2 + brdp->iosize2))) {
2228 retval = -EINVAL;
2227 goto err_fr; 2229 goto err_fr;
2230 }
2228 } 2231 }
2229 2232
2230 brdp->nrpanels = panelnr; 2233 brdp->nrpanels = panelnr;
@@ -2371,6 +2374,7 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev,
2371 dev_err(&pdev->dev, "too many boards found, " 2374 dev_err(&pdev->dev, "too many boards found, "
2372 "maximum supported %d\n", STL_MAXBRDS); 2375 "maximum supported %d\n", STL_MAXBRDS);
2373 mutex_unlock(&stl_brdslock); 2376 mutex_unlock(&stl_brdslock);
2377 retval = -ENODEV;
2374 goto err_fr; 2378 goto err_fr;
2375 } 2379 }
2376 brdp->brdnr = (unsigned int)brdnr; 2380 brdp->brdnr = (unsigned int)brdnr;
@@ -4710,6 +4714,29 @@ static int __init stallion_module_init(void)
4710 spin_lock_init(&stallion_lock); 4714 spin_lock_init(&stallion_lock);
4711 spin_lock_init(&brd_lock); 4715 spin_lock_init(&brd_lock);
4712 4716
4717 stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);
4718 if (!stl_serial) {
4719 retval = -ENOMEM;
4720 goto err;
4721 }
4722
4723 stl_serial->owner = THIS_MODULE;
4724 stl_serial->driver_name = stl_drvname;
4725 stl_serial->name = "ttyE";
4726 stl_serial->major = STL_SERIALMAJOR;
4727 stl_serial->minor_start = 0;
4728 stl_serial->type = TTY_DRIVER_TYPE_SERIAL;
4729 stl_serial->subtype = SERIAL_TYPE_NORMAL;
4730 stl_serial->init_termios = stl_deftermios;
4731 stl_serial->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
4732 tty_set_operations(stl_serial, &stl_ops);
4733
4734 retval = tty_register_driver(stl_serial);
4735 if (retval) {
4736 printk("STALLION: failed to register serial driver\n");
4737 goto err_frtty;
4738 }
4739
4713/* 4740/*
4714 * Find any dynamically supported boards. That is via module load 4741 * Find any dynamically supported boards. That is via module load
4715 * line options. 4742 * line options.
@@ -4739,13 +4766,9 @@ static int __init stallion_module_init(void)
4739 4766
4740 /* this has to be _after_ isa finding because of locking */ 4767 /* this has to be _after_ isa finding because of locking */
4741 retval = pci_register_driver(&stl_pcidriver); 4768 retval = pci_register_driver(&stl_pcidriver);
4742 if (retval && stl_nrbrds == 0) 4769 if (retval && stl_nrbrds == 0) {
4743 goto err; 4770 printk(KERN_ERR "STALLION: can't register pci driver\n");
4744 4771 goto err_unrtty;
4745 stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);
4746 if (!stl_serial) {
4747 retval = -ENOMEM;
4748 goto err_pcidr;
4749 } 4772 }
4750 4773
4751/* 4774/*
@@ -4756,43 +4779,18 @@ static int __init stallion_module_init(void)
4756 printk("STALLION: failed to register serial board device\n"); 4779 printk("STALLION: failed to register serial board device\n");
4757 4780
4758 stallion_class = class_create(THIS_MODULE, "staliomem"); 4781 stallion_class = class_create(THIS_MODULE, "staliomem");
4759 if (IS_ERR(stallion_class)) { 4782 if (IS_ERR(stallion_class))
4760 retval = PTR_ERR(stallion_class); 4783 printk("STALLION: failed to create class\n");
4761 goto err_reg;
4762 }
4763 for (i = 0; i < 4; i++) 4784 for (i = 0; i < 4; i++)
4764 class_device_create(stallion_class, NULL, 4785 class_device_create(stallion_class, NULL,
4765 MKDEV(STL_SIOMEMMAJOR, i), NULL, 4786 MKDEV(STL_SIOMEMMAJOR, i), NULL,
4766 "staliomem%d", i); 4787 "staliomem%d", i);
4767 4788
4768 stl_serial->owner = THIS_MODULE;
4769 stl_serial->driver_name = stl_drvname;
4770 stl_serial->name = "ttyE";
4771 stl_serial->major = STL_SERIALMAJOR;
4772 stl_serial->minor_start = 0;
4773 stl_serial->type = TTY_DRIVER_TYPE_SERIAL;
4774 stl_serial->subtype = SERIAL_TYPE_NORMAL;
4775 stl_serial->init_termios = stl_deftermios;
4776 stl_serial->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
4777 tty_set_operations(stl_serial, &stl_ops);
4778
4779 retval = tty_register_driver(stl_serial);
4780 if (retval) {
4781 printk("STALLION: failed to register serial driver\n");
4782 goto err_clsdev;
4783 }
4784
4785 return 0; 4789 return 0;
4786err_clsdev: 4790err_unrtty:
4787 for (i = 0; i < 4; i++) 4791 tty_unregister_driver(stl_serial);
4788 class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); 4792err_frtty:
4789 class_destroy(stallion_class);
4790err_reg:
4791 unregister_chrdev(STL_SIOMEMMAJOR, "staliomem");
4792 put_tty_driver(stl_serial); 4793 put_tty_driver(stl_serial);
4793err_pcidr:
4794 pci_unregister_driver(&stl_pcidriver);
4795 stl_free_isabrds();
4796err: 4794err:
4797 return retval; 4795 return retval;
4798} 4796}
@@ -4821,8 +4819,6 @@ static void __exit stallion_module_exit(void)
4821 tty_unregister_device(stl_serial, 4819 tty_unregister_device(stl_serial,
4822 brdp->brdnr * STL_MAXPORTS + j); 4820 brdp->brdnr * STL_MAXPORTS + j);
4823 } 4821 }
4824 tty_unregister_driver(stl_serial);
4825 put_tty_driver(stl_serial);
4826 4822
4827 for (i = 0; i < 4; i++) 4823 for (i = 0; i < 4; i++)
4828 class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); 4824 class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i));
@@ -4834,6 +4830,9 @@ static void __exit stallion_module_exit(void)
4834 pci_unregister_driver(&stl_pcidriver); 4830 pci_unregister_driver(&stl_pcidriver);
4835 4831
4836 stl_free_isabrds(); 4832 stl_free_isabrds();
4833
4834 tty_unregister_driver(stl_serial);
4835 put_tty_driver(stl_serial);
4837} 4836}
4838 4837
4839module_init(stallion_module_init); 4838module_init(stallion_module_init);
diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c
index 46fc21a3f8ff..d36a4c09e25d 100644
--- a/drivers/isdn/hardware/eicon/divasfunc.c
+++ b/drivers/isdn/hardware/eicon/divasfunc.c
@@ -195,7 +195,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
195/* 195/*
196 * disconnect from didd 196 * disconnect from didd
197 */ 197 */
198static void DIVA_EXIT_FUNCTION disconnect_didd(void) 198static void disconnect_didd(void)
199{ 199{
200 IDI_SYNC_REQ req; 200 IDI_SYNC_REQ req;
201 201
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index c1dfd03d559a..41bfb5dfe6ff 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -15,6 +15,7 @@
15#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
16#include <linux/mmc/card.h> 16#include <linux/mmc/card.h>
17#include <linux/mmc/mmc.h> 17#include <linux/mmc/mmc.h>
18#include <linux/mmc/sd.h>
18 19
19#include "core.h" 20#include "core.h"
20#include "sysfs.h" 21#include "sysfs.h"
@@ -192,6 +193,16 @@ static int mmc_read_switch(struct mmc_card *card)
192 int err; 193 int err;
193 u8 *status; 194 u8 *status;
194 195
196 if (card->scr.sda_vsn < SCR_SPEC_VER_1)
197 return MMC_ERR_NONE;
198
199 if (!(card->csd.cmdclass & CCC_SWITCH)) {
200 printk(KERN_WARNING "%s: card lacks mandatory switch "
201 "function, performance might suffer.\n",
202 mmc_hostname(card->host));
203 return MMC_ERR_NONE;
204 }
205
195 err = MMC_ERR_FAILED; 206 err = MMC_ERR_FAILED;
196 207
197 status = kmalloc(64, GFP_KERNEL); 208 status = kmalloc(64, GFP_KERNEL);
@@ -204,10 +215,9 @@ static int mmc_read_switch(struct mmc_card *card)
204 215
205 err = mmc_sd_switch(card, 0, 0, 1, status); 216 err = mmc_sd_switch(card, 0, 0, 1, status);
206 if (err != MMC_ERR_NONE) { 217 if (err != MMC_ERR_NONE) {
207 /* 218 printk(KERN_WARNING "%s: problem reading switch "
208 * Card not supporting high-speed will ignore the 219 "capabilities, performance might suffer.\n",
209 * command. 220 mmc_hostname(card->host));
210 */
211 err = MMC_ERR_NONE; 221 err = MMC_ERR_NONE;
212 goto out; 222 goto out;
213 } 223 }
@@ -229,6 +239,12 @@ static int mmc_switch_hs(struct mmc_card *card)
229 int err; 239 int err;
230 u8 *status; 240 u8 *status;
231 241
242 if (card->scr.sda_vsn < SCR_SPEC_VER_1)
243 return MMC_ERR_NONE;
244
245 if (!(card->csd.cmdclass & CCC_SWITCH))
246 return MMC_ERR_NONE;
247
232 if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) 248 if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
233 return MMC_ERR_NONE; 249 return MMC_ERR_NONE;
234 250
@@ -402,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
402 /* 418 /*
403 * Switch to wider bus (if supported). 419 * Switch to wider bus (if supported).
404 */ 420 */
405 if ((host->caps && MMC_CAP_4_BIT_DATA) && 421 if ((host->caps & MMC_CAP_4_BIT_DATA) &&
406 (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) { 422 (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
407 err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); 423 err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
408 if (err != MMC_ERR_NONE) 424 if (err != MMC_ERR_NONE)
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index e37943c314cb..5b00c194b628 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -417,7 +417,7 @@ static unsigned int at91_mci_send_command(struct at91mci_host *host, struct mmc_
417 blocks = 0; 417 blocks = 0;
418 } 418 }
419 419
420 if (cmd->opcode == MMC_STOP_TRANSMISSION) 420 if (host->flags & FL_SENT_STOP)
421 cmdr |= AT91_MCI_TRCMD_STOP; 421 cmdr |= AT91_MCI_TRCMD_STOP;
422 422
423 if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) 423 if (host->bus_mode == MMC_BUSMODE_OPENDRAIN)
@@ -563,8 +563,7 @@ static void at91mci_completed_command(struct at91mci_host *host)
563 if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE | 563 if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE |
564 AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | 564 AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE |
565 AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { 565 AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) {
566 if ((status & AT91_MCI_RCRCE) && 566 if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
567 ((cmd->opcode == MMC_SEND_OP_COND) || (cmd->opcode == SD_APP_OP_COND))) {
568 cmd->error = MMC_ERR_NONE; 567 cmd->error = MMC_ERR_NONE;
569 } 568 }
570 else { 569 else {
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index f967226d7505..52b63f11ddd6 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -76,8 +76,7 @@ const struct {
76#endif 76#endif
77}; 77};
78 78
79#define AU1XMMC_CONTROLLER_COUNT \ 79#define AU1XMMC_CONTROLLER_COUNT (ARRAY_SIZE(au1xmmc_card_table))
80 (sizeof(au1xmmc_card_table) / sizeof(au1xmmc_card_table[0]))
81 80
82/* This array stores pointers for the hosts (used by the IRQ handler) */ 81/* This array stores pointers for the hosts (used by the IRQ handler) */
83struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT]; 82struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT];
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c
index 3524e3fc08b9..61de78a9f6ee 100644
--- a/drivers/tc/zs.c
+++ b/drivers/tc/zs.c
@@ -2182,7 +2182,7 @@ struct dec_serial_hook zs_kgdbhook = {
2182 .init_info = kgdbhook_init_info, 2182 .init_info = kgdbhook_init_info,
2183 .rx_char = kgdbhook_rx_char, 2183 .rx_char = kgdbhook_rx_char,
2184 .cflags = B38400 | CS8 | CLOCAL, 2184 .cflags = B38400 | CS8 | CLOCAL,
2185} 2185};
2186 2186
2187void __init zs_kgdb_hook(int tty_num) 2187void __init zs_kgdb_hook(int tty_num)
2188{ 2188{
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 30b7bfbc985a..8bcf7fe1dd80 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -476,8 +476,6 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
476 add_timer(&timer); 476 add_timer(&timer);
477 wait_for_completion(done); 477 wait_for_completion(done);
478 status = urb->status; 478 status = urb->status;
479 if (status == -ECONNRESET)
480 status = -ETIMEDOUT;
481 del_timer_sync(&timer); 479 del_timer_sync(&timer);
482 480
483 if (actual_length) 481 if (actual_length)
@@ -629,10 +627,22 @@ static int cxacru_card_status(struct cxacru_data *instance)
629 return 0; 627 return 0;
630} 628}
631 629
630static void cxacru_remove_device_files(struct usbatm_data *usbatm_instance,
631 struct atm_dev *atm_dev)
632{
633 struct usb_interface *intf = usbatm_instance->usb_intf;
634
635 #define CXACRU_DEVICE_REMOVE_FILE(_name) \
636 device_remove_file(&intf->dev, &dev_attr_##_name);
637 CXACRU_ALL_FILES(REMOVE);
638 #undef CXACRU_DEVICE_REMOVE_FILE
639}
640
632static int cxacru_atm_start(struct usbatm_data *usbatm_instance, 641static int cxacru_atm_start(struct usbatm_data *usbatm_instance,
633 struct atm_dev *atm_dev) 642 struct atm_dev *atm_dev)
634{ 643{
635 struct cxacru_data *instance = usbatm_instance->driver_data; 644 struct cxacru_data *instance = usbatm_instance->driver_data;
645 struct usb_interface *intf = usbatm_instance->usb_intf;
636 /* 646 /*
637 struct atm_dev *atm_dev = usbatm_instance->atm_dev; 647 struct atm_dev *atm_dev = usbatm_instance->atm_dev;
638 */ 648 */
@@ -649,14 +659,18 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance,
649 return ret; 659 return ret;
650 } 660 }
651 661
662 #define CXACRU_DEVICE_CREATE_FILE(_name) \
663 ret = device_create_file(&intf->dev, &dev_attr_##_name); \
664 if (unlikely(ret)) \
665 goto fail_sysfs;
666 CXACRU_ALL_FILES(CREATE);
667 #undef CXACRU_DEVICE_CREATE_FILE
668
652 /* start ADSL */ 669 /* start ADSL */
653 mutex_lock(&instance->adsl_state_serialize); 670 mutex_lock(&instance->adsl_state_serialize);
654 ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0); 671 ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0);
655 if (ret < 0) { 672 if (ret < 0)
656 atm_err(usbatm_instance, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret); 673 atm_err(usbatm_instance, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret);
657 mutex_unlock(&instance->adsl_state_serialize);
658 return ret;
659 }
660 674
661 /* Start status polling */ 675 /* Start status polling */
662 mutex_lock(&instance->poll_state_serialize); 676 mutex_lock(&instance->poll_state_serialize);
@@ -680,6 +694,11 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance,
680 if (start_polling) 694 if (start_polling)
681 cxacru_poll_status(&instance->poll_work.work); 695 cxacru_poll_status(&instance->poll_work.work);
682 return 0; 696 return 0;
697
698fail_sysfs:
699 usb_err(usbatm_instance, "cxacru_atm_start: device_create_file failed (%d)\n", ret);
700 cxacru_remove_device_files(usbatm_instance, atm_dev);
701 return ret;
683} 702}
684 703
685static void cxacru_poll_status(struct work_struct *work) 704static void cxacru_poll_status(struct work_struct *work)
@@ -1065,13 +1084,6 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance,
1065 goto fail; 1084 goto fail;
1066 } 1085 }
1067 1086
1068 #define CXACRU_DEVICE_CREATE_FILE(_name) \
1069 ret = device_create_file(&intf->dev, &dev_attr_##_name); \
1070 if (unlikely(ret)) \
1071 goto fail_sysfs;
1072 CXACRU_ALL_FILES(CREATE);
1073 #undef CXACRU_DEVICE_CREATE_FILE
1074
1075 usb_fill_int_urb(instance->rcv_urb, 1087 usb_fill_int_urb(instance->rcv_urb,
1076 usb_dev, usb_rcvintpipe(usb_dev, CXACRU_EP_CMD), 1088 usb_dev, usb_rcvintpipe(usb_dev, CXACRU_EP_CMD),
1077 instance->rcv_buf, PAGE_SIZE, 1089 instance->rcv_buf, PAGE_SIZE,
@@ -1092,14 +1104,6 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance,
1092 1104
1093 return 0; 1105 return 0;
1094 1106
1095 fail_sysfs:
1096 dbg("cxacru_bind: device_create_file failed (%d)\n", ret);
1097
1098 #define CXACRU_DEVICE_REMOVE_FILE(_name) \
1099 device_remove_file(&intf->dev, &dev_attr_##_name);
1100 CXACRU_ALL_FILES(REMOVE);
1101 #undef CXACRU_DEVICE_REVOVE_FILE
1102
1103 fail: 1107 fail:
1104 free_page((unsigned long) instance->snd_buf); 1108 free_page((unsigned long) instance->snd_buf);
1105 free_page((unsigned long) instance->rcv_buf); 1109 free_page((unsigned long) instance->rcv_buf);
@@ -1146,11 +1150,6 @@ static void cxacru_unbind(struct usbatm_data *usbatm_instance,
1146 free_page((unsigned long) instance->snd_buf); 1150 free_page((unsigned long) instance->snd_buf);
1147 free_page((unsigned long) instance->rcv_buf); 1151 free_page((unsigned long) instance->rcv_buf);
1148 1152
1149 #define CXACRU_DEVICE_REMOVE_FILE(_name) \
1150 device_remove_file(&intf->dev, &dev_attr_##_name);
1151 CXACRU_ALL_FILES(REMOVE);
1152 #undef CXACRU_DEVICE_REVOVE_FILE
1153
1154 kfree(instance); 1153 kfree(instance);
1155 1154
1156 usbatm_instance->driver_data = NULL; 1155 usbatm_instance->driver_data = NULL;
@@ -1231,6 +1230,7 @@ static struct usbatm_driver cxacru_driver = {
1231 .heavy_init = cxacru_heavy_init, 1230 .heavy_init = cxacru_heavy_init,
1232 .unbind = cxacru_unbind, 1231 .unbind = cxacru_unbind,
1233 .atm_start = cxacru_atm_start, 1232 .atm_start = cxacru_atm_start,
1233 .atm_stop = cxacru_remove_device_files,
1234 .bulk_in = CXACRU_EP_DATA, 1234 .bulk_in = CXACRU_EP_DATA,
1235 .bulk_out = CXACRU_EP_DATA, 1235 .bulk_out = CXACRU_EP_DATA,
1236 .rx_padding = 3, 1236 .rx_padding = 3,
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 7b1edfe46b28..6778f9af7943 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -347,10 +347,8 @@ static int handle_bidir (struct usblp *usblp)
347 if (usblp->bidir && usblp->used && !usblp->sleeping) { 347 if (usblp->bidir && usblp->used && !usblp->sleeping) {
348 usblp->readcount = 0; 348 usblp->readcount = 0;
349 usblp->readurb->dev = usblp->dev; 349 usblp->readurb->dev = usblp->dev;
350 if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) { 350 if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0)
351 usblp->used = 0;
352 return -EIO; 351 return -EIO;
353 }
354 } 352 }
355 353
356 return 0; 354 return 0;
@@ -412,6 +410,7 @@ static int usblp_open(struct inode *inode, struct file *file)
412 usblp->readurb->status = 0; 410 usblp->readurb->status = 0;
413 411
414 if (handle_bidir(usblp) < 0) { 412 if (handle_bidir(usblp) < 0) {
413 usblp->used = 0;
415 file->private_data = NULL; 414 file->private_data = NULL;
416 retval = -EIO; 415 retval = -EIO;
417 } 416 }
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index f493fb1eaa27..346fc030c929 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -40,21 +40,25 @@ config USB_DEVICEFS
40config USB_DEVICE_CLASS 40config USB_DEVICE_CLASS
41 bool "USB device class-devices (DEPRECATED)" 41 bool "USB device class-devices (DEPRECATED)"
42 depends on USB 42 depends on USB
43 default n 43 default y
44 ---help--- 44 ---help---
45 Userspace access to USB devices is granted by device-nodes exported 45 Userspace access to USB devices is granted by device-nodes exported
46 directly from the usbdev in sysfs. Old versions of the driver 46 directly from the usbdev in sysfs. Old versions of the driver
47 core and udev needed additional class devices to export device nodes. 47 core and udev needed additional class devices to export device nodes.
48 48
49 These additional devices are difficult to handle in userspace, if 49 These additional devices are difficult to handle in userspace, if
50 information about USB interfaces must be available. One device contains 50 information about USB interfaces must be available. One device
51 the device node, the other device contains the interface data. Both 51 contains the device node, the other device contains the interface
52 devices are at the same level in sysfs (siblings) and one can't access 52 data. Both devices are at the same level in sysfs (siblings) and one
53 the other. The device node created directly by the usbdev is the parent 53 can't access the other. The device node created directly by the
54 device of the interface and therefore easily accessible from the interface 54 usb device is the parent device of the interface and therefore
55 event. 55 easily accessible from the interface event.
56 56
57 This option provides backward compatibility if needed. 57 This option provides backward compatibility for libusb device
58 nodes (lsusb) when usbfs is not used, and the following udev rule
59 doesn't exist:
60 SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \
61 NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644"
58 62
59config USB_DYNAMIC_MINORS 63config USB_DYNAMIC_MINORS
60 bool "Dynamic USB minor allocation (EXPERIMENTAL)" 64 bool "Dynamic USB minor allocation (EXPERIMENTAL)"
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 2d4fd530e5e4..dd3482328ad2 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -1,4 +1,5 @@
1#include <linux/usb.h> 1#include <linux/usb.h>
2#include <linux/usb/ch9.h>
2#include <linux/module.h> 3#include <linux/module.h>
3#include <linux/init.h> 4#include <linux/init.h>
4#include <linux/slab.h> 5#include <linux/slab.h>
@@ -49,7 +50,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
49 unsigned char *buffer0 = buffer; 50 unsigned char *buffer0 = buffer;
50 struct usb_endpoint_descriptor *d; 51 struct usb_endpoint_descriptor *d;
51 struct usb_host_endpoint *endpoint; 52 struct usb_host_endpoint *endpoint;
52 int n, i; 53 int n, i, j;
53 54
54 d = (struct usb_endpoint_descriptor *) buffer; 55 d = (struct usb_endpoint_descriptor *) buffer;
55 buffer += d->bLength; 56 buffer += d->bLength;
@@ -84,6 +85,45 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
84 memcpy(&endpoint->desc, d, n); 85 memcpy(&endpoint->desc, d, n);
85 INIT_LIST_HEAD(&endpoint->urb_list); 86 INIT_LIST_HEAD(&endpoint->urb_list);
86 87
88 /* If the bInterval value is outside the legal range,
89 * set it to a default value: 32 ms */
90 i = 0; /* i = min, j = max, n = default */
91 j = 255;
92 if (usb_endpoint_xfer_int(d)) {
93 i = 1;
94 switch (to_usb_device(ddev)->speed) {
95 case USB_SPEED_HIGH:
96 n = 9; /* 32 ms = 2^(9-1) uframes */
97 j = 16;
98 break;
99 default: /* USB_SPEED_FULL or _LOW */
100 /* For low-speed, 10 ms is the official minimum.
101 * But some "overclocked" devices might want faster
102 * polling so we'll allow it. */
103 n = 32;
104 break;
105 }
106 } else if (usb_endpoint_xfer_isoc(d)) {
107 i = 1;
108 j = 16;
109 switch (to_usb_device(ddev)->speed) {
110 case USB_SPEED_HIGH:
111 n = 9; /* 32 ms = 2^(9-1) uframes */
112 break;
113 default: /* USB_SPEED_FULL */
114 n = 6; /* 32 ms = 2^(6-1) frames */
115 break;
116 }
117 }
118 if (d->bInterval < i || d->bInterval > j) {
119 dev_warn(ddev, "config %d interface %d altsetting %d "
120 "endpoint 0x%X has an invalid bInterval %d, "
121 "changing to %d\n",
122 cfgno, inum, asnum,
123 d->bEndpointAddress, d->bInterval, n);
124 endpoint->desc.bInterval = n;
125 }
126
87 /* Skip over any Class Specific or Vendor Specific descriptors; 127 /* Skip over any Class Specific or Vendor Specific descriptors;
88 * find the next endpoint or interface descriptor */ 128 * find the next endpoint or interface descriptor */
89 endpoint->extra = buffer; 129 endpoint->extra = buffer;
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index f28af06905a5..6042364402b8 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -132,7 +132,7 @@ ep_matches (
132 * where it's an output parameter representing the full speed limit. 132 * where it's an output parameter representing the full speed limit.
133 * the usb spec fixes high speed bulk maxpacket at 512 bytes. 133 * the usb spec fixes high speed bulk maxpacket at 512 bytes.
134 */ 134 */
135 max = 0x7ff & le16_to_cpup (&desc->wMaxPacketSize); 135 max = 0x7ff & le16_to_cpu(desc->wMaxPacketSize);
136 switch (type) { 136 switch (type) {
137 case USB_ENDPOINT_XFER_INT: 137 case USB_ENDPOINT_XFER_INT:
138 /* INT: limit 64 bytes full speed, 1024 high speed */ 138 /* INT: limit 64 bytes full speed, 1024 high speed */
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 188c74a95216..46d0e5252744 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1369,12 +1369,12 @@ config_buf (struct dev_data *dev, u8 type, unsigned index)
1369 hs = !hs; 1369 hs = !hs;
1370 if (hs) { 1370 if (hs) {
1371 dev->req->buf = dev->hs_config; 1371 dev->req->buf = dev->hs_config;
1372 len = le16_to_cpup (&dev->hs_config->wTotalLength); 1372 len = le16_to_cpu(dev->hs_config->wTotalLength);
1373 } else 1373 } else
1374#endif 1374#endif
1375 { 1375 {
1376 dev->req->buf = dev->config; 1376 dev->req->buf = dev->config;
1377 len = le16_to_cpup (&dev->config->wTotalLength); 1377 len = le16_to_cpu(dev->config->wTotalLength);
1378 } 1378 }
1379 ((u8 *)dev->req->buf) [1] = type; 1379 ((u8 *)dev->req->buf) [1] = type;
1380 return len; 1380 return len;
@@ -1885,7 +1885,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
1885 1885
1886 /* full or low speed config */ 1886 /* full or low speed config */
1887 dev->config = (void *) kbuf; 1887 dev->config = (void *) kbuf;
1888 total = le16_to_cpup (&dev->config->wTotalLength); 1888 total = le16_to_cpu(dev->config->wTotalLength);
1889 if (!is_valid_config (dev->config) || total >= length) 1889 if (!is_valid_config (dev->config) || total >= length)
1890 goto fail; 1890 goto fail;
1891 kbuf += total; 1891 kbuf += total;
@@ -1894,7 +1894,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
1894 /* optional high speed config */ 1894 /* optional high speed config */
1895 if (kbuf [1] == USB_DT_CONFIG) { 1895 if (kbuf [1] == USB_DT_CONFIG) {
1896 dev->hs_config = (void *) kbuf; 1896 dev->hs_config = (void *) kbuf;
1897 total = le16_to_cpup (&dev->hs_config->wTotalLength); 1897 total = le16_to_cpu(dev->hs_config->wTotalLength);
1898 if (!is_valid_config (dev->hs_config) || total >= length) 1898 if (!is_valid_config (dev->hs_config) || total >= length)
1899 goto fail; 1899 goto fail;
1900 kbuf += total; 1900 kbuf += total;
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 52779c52b56d..d975ecf18e00 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2440,9 +2440,9 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
2440 2440
2441 tmp = 0; 2441 tmp = 0;
2442 2442
2443#define w_value le16_to_cpup (&u.r.wValue) 2443#define w_value le16_to_cpu(u.r.wValue)
2444#define w_index le16_to_cpup (&u.r.wIndex) 2444#define w_index le16_to_cpu(u.r.wIndex)
2445#define w_length le16_to_cpup (&u.r.wLength) 2445#define w_length le16_to_cpu(u.r.wLength)
2446 2446
2447 /* ack the irq */ 2447 /* ack the irq */
2448 writel (1 << SETUP_PACKET_INTERRUPT, &dev->regs->irqstat0); 2448 writel (1 << SETUP_PACKET_INTERRUPT, &dev->regs->irqstat0);
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index b394e63894d2..c4975a6cf777 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -1651,9 +1651,9 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1651 UDC_EP_NUM_REG = 0; 1651 UDC_EP_NUM_REG = 0;
1652 } while (UDC_IRQ_SRC_REG & UDC_SETUP); 1652 } while (UDC_IRQ_SRC_REG & UDC_SETUP);
1653 1653
1654#define w_value le16_to_cpup (&u.r.wValue) 1654#define w_value le16_to_cpu(u.r.wValue)
1655#define w_index le16_to_cpup (&u.r.wIndex) 1655#define w_index le16_to_cpu(u.r.wIndex)
1656#define w_length le16_to_cpup (&u.r.wLength) 1656#define w_length le16_to_cpu(u.r.wLength)
1657 1657
1658 /* Delegate almost all control requests to the gadget driver, 1658 /* Delegate almost all control requests to the gadget driver,
1659 * except for a handful of ch9 status/feature requests that 1659 * except for a handful of ch9 status/feature requests that
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 6ec8cf1a3ccb..708657c89132 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -186,10 +186,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
186 DEBUG("query OID %08x value, len %d:\n", OID, buf_len); 186 DEBUG("query OID %08x value, len %d:\n", OID, buf_len);
187 for (i = 0; i < buf_len; i += 16) { 187 for (i = 0; i < buf_len; i += 16) {
188 DEBUG ("%03d: %08x %08x %08x %08x\n", i, 188 DEBUG ("%03d: %08x %08x %08x %08x\n", i,
189 le32_to_cpup((__le32 *)&buf[i]), 189 le32_to_cpu(get_unaligned((__le32 *)
190 le32_to_cpup((__le32 *)&buf[i + 4]), 190 &buf[i])),
191 le32_to_cpup((__le32 *)&buf[i + 8]), 191 le32_to_cpu(get_unaligned((__le32 *)
192 le32_to_cpup((__le32 *)&buf[i + 12])); 192 &buf[i + 4])),
193 le32_to_cpu(get_unaligned((__le32 *)
194 &buf[i + 8])),
195 le32_to_cpu(get_unaligned((__le32 *)
196 &buf[i + 12])));
193 } 197 }
194 } 198 }
195 199
@@ -665,7 +669,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
665 break; 669 break;
666 case OID_PNP_QUERY_POWER: 670 case OID_PNP_QUERY_POWER:
667 DEBUG("%s: OID_PNP_QUERY_POWER D%d\n", __FUNCTION__, 671 DEBUG("%s: OID_PNP_QUERY_POWER D%d\n", __FUNCTION__,
668 le32_to_cpup((__le32 *) buf) - 1); 672 le32_to_cpu(get_unaligned((__le32 *)buf)) - 1);
669 /* only suspend is a real power state, and 673 /* only suspend is a real power state, and
670 * it can't be entered by OID_PNP_SET_POWER... 674 * it can't be entered by OID_PNP_SET_POWER...
671 */ 675 */
@@ -704,10 +708,14 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
704 DEBUG("set OID %08x value, len %d:\n", OID, buf_len); 708 DEBUG("set OID %08x value, len %d:\n", OID, buf_len);
705 for (i = 0; i < buf_len; i += 16) { 709 for (i = 0; i < buf_len; i += 16) {
706 DEBUG ("%03d: %08x %08x %08x %08x\n", i, 710 DEBUG ("%03d: %08x %08x %08x %08x\n", i,
707 le32_to_cpup((__le32 *)&buf[i]), 711 le32_to_cpu(get_unaligned((__le32 *)
708 le32_to_cpup((__le32 *)&buf[i + 4]), 712 &buf[i])),
709 le32_to_cpup((__le32 *)&buf[i + 8]), 713 le32_to_cpu(get_unaligned((__le32 *)
710 le32_to_cpup((__le32 *)&buf[i + 12])); 714 &buf[i + 4])),
715 le32_to_cpu(get_unaligned((__le32 *)
716 &buf[i + 8])),
717 le32_to_cpu(get_unaligned((__le32 *)
718 &buf[i + 12])));
711 } 719 }
712 } 720 }
713 721
@@ -721,7 +729,8 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
721 * PROMISCUOUS, DIRECTED, 729 * PROMISCUOUS, DIRECTED,
722 * MULTICAST, ALL_MULTICAST, BROADCAST 730 * MULTICAST, ALL_MULTICAST, BROADCAST
723 */ 731 */
724 *params->filter = (u16) le32_to_cpup((__le32 *)buf); 732 *params->filter = (u16) le32_to_cpu(get_unaligned(
733 (__le32 *)buf));
725 DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", 734 DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n",
726 __FUNCTION__, *params->filter); 735 __FUNCTION__, *params->filter);
727 736
@@ -771,7 +780,7 @@ update_linkstate:
771 * resuming, Windows forces a reset, and then SET_POWER D0. 780 * resuming, Windows forces a reset, and then SET_POWER D0.
772 * FIXME ... then things go batty; Windows wedges itself. 781 * FIXME ... then things go batty; Windows wedges itself.
773 */ 782 */
774 i = le32_to_cpup((__force __le32 *)buf); 783 i = le32_to_cpu(get_unaligned((__le32 *)buf));
775 DEBUG("%s: OID_PNP_SET_POWER D%d\n", __FUNCTION__, i - 1); 784 DEBUG("%s: OID_PNP_SET_POWER D%d\n", __FUNCTION__, i - 1);
776 switch (i) { 785 switch (i) {
777 case NdisDeviceStateD0: 786 case NdisDeviceStateD0:
@@ -1058,8 +1067,8 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
1058 return -ENOMEM; 1067 return -ENOMEM;
1059 1068
1060 tmp = (__le32 *) buf; 1069 tmp = (__le32 *) buf;
1061 MsgType = le32_to_cpup(tmp++); 1070 MsgType = le32_to_cpu(get_unaligned(tmp++));
1062 MsgLength = le32_to_cpup(tmp++); 1071 MsgLength = le32_to_cpu(get_unaligned(tmp++));
1063 1072
1064 if (configNr >= RNDIS_MAX_CONFIGS) 1073 if (configNr >= RNDIS_MAX_CONFIGS)
1065 return -ENOTSUPP; 1074 return -ENOTSUPP;
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 216c9c9d4d6d..bb9cc595219e 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -417,6 +417,8 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
417 unsigned long flags; 417 unsigned long flags;
418 418
419 spin_lock_irqsave (&ohci->lock, flags); 419 spin_lock_irqsave (&ohci->lock, flags);
420 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))
421 goto done;
420 422
421 /* undocumented erratum seen on at least rev D */ 423 /* undocumented erratum seen on at least rev D */
422 if ((ohci->flags & OHCI_QUIRK_AMD756) 424 if ((ohci->flags & OHCI_QUIRK_AMD756)
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index d230ee72f9cd..54979c239c63 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1179,8 +1179,8 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
1179 US_SC_DEVICE, US_PR_DEVICE, NULL, 1179 US_SC_DEVICE, US_PR_DEVICE, NULL,
1180 US_FL_FIX_INQUIRY ), 1180 US_FL_FIX_INQUIRY ),
1181 1181
1182/* These are virtual windows driver CDs, which the zd1211rw driver automatically 1182/* These are virtual windows driver CDs, which the zd1211rw driver
1183 * converts into a WLAN devices. */ 1183 * automatically converts into WLAN devices. */
1184UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101, 1184UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
1185 "ZyXEL", 1185 "ZyXEL",
1186 "G-220F USB-WLAN Install", 1186 "G-220F USB-WLAN Install",
@@ -1193,6 +1193,14 @@ UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0101,
1193 US_SC_DEVICE, US_PR_DEVICE, NULL, 1193 US_SC_DEVICE, US_PR_DEVICE, NULL,
1194 US_FL_IGNORE_DEVICE ), 1194 US_FL_IGNORE_DEVICE ),
1195 1195
1196/* SanDisk that has a second LUN for a driver ISO, reported by
1197 * Ben Collins <bcollins@ubuntu.com> */
1198UNUSUAL_DEV( 0x0781, 0x5406, 0x0000, 0xffff,
1199 "SanDisk",
1200 "U3 Cruzer Micro driver ISO",
1201 US_SC_DEVICE, US_PR_DEVICE, NULL,
1202 US_FL_SINGLE_LUN ),
1203
1196#ifdef CONFIG_USB_STORAGE_ISD200 1204#ifdef CONFIG_USB_STORAGE_ISD200
1197UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, 1205UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1198 "ATI", 1206 "ATI",
@@ -1271,6 +1279,15 @@ UNUSUAL_DEV( 0x0dd8, 0x1060, 0x0000, 0xffff,
1271 US_SC_DEVICE, US_PR_DEVICE, NULL, 1279 US_SC_DEVICE, US_PR_DEVICE, NULL,
1272 US_FL_FIX_INQUIRY ), 1280 US_FL_FIX_INQUIRY ),
1273 1281
1282/* Reported by Edward Chapman (taken from linux-usb mailing list)
1283 Netac OnlyDisk Mini U2CV2 512MB USB 2.0 Flash Drive */
1284UNUSUAL_DEV( 0x0dd8, 0xd202, 0x0000, 0x9999,
1285 "Netac",
1286 "USB Flash Disk",
1287 US_SC_DEVICE, US_PR_DEVICE, NULL,
1288 US_FL_IGNORE_RESIDUE ),
1289
1290
1274/* Patch by Stephan Walter <stephan.walter@epfl.ch> 1291/* Patch by Stephan Walter <stephan.walter@epfl.ch>
1275 * I don't know why, but it works... */ 1292 * I don't know why, but it works... */
1276UNUSUAL_DEV( 0x0dda, 0x0001, 0x0012, 0x0012, 1293UNUSUAL_DEV( 0x0dda, 0x0001, 0x0012, 0x0012,