aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/battery.c47
-rw-r--r--drivers/acpi/ec.c47
-rw-r--r--drivers/acpi/processor_idle.c32
-rw-r--r--drivers/acpi/tables/tbutils.c71
-rw-r--r--drivers/ata/libata-core.c7
-rw-r--r--drivers/ata/pata_it821x.c2
-rw-r--r--drivers/ata/pata_pdc2027x.c18
-rw-r--r--drivers/ata/pata_sis.c1
-rw-r--r--drivers/ata/pata_via.c5
-rw-r--r--drivers/char/tty_io.c6
-rw-r--r--drivers/lguest/Kconfig2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-i2c.c7
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c5
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c1
-rw-r--r--drivers/media/video/pwc/pwc-if.c52
-rw-r--r--drivers/media/video/pwc/pwc.h1
-rw-r--r--drivers/misc/asus-laptop.c3
-rw-r--r--drivers/mmc/core/bus.c4
-rw-r--r--drivers/mmc/core/host.c4
-rw-r--r--drivers/mmc/host/sdhci.c53
-rw-r--r--drivers/mmc/host/sdhci.h1
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c4
-rw-r--r--drivers/pci/pci.h8
-rw-r--r--drivers/pci/probe.c18
-rw-r--r--drivers/pci/quirks.c7
-rw-r--r--drivers/usb/Kconfig1
-rw-r--r--drivers/usb/atm/cxacru.c3
-rw-r--r--drivers/usb/atm/ueagle-atm.c5
-rw-r--r--drivers/usb/class/cdc-acm.c12
-rw-r--r--drivers/usb/core/driver.c9
-rw-r--r--drivers/usb/core/hub.c3
-rw-r--r--drivers/usb/core/message.c28
-rw-r--r--drivers/usb/core/quirks.c12
-rw-r--r--drivers/usb/gadget/dummy_hcd.c2
-rw-r--r--drivers/usb/gadget/file_storage.c10
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c77
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c4
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/ehci-au1xxx.c5
-rw-r--r--drivers/usb/host/ehci-ppc-soc.c22
-rw-r--r--drivers/usb/host/ohci-dbg.c2
-rw-r--r--drivers/usb/host/r8a66597-hcd.c2
-rw-r--r--drivers/usb/host/u132-hcd.c3
-rw-r--r--drivers/usb/serial/airprime.c1
-rw-r--r--drivers/usb/serial/belkin_sa.c4
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.h3
-rw-r--r--drivers/usb/serial/garmin_gps.c93
-rw-r--r--drivers/usb/serial/ipaq.c1
-rw-r--r--drivers/usb/serial/option.c10
-rw-r--r--drivers/usb/serial/oti6858.c10
-rw-r--r--drivers/usb/serial/safe_serial.c6
-rw-r--r--drivers/usb/serial/visor.c2
-rw-r--r--drivers/usb/serial/visor.h3
-rw-r--r--drivers/usb/storage/unusual_devs.h2
-rw-r--r--drivers/usb/storage/usb.c33
-rw-r--r--drivers/usb/storage/usb.h1
57 files changed, 500 insertions, 279 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index d7b499fe0cd9..81651032791b 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -113,7 +113,7 @@ struct acpi_battery_info {
113 acpi_string oem_info; 113 acpi_string oem_info;
114}; 114};
115 115
116enum acpi_battery_files { 116enum acpi_battery_files{
117 ACPI_BATTERY_INFO = 0, 117 ACPI_BATTERY_INFO = 0,
118 ACPI_BATTERY_STATE, 118 ACPI_BATTERY_STATE,
119 ACPI_BATTERY_ALARM, 119 ACPI_BATTERY_ALARM,
@@ -129,14 +129,13 @@ struct acpi_battery_flags {
129}; 129};
130 130
131struct acpi_battery { 131struct acpi_battery {
132 struct mutex mutex;
132 struct acpi_device *device; 133 struct acpi_device *device;
133 struct acpi_battery_flags flags; 134 struct acpi_battery_flags flags;
134 struct acpi_buffer bif_data; 135 struct acpi_buffer bif_data;
135 struct acpi_buffer bst_data; 136 struct acpi_buffer bst_data;
136 struct mutex lock;
137 unsigned long alarm; 137 unsigned long alarm;
138 unsigned long update_time[ACPI_BATTERY_NUMFILES]; 138 unsigned long update_time[ACPI_BATTERY_NUMFILES];
139
140}; 139};
141 140
142inline int acpi_battery_present(struct acpi_battery *battery) 141inline int acpi_battery_present(struct acpi_battery *battery)
@@ -236,10 +235,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
236 return 0; 235 return 0;
237 236
238 /* Evaluate _BIF */ 237 /* Evaluate _BIF */
239 mutex_lock(&battery->lock); 238
240 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", 239 status =
241 NULL, &buffer); 240 acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL,
242 mutex_unlock(&battery->lock); 241 &buffer);
243 if (ACPI_FAILURE(status)) { 242 if (ACPI_FAILURE(status)) {
244 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); 243 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
245 return -ENODEV; 244 return -ENODEV;
@@ -286,10 +285,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
286 return 0; 285 return 0;
287 286
288 /* Evaluate _BST */ 287 /* Evaluate _BST */
289 mutex_lock(&battery->lock); 288
290 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST", 289 status =
291 NULL, &buffer); 290 acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL,
292 mutex_unlock(&battery->lock); 291 &buffer);
293 if (ACPI_FAILURE(status)) { 292 if (ACPI_FAILURE(status)) {
294 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); 293 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
295 return -ENODEV; 294 return -ENODEV;
@@ -337,10 +336,9 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery,
337 336
338 arg0.integer.value = alarm; 337 arg0.integer.value = alarm;
339 338
340 mutex_lock(&battery->lock); 339 status =
341 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", 340 acpi_evaluate_object(acpi_battery_handle(battery), "_BTP",
342 &arg_list, NULL); 341 &arg_list, NULL);
343 mutex_unlock(&battery->lock);
344 if (ACPI_FAILURE(status)) 342 if (ACPI_FAILURE(status))
345 return -ENODEV; 343 return -ENODEV;
346 344
@@ -660,6 +658,8 @@ acpi_battery_write_alarm(struct file *file,
660 if (!battery || (count > sizeof(alarm_string) - 1)) 658 if (!battery || (count > sizeof(alarm_string) - 1))
661 return -EINVAL; 659 return -EINVAL;
662 660
661 mutex_lock(&battery->mutex);
662
663 result = acpi_battery_update(battery, 1, &update_result); 663 result = acpi_battery_update(battery, 1, &update_result);
664 if (result) { 664 if (result) {
665 result = -ENODEV; 665 result = -ENODEV;
@@ -688,7 +688,9 @@ acpi_battery_write_alarm(struct file *file,
688 acpi_battery_check_result(battery, result); 688 acpi_battery_check_result(battery, result);
689 689
690 if (!result) 690 if (!result)
691 return count; 691 result = count;
692
693 mutex_unlock(&battery->mutex);
692 694
693 return result; 695 return result;
694} 696}
@@ -712,6 +714,8 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
712 int update_result = ACPI_BATTERY_NONE_UPDATE; 714 int update_result = ACPI_BATTERY_NONE_UPDATE;
713 int update = 0; 715 int update = 0;
714 716
717 mutex_lock(&battery->mutex);
718
715 update = (get_seconds() - battery->update_time[fid] >= update_time); 719 update = (get_seconds() - battery->update_time[fid] >= update_time);
716 update = (update | battery->flags.update[fid]); 720 update = (update | battery->flags.update[fid]);
717 721
@@ -729,6 +733,7 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
729 result = acpi_read_funcs[fid].print(seq, result); 733 result = acpi_read_funcs[fid].print(seq, result);
730 acpi_battery_check_result(battery, result); 734 acpi_battery_check_result(battery, result);
731 battery->flags.update[fid] = result; 735 battery->flags.update[fid] = result;
736 mutex_unlock(&battery->mutex);
732 return result; 737 return result;
733} 738}
734 739
@@ -892,7 +897,10 @@ static int acpi_battery_add(struct acpi_device *device)
892 if (!battery) 897 if (!battery)
893 return -ENOMEM; 898 return -ENOMEM;
894 899
895 mutex_init(&battery->lock); 900 mutex_init(&battery->mutex);
901
902 mutex_lock(&battery->mutex);
903
896 battery->device = device; 904 battery->device = device;
897 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); 905 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
898 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); 906 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
@@ -928,6 +936,7 @@ static int acpi_battery_add(struct acpi_device *device)
928 kfree(battery); 936 kfree(battery);
929 } 937 }
930 938
939 mutex_unlock(&battery->mutex);
931 940
932 return result; 941 return result;
933} 942}
@@ -942,6 +951,8 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
942 951
943 battery = acpi_driver_data(device); 952 battery = acpi_driver_data(device);
944 953
954 mutex_lock(&battery->mutex);
955
945 status = acpi_remove_notify_handler(device->handle, 956 status = acpi_remove_notify_handler(device->handle,
946 ACPI_ALL_NOTIFY, 957 ACPI_ALL_NOTIFY,
947 acpi_battery_notify); 958 acpi_battery_notify);
@@ -952,7 +963,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
952 963
953 kfree(battery->bst_data.pointer); 964 kfree(battery->bst_data.pointer);
954 965
955 mutex_destroy(&battery->lock); 966 mutex_unlock(&battery->mutex);
967
968 mutex_destroy(&battery->mutex);
956 969
957 kfree(battery); 970 kfree(battery);
958 971
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 56bee9e065cf..43749c86861f 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -696,14 +696,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
696 return AE_CTRL_TERMINATE; 696 return AE_CTRL_TERMINATE;
697} 697}
698 698
699static void ec_remove_handlers(struct acpi_ec *ec)
700{
701 acpi_remove_address_space_handler(ec->handle,
702 ACPI_ADR_SPACE_EC,
703 &acpi_ec_space_handler);
704 acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
705}
706
707static int acpi_ec_add(struct acpi_device *device) 699static int acpi_ec_add(struct acpi_device *device)
708{ 700{
709 struct acpi_ec *ec = NULL; 701 struct acpi_ec *ec = NULL;
@@ -727,13 +719,16 @@ static int acpi_ec_add(struct acpi_device *device)
727 /* Check if we found the boot EC */ 719 /* Check if we found the boot EC */
728 if (boot_ec) { 720 if (boot_ec) {
729 if (boot_ec->gpe == ec->gpe) { 721 if (boot_ec->gpe == ec->gpe) {
730 ec_remove_handlers(boot_ec); 722 /* We might have incorrect info for GL at boot time */
731 mutex_destroy(&boot_ec->lock); 723 mutex_lock(&boot_ec->lock);
732 kfree(boot_ec); 724 boot_ec->global_lock = ec->global_lock;
733 first_ec = boot_ec = NULL; 725 /* Copy handlers from new ec into boot ec */
726 list_splice(&ec->list, &boot_ec->list);
727 mutex_unlock(&boot_ec->lock);
728 kfree(ec);
729 ec = boot_ec;
734 } 730 }
735 } 731 } else
736 if (!first_ec)
737 first_ec = ec; 732 first_ec = ec;
738 ec->handle = device->handle; 733 ec->handle = device->handle;
739 acpi_driver_data(device) = ec; 734 acpi_driver_data(device) = ec;
@@ -762,6 +757,9 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
762 if (ec == first_ec) 757 if (ec == first_ec)
763 first_ec = NULL; 758 first_ec = NULL;
764 759
760 /* Don't touch boot EC */
761 if (boot_ec != ec)
762 kfree(ec);
765 return 0; 763 return 0;
766} 764}
767 765
@@ -825,7 +823,9 @@ static int acpi_ec_start(struct acpi_device *device)
825 if (!ec) 823 if (!ec)
826 return -EINVAL; 824 return -EINVAL;
827 825
828 ret = ec_install_handlers(ec); 826 /* Boot EC is already working */
827 if (ec != boot_ec)
828 ret = ec_install_handlers(ec);
829 829
830 /* EC is fully operational, allow queries */ 830 /* EC is fully operational, allow queries */
831 atomic_set(&ec->query_pending, 0); 831 atomic_set(&ec->query_pending, 0);
@@ -835,6 +835,7 @@ static int acpi_ec_start(struct acpi_device *device)
835 835
836static int acpi_ec_stop(struct acpi_device *device, int type) 836static int acpi_ec_stop(struct acpi_device *device, int type)
837{ 837{
838 acpi_status status;
838 struct acpi_ec *ec; 839 struct acpi_ec *ec;
839 840
840 if (!device) 841 if (!device)
@@ -843,7 +844,21 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
843 ec = acpi_driver_data(device); 844 ec = acpi_driver_data(device);
844 if (!ec) 845 if (!ec)
845 return -EINVAL; 846 return -EINVAL;
846 ec_remove_handlers(ec); 847
848 /* Don't touch boot EC */
849 if (ec == boot_ec)
850 return 0;
851
852 status = acpi_remove_address_space_handler(ec->handle,
853 ACPI_ADR_SPACE_EC,
854 &acpi_ec_space_handler);
855 if (ACPI_FAILURE(status))
856 return -ENODEV;
857
858 status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
859 if (ACPI_FAILURE(status))
860 return -ENODEV;
861
847 return 0; 862 return 0;
848} 863}
849 864
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index a8634a0655fc..d9b8af763e1e 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -63,6 +63,7 @@
63ACPI_MODULE_NAME("processor_idle"); 63ACPI_MODULE_NAME("processor_idle");
64#define ACPI_PROCESSOR_FILE_POWER "power" 64#define ACPI_PROCESSOR_FILE_POWER "power"
65#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) 65#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
66#define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY)
66#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ 67#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */
67#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ 68#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */
68static void (*pm_idle_save) (void) __read_mostly; 69static void (*pm_idle_save) (void) __read_mostly;
@@ -462,6 +463,9 @@ static void acpi_processor_idle(void)
462 * TBD: Can't get time duration while in C1, as resumes 463 * TBD: Can't get time duration while in C1, as resumes
463 * go to an ISR rather than here. Need to instrument 464 * go to an ISR rather than here. Need to instrument
464 * base interrupt handler. 465 * base interrupt handler.
466 *
467 * Note: the TSC better not stop in C1, sched_clock() will
468 * skew otherwise.
465 */ 469 */
466 sleep_ticks = 0xFFFFFFFF; 470 sleep_ticks = 0xFFFFFFFF;
467 break; 471 break;
@@ -469,6 +473,8 @@ static void acpi_processor_idle(void)
469 case ACPI_STATE_C2: 473 case ACPI_STATE_C2:
470 /* Get start time (ticks) */ 474 /* Get start time (ticks) */
471 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 475 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
476 /* Tell the scheduler that we are going deep-idle: */
477 sched_clock_idle_sleep_event();
472 /* Invoke C2 */ 478 /* Invoke C2 */
473 acpi_state_timer_broadcast(pr, cx, 1); 479 acpi_state_timer_broadcast(pr, cx, 1);
474 acpi_cstate_enter(cx); 480 acpi_cstate_enter(cx);
@@ -479,17 +485,22 @@ static void acpi_processor_idle(void)
479 /* TSC halts in C2, so notify users */ 485 /* TSC halts in C2, so notify users */
480 mark_tsc_unstable("possible TSC halt in C2"); 486 mark_tsc_unstable("possible TSC halt in C2");
481#endif 487#endif
488 /* Compute time (ticks) that we were actually asleep */
489 sleep_ticks = ticks_elapsed(t1, t2);
490
491 /* Tell the scheduler how much we idled: */
492 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
493
482 /* Re-enable interrupts */ 494 /* Re-enable interrupts */
483 local_irq_enable(); 495 local_irq_enable();
496 /* Do not account our idle-switching overhead: */
497 sleep_ticks -= cx->latency_ticks + C2_OVERHEAD;
498
484 current_thread_info()->status |= TS_POLLING; 499 current_thread_info()->status |= TS_POLLING;
485 /* Compute time (ticks) that we were actually asleep */
486 sleep_ticks =
487 ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD;
488 acpi_state_timer_broadcast(pr, cx, 0); 500 acpi_state_timer_broadcast(pr, cx, 0);
489 break; 501 break;
490 502
491 case ACPI_STATE_C3: 503 case ACPI_STATE_C3:
492
493 /* 504 /*
494 * disable bus master 505 * disable bus master
495 * bm_check implies we need ARB_DIS 506 * bm_check implies we need ARB_DIS
@@ -518,6 +529,8 @@ static void acpi_processor_idle(void)
518 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 529 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
519 /* Invoke C3 */ 530 /* Invoke C3 */
520 acpi_state_timer_broadcast(pr, cx, 1); 531 acpi_state_timer_broadcast(pr, cx, 1);
532 /* Tell the scheduler that we are going deep-idle: */
533 sched_clock_idle_sleep_event();
521 acpi_cstate_enter(cx); 534 acpi_cstate_enter(cx);
522 /* Get end time (ticks) */ 535 /* Get end time (ticks) */
523 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 536 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
@@ -531,12 +544,17 @@ static void acpi_processor_idle(void)
531 /* TSC halts in C3, so notify users */ 544 /* TSC halts in C3, so notify users */
532 mark_tsc_unstable("TSC halts in C3"); 545 mark_tsc_unstable("TSC halts in C3");
533#endif 546#endif
547 /* Compute time (ticks) that we were actually asleep */
548 sleep_ticks = ticks_elapsed(t1, t2);
549 /* Tell the scheduler how much we idled: */
550 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
551
534 /* Re-enable interrupts */ 552 /* Re-enable interrupts */
535 local_irq_enable(); 553 local_irq_enable();
554 /* Do not account our idle-switching overhead: */
555 sleep_ticks -= cx->latency_ticks + C3_OVERHEAD;
556
536 current_thread_info()->status |= TS_POLLING; 557 current_thread_info()->status |= TS_POLLING;
537 /* Compute time (ticks) that we were actually asleep */
538 sleep_ticks =
539 ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD;
540 acpi_state_timer_broadcast(pr, cx, 0); 558 acpi_state_timer_broadcast(pr, cx, 0);
541 break; 559 break;
542 560
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 1da64b4518c0..8cc9492ffbf2 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -51,6 +51,65 @@ ACPI_MODULE_NAME("tbutils")
51static acpi_physical_address 51static acpi_physical_address
52acpi_tb_get_root_table_entry(u8 * table_entry, 52acpi_tb_get_root_table_entry(u8 * table_entry,
53 acpi_native_uint table_entry_size); 53 acpi_native_uint table_entry_size);
54/*******************************************************************************
55 *
56 * FUNCTION: acpi_tb_check_xsdt
57 *
58 * PARAMETERS: address - Pointer to the XSDT
59 *
60 * RETURN: status
61 * AE_OK - XSDT is okay
62 * AE_NO_MEMORY - can't map XSDT
63 * AE_INVALID_TABLE_LENGTH - invalid table length
64 * AE_NULL_ENTRY - XSDT has NULL entry
65 *
66 * DESCRIPTION: validate XSDT
67******************************************************************************/
68
69static acpi_status
70acpi_tb_check_xsdt(acpi_physical_address address)
71{
72 struct acpi_table_header *table;
73 u32 length;
74 u64 xsdt_entry_address;
75 u8 *table_entry;
76 u32 table_count;
77 int i;
78
79 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
80 if (!table)
81 return AE_NO_MEMORY;
82
83 length = table->length;
84 acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
85 if (length < sizeof(struct acpi_table_header))
86 return AE_INVALID_TABLE_LENGTH;
87
88 table = acpi_os_map_memory(address, length);
89 if (!table)
90 return AE_NO_MEMORY;
91
92 /* Calculate the number of tables described in XSDT */
93 table_count =
94 (u32) ((table->length -
95 sizeof(struct acpi_table_header)) / sizeof(u64));
96 table_entry =
97 ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header);
98 for (i = 0; i < table_count; i++) {
99 ACPI_MOVE_64_TO_64(&xsdt_entry_address, table_entry);
100 if (!xsdt_entry_address) {
101 /* XSDT has NULL entry */
102 break;
103 }
104 table_entry += sizeof(u64);
105 }
106 acpi_os_unmap_memory(table, length);
107
108 if (i < table_count)
109 return AE_NULL_ENTRY;
110 else
111 return AE_OK;
112}
54 113
55/******************************************************************************* 114/*******************************************************************************
56 * 115 *
@@ -341,6 +400,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
341 u32 table_count; 400 u32 table_count;
342 struct acpi_table_header *table; 401 struct acpi_table_header *table;
343 acpi_physical_address address; 402 acpi_physical_address address;
403 acpi_physical_address rsdt_address;
344 u32 length; 404 u32 length;
345 u8 *table_entry; 405 u8 *table_entry;
346 acpi_status status; 406 acpi_status status;
@@ -369,6 +429,8 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
369 */ 429 */
370 address = (acpi_physical_address) rsdp->xsdt_physical_address; 430 address = (acpi_physical_address) rsdp->xsdt_physical_address;
371 table_entry_size = sizeof(u64); 431 table_entry_size = sizeof(u64);
432 rsdt_address = (acpi_physical_address)
433 rsdp->rsdt_physical_address;
372 } else { 434 } else {
373 /* Root table is an RSDT (32-bit physical addresses) */ 435 /* Root table is an RSDT (32-bit physical addresses) */
374 436
@@ -382,6 +444,15 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
382 */ 444 */
383 acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); 445 acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp));
384 446
447 if (table_entry_size == sizeof(u64)) {
448 if (acpi_tb_check_xsdt(address) == AE_NULL_ENTRY) {
449 /* XSDT has NULL entry, RSDT is used */
450 address = rsdt_address;
451 table_entry_size = sizeof(u32);
452 ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry,"
453 "using RSDT"));
454 }
455 }
385 /* Map the RSDT/XSDT table header to get the full table length */ 456 /* Map the RSDT/XSDT table header to get the full table length */
386 457
387 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); 458 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 99d4fbffb0df..2ad4dda6d4a7 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3700,11 +3700,16 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags)
3700 goto fail; 3700 goto fail;
3701 3701
3702 /* verify n_sectors hasn't changed */ 3702 /* verify n_sectors hasn't changed */
3703 if (dev->class == ATA_DEV_ATA && dev->n_sectors != n_sectors) { 3703 if (dev->class == ATA_DEV_ATA && n_sectors &&
3704 dev->n_sectors != n_sectors) {
3704 ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch " 3705 ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch "
3705 "%llu != %llu\n", 3706 "%llu != %llu\n",
3706 (unsigned long long)n_sectors, 3707 (unsigned long long)n_sectors,
3707 (unsigned long long)dev->n_sectors); 3708 (unsigned long long)dev->n_sectors);
3709
3710 /* restore original n_sectors */
3711 dev->n_sectors = n_sectors;
3712
3708 rc = -ENODEV; 3713 rc = -ENODEV;
3709 goto fail; 3714 goto fail;
3710 } 3715 }
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 430673be1df7..7225124d96c2 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -587,7 +587,7 @@ static int it821x_port_start(struct ata_port *ap)
587 itdev->want[1][1] = ATA_ANY; 587 itdev->want[1][1] = ATA_ANY;
588 itdev->last_device = -1; 588 itdev->last_device = -1;
589 589
590 if (pdev->revision == 0x11) { 590 if (pdev->revision == 0x10) {
591 itdev->timing10 = 1; 591 itdev->timing10 = 1;
592 /* Need to disable ATAPI DMA for this case */ 592 /* Need to disable ATAPI DMA for this case */
593 if (!itdev->smart) 593 if (!itdev->smart)
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 69a5aa4949f5..e3245b36269a 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -563,13 +563,13 @@ static long pdc_read_counter(struct ata_host *host)
563 u32 bccrl, bccrh, bccrlv, bccrhv; 563 u32 bccrl, bccrh, bccrlv, bccrhv;
564 564
565retry: 565retry:
566 bccrl = readl(mmio_base + PDC_BYTE_COUNT) & 0xffff; 566 bccrl = readl(mmio_base + PDC_BYTE_COUNT) & 0x7fff;
567 bccrh = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0xffff; 567 bccrh = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff;
568 rmb(); 568 rmb();
569 569
570 /* Read the counter values again for verification */ 570 /* Read the counter values again for verification */
571 bccrlv = readl(mmio_base + PDC_BYTE_COUNT) & 0xffff; 571 bccrlv = readl(mmio_base + PDC_BYTE_COUNT) & 0x7fff;
572 bccrhv = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0xffff; 572 bccrhv = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff;
573 rmb(); 573 rmb();
574 574
575 counter = (bccrh << 15) | bccrl; 575 counter = (bccrh << 15) | bccrl;
@@ -692,16 +692,16 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
692 struct timeval start_time, end_time; 692 struct timeval start_time, end_time;
693 long pll_clock, usec_elapsed; 693 long pll_clock, usec_elapsed;
694 694
695 /* Read current counter value */
696 start_count = pdc_read_counter(host);
697 do_gettimeofday(&start_time);
698
699 /* Start the test mode */ 695 /* Start the test mode */
700 scr = readl(mmio_base + PDC_SYS_CTL); 696 scr = readl(mmio_base + PDC_SYS_CTL);
701 PDPRINTK("scr[%X]\n", scr); 697 PDPRINTK("scr[%X]\n", scr);
702 writel(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL); 698 writel(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL);
703 readl(mmio_base + PDC_SYS_CTL); /* flush */ 699 readl(mmio_base + PDC_SYS_CTL); /* flush */
704 700
701 /* Read current counter value */
702 start_count = pdc_read_counter(host);
703 do_gettimeofday(&start_time);
704
705 /* Let the counter run for 100 ms. */ 705 /* Let the counter run for 100 ms. */
706 mdelay(100); 706 mdelay(100);
707 707
@@ -719,7 +719,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
719 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + 719 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
720 (end_time.tv_usec - start_time.tv_usec); 720 (end_time.tv_usec - start_time.tv_usec);
721 721
722 pll_clock = (start_count - end_count) / 100 * 722 pll_clock = ((start_count - end_count) & 0x3fffffff) / 100 *
723 (100000000 / usec_elapsed); 723 (100000000 / usec_elapsed);
724 724
725 PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count); 725 PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count);
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 66bd0e83ac07..2bd7645f1a88 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -54,6 +54,7 @@ struct sis_laptop {
54static const struct sis_laptop sis_laptop[] = { 54static const struct sis_laptop sis_laptop[] = {
55 /* devid, subvendor, subdev */ 55 /* devid, subvendor, subdev */
56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ 56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
57 { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */
57 /* end marker */ 58 /* end marker */
58 { 0, } 59 { 0, }
59}; 60};
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index f645fe22cd1e..ea18e33f50ef 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -63,7 +63,7 @@
63#include <linux/dmi.h> 63#include <linux/dmi.h>
64 64
65#define DRV_NAME "pata_via" 65#define DRV_NAME "pata_via"
66#define DRV_VERSION "0.3.1" 66#define DRV_VERSION "0.3.2"
67 67
68/* 68/*
69 * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx 69 * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx
@@ -144,6 +144,9 @@ static int via_cable_override(struct pci_dev *pdev)
144 /* Systems by DMI */ 144 /* Systems by DMI */
145 if (dmi_check_system(cable_dmi_table)) 145 if (dmi_check_system(cable_dmi_table))
146 return 1; 146 return 1;
147 /* Arima W730-K8/Targa Visionary 811/... */
148 if (pdev->subsystem_vendor == 0x161F && pdev->subsystem_device == 0x2032)
149 return 1;
147 return 0; 150 return 0;
148} 151}
149 152
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 51ea93cab6c4..9c867cf6de64 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2063,8 +2063,7 @@ static int init_dev(struct tty_driver *driver, int idx,
2063 } 2063 }
2064 2064
2065 if (!*tp_loc) { 2065 if (!*tp_loc) {
2066 tp = (struct ktermios *) kmalloc(sizeof(struct ktermios), 2066 tp = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
2067 GFP_KERNEL);
2068 if (!tp) 2067 if (!tp)
2069 goto free_mem_out; 2068 goto free_mem_out;
2070 *tp = driver->init_termios; 2069 *tp = driver->init_termios;
@@ -2094,8 +2093,7 @@ static int init_dev(struct tty_driver *driver, int idx,
2094 } 2093 }
2095 2094
2096 if (!*o_tp_loc) { 2095 if (!*o_tp_loc) {
2097 o_tp = (struct ktermios *) 2096 o_tp = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
2098 kmalloc(sizeof(struct ktermios), GFP_KERNEL);
2099 if (!o_tp) 2097 if (!o_tp)
2100 goto free_mem_out; 2098 goto free_mem_out;
2101 *o_tp = driver->other->init_termios; 2099 *o_tp = driver->other->init_termios;
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index fd6925f41647..41e2250613a1 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -1,6 +1,6 @@
1config LGUEST 1config LGUEST
2 tristate "Linux hypervisor example code" 2 tristate "Linux hypervisor example code"
3 depends on X86 && PARAVIRT && EXPERIMENTAL && !X86_PAE 3 depends on X86 && PARAVIRT && EXPERIMENTAL && !X86_PAE && FUTEX
4 select LGUEST_GUEST 4 select LGUEST_GUEST
5 select HVC_DRIVER 5 select HVC_DRIVER
6 ---help--- 6 ---help---
diff --git a/drivers/media/dvb/b2c2/flexcop-i2c.c b/drivers/media/dvb/b2c2/flexcop-i2c.c
index 02a0ea6e1c17..6bf858a436c9 100644
--- a/drivers/media/dvb/b2c2/flexcop-i2c.c
+++ b/drivers/media/dvb/b2c2/flexcop-i2c.c
@@ -135,6 +135,13 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs
135 struct flexcop_device *fc = i2c_get_adapdata(i2c_adap); 135 struct flexcop_device *fc = i2c_get_adapdata(i2c_adap);
136 int i, ret = 0; 136 int i, ret = 0;
137 137
138 /* Some drivers use 1 byte or 0 byte reads as probes, which this
139 * driver doesn't support. These probes will always fail, so this
140 * hack makes them always succeed. If one knew how, it would of
141 * course be better to actually do the read. */
142 if (num == 1 && msgs[0].flags == I2C_M_RD && msgs[0].len <= 1)
143 return 1;
144
138 if (mutex_lock_interruptible(&fc->i2c_mutex)) 145 if (mutex_lock_interruptible(&fc->i2c_mutex))
139 return -ERESTARTSYS; 146 return -ERESTARTSYS;
140 147
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index acf026342ec5..bdd797071cb0 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -800,7 +800,8 @@ static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
800} 800}
801 801
802 802
803static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len) 803static void dvb_net_sec(struct net_device *dev, const u8 *pkt, int
804pkt_len)
804{ 805{
805 u8 *eth; 806 u8 *eth;
806 struct sk_buff *skb; 807 struct sk_buff *skb;
@@ -902,7 +903,7 @@ static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
902 * we rely on the DVB API definition where exactly one complete 903 * we rely on the DVB API definition where exactly one complete
903 * section is delivered in buffer1 904 * section is delivered in buffer1
904 */ 905 */
905 dvb_net_sec (dev, (u8*) buffer1, buffer1_len); 906 dvb_net_sec (dev, buffer1, buffer1_len);
906 return 0; 907 return 0;
907} 908}
908 909
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 2c7b158ce7e1..40307f3f6fe3 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1772,6 +1772,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
1772 if (dev->alt_max_pkt_size == NULL) { 1772 if (dev->alt_max_pkt_size == NULL) {
1773 em28xx_errdev("out of memory!\n"); 1773 em28xx_errdev("out of memory!\n");
1774 em28xx_devused&=~(1<<nr); 1774 em28xx_devused&=~(1<<nr);
1775 kfree(dev);
1775 return -ENOMEM; 1776 return -ENOMEM;
1776 } 1777 }
1777 1778
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 9c0e8d18c2f6..3d81966d8c42 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -1196,12 +1196,19 @@ static int pwc_video_open(struct inode *inode, struct file *file)
1196 return 0; 1196 return 0;
1197} 1197}
1198 1198
1199
1200static void pwc_cleanup(struct pwc_device *pdev)
1201{
1202 pwc_remove_sysfs_files(pdev->vdev);
1203 video_unregister_device(pdev->vdev);
1204}
1205
1199/* Note that all cleanup is done in the reverse order as in _open */ 1206/* Note that all cleanup is done in the reverse order as in _open */
1200static int pwc_video_close(struct inode *inode, struct file *file) 1207static int pwc_video_close(struct inode *inode, struct file *file)
1201{ 1208{
1202 struct video_device *vdev = file->private_data; 1209 struct video_device *vdev = file->private_data;
1203 struct pwc_device *pdev; 1210 struct pwc_device *pdev;
1204 int i; 1211 int i, hint;
1205 1212
1206 PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); 1213 PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev);
1207 1214
@@ -1224,8 +1231,9 @@ static int pwc_video_close(struct inode *inode, struct file *file)
1224 pwc_isoc_cleanup(pdev); 1231 pwc_isoc_cleanup(pdev);
1225 pwc_free_buffers(pdev); 1232 pwc_free_buffers(pdev);
1226 1233
1234 lock_kernel();
1227 /* Turn off LEDS and power down camera, but only when not unplugged */ 1235 /* Turn off LEDS and power down camera, but only when not unplugged */
1228 if (pdev->error_status != EPIPE) { 1236 if (!pdev->unplugged) {
1229 /* Turn LEDs off */ 1237 /* Turn LEDs off */
1230 if (pwc_set_leds(pdev, 0, 0) < 0) 1238 if (pwc_set_leds(pdev, 0, 0) < 0)
1231 PWC_DEBUG_MODULE("Failed to set LED on/off time.\n"); 1239 PWC_DEBUG_MODULE("Failed to set LED on/off time.\n");
@@ -1234,9 +1242,19 @@ static int pwc_video_close(struct inode *inode, struct file *file)
1234 if (i < 0) 1242 if (i < 0)
1235 PWC_ERROR("Failed to power down camera (%d)\n", i); 1243 PWC_ERROR("Failed to power down camera (%d)\n", i);
1236 } 1244 }
1245 pdev->vopen--;
1246 PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", i);
1247 } else {
1248 pwc_cleanup(pdev);
1249 /* Free memory (don't set pdev to 0 just yet) */
1250 kfree(pdev);
1251 /* search device_hint[] table if we occupy a slot, by any chance */
1252 for (hint = 0; hint < MAX_DEV_HINTS; hint++)
1253 if (device_hint[hint].pdev == pdev)
1254 device_hint[hint].pdev = NULL;
1237 } 1255 }
1238 pdev->vopen--; 1256 unlock_kernel();
1239 PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); 1257
1240 return 0; 1258 return 0;
1241} 1259}
1242 1260
@@ -1791,21 +1809,21 @@ static void usb_pwc_disconnect(struct usb_interface *intf)
1791 /* Alert waiting processes */ 1809 /* Alert waiting processes */
1792 wake_up_interruptible(&pdev->frameq); 1810 wake_up_interruptible(&pdev->frameq);
1793 /* Wait until device is closed */ 1811 /* Wait until device is closed */
1794 while (pdev->vopen) 1812 if(pdev->vopen) {
1795 schedule(); 1813 pdev->unplugged = 1;
1796 /* Device is now closed, so we can safely unregister it */ 1814 } else {
1797 PWC_DEBUG_PROBE("Unregistering video device in disconnect().\n"); 1815 /* Device is closed, so we can safely unregister it */
1798 pwc_remove_sysfs_files(pdev->vdev); 1816 PWC_DEBUG_PROBE("Unregistering video device in disconnect().\n");
1799 video_unregister_device(pdev->vdev); 1817 pwc_cleanup(pdev);
1800 1818 /* Free memory (don't set pdev to 0 just yet) */
1801 /* Free memory (don't set pdev to 0 just yet) */ 1819 kfree(pdev);
1802 kfree(pdev);
1803 1820
1804disconnect_out: 1821disconnect_out:
1805 /* search device_hint[] table if we occupy a slot, by any chance */ 1822 /* search device_hint[] table if we occupy a slot, by any chance */
1806 for (hint = 0; hint < MAX_DEV_HINTS; hint++) 1823 for (hint = 0; hint < MAX_DEV_HINTS; hint++)
1807 if (device_hint[hint].pdev == pdev) 1824 if (device_hint[hint].pdev == pdev)
1808 device_hint[hint].pdev = NULL; 1825 device_hint[hint].pdev = NULL;
1826 }
1809 1827
1810 unlock_kernel(); 1828 unlock_kernel();
1811} 1829}
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h
index 910a04f53920..8e8e5b27e77e 100644
--- a/drivers/media/video/pwc/pwc.h
+++ b/drivers/media/video/pwc/pwc.h
@@ -193,6 +193,7 @@ struct pwc_device
193 char vsnapshot; /* snapshot mode */ 193 char vsnapshot; /* snapshot mode */
194 char vsync; /* used by isoc handler */ 194 char vsync; /* used by isoc handler */
195 char vmirror; /* for ToUCaM series */ 195 char vmirror; /* for ToUCaM series */
196 char unplugged;
196 197
197 int cmd_len; 198 int cmd_len;
198 unsigned char cmd_buf[13]; 199 unsigned char cmd_buf[13];
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index d0fc4fd212e6..40db9f70148f 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -1072,7 +1072,8 @@ static void asus_backlight_exit(void)
1072} 1072}
1073 1073
1074#define ASUS_LED_UNREGISTER(object) \ 1074#define ASUS_LED_UNREGISTER(object) \
1075 led_classdev_unregister(&object##_led) 1075 if (object##_led.dev) \
1076 led_classdev_unregister(&object##_led)
1076 1077
1077static void asus_led_exit(void) 1078static void asus_led_exit(void)
1078{ 1079{
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index fe0e785ed7d2..817a79462b3d 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -186,12 +186,10 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host)
186{ 186{
187 struct mmc_card *card; 187 struct mmc_card *card;
188 188
189 card = kmalloc(sizeof(struct mmc_card), GFP_KERNEL); 189 card = kzalloc(sizeof(struct mmc_card), GFP_KERNEL);
190 if (!card) 190 if (!card)
191 return ERR_PTR(-ENOMEM); 191 return ERR_PTR(-ENOMEM);
192 192
193 memset(card, 0, sizeof(struct mmc_card));
194
195 card->host = host; 193 card->host = host;
196 194
197 device_initialize(&card->dev); 195 device_initialize(&card->dev);
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 6a7e29849603..2c7ce8f43a9a 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -58,12 +58,10 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
58{ 58{
59 struct mmc_host *host; 59 struct mmc_host *host;
60 60
61 host = kmalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); 61 host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
62 if (!host) 62 if (!host)
63 return NULL; 63 return NULL;
64 64
65 memset(host, 0, sizeof(struct mmc_host) + extra);
66
67 host->parent = dev; 65 host->parent = dev;
68 host->class_dev.parent = dev; 66 host->class_dev.parent = dev;
69 host->class_dev.class = &mmc_host_class; 67 host->class_dev.class = &mmc_host_class;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f2bc87ac24f7..20a7d89e01ba 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -385,6 +385,9 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
385 BUG_ON(data->blksz > host->mmc->max_blk_size); 385 BUG_ON(data->blksz > host->mmc->max_blk_size);
386 BUG_ON(data->blocks > 65535); 386 BUG_ON(data->blocks > 65535);
387 387
388 host->data = data;
389 host->data_early = 0;
390
388 /* timeout in us */ 391 /* timeout in us */
389 target_timeout = data->timeout_ns / 1000 + 392 target_timeout = data->timeout_ns / 1000 +
390 data->timeout_clks / host->clock; 393 data->timeout_clks / host->clock;
@@ -443,11 +446,11 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
443{ 446{
444 u16 mode; 447 u16 mode;
445 448
446 WARN_ON(host->data);
447
448 if (data == NULL) 449 if (data == NULL)
449 return; 450 return;
450 451
452 WARN_ON(!host->data);
453
451 mode = SDHCI_TRNS_BLK_CNT_EN; 454 mode = SDHCI_TRNS_BLK_CNT_EN;
452 if (data->blocks > 1) 455 if (data->blocks > 1)
453 mode |= SDHCI_TRNS_MULTI; 456 mode |= SDHCI_TRNS_MULTI;
@@ -477,8 +480,8 @@ static void sdhci_finish_data(struct sdhci_host *host)
477 /* 480 /*
478 * Controller doesn't count down when in single block mode. 481 * Controller doesn't count down when in single block mode.
479 */ 482 */
480 if ((data->blocks == 1) && (data->error == MMC_ERR_NONE)) 483 if (data->blocks == 1)
481 blocks = 0; 484 blocks = (data->error == MMC_ERR_NONE) ? 0 : 1;
482 else 485 else
483 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); 486 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT);
484 data->bytes_xfered = data->blksz * (data->blocks - blocks); 487 data->bytes_xfered = data->blksz * (data->blocks - blocks);
@@ -600,9 +603,10 @@ static void sdhci_finish_command(struct sdhci_host *host)
600 603
601 host->cmd->error = MMC_ERR_NONE; 604 host->cmd->error = MMC_ERR_NONE;
602 605
603 if (host->cmd->data) 606 if (host->data && host->data_early)
604 host->data = host->cmd->data; 607 sdhci_finish_data(host);
605 else 608
609 if (!host->cmd->data)
606 tasklet_schedule(&host->finish_tasklet); 610 tasklet_schedule(&host->finish_tasklet);
607 611
608 host->cmd = NULL; 612 host->cmd = NULL;
@@ -929,9 +933,9 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
929 BUG_ON(intmask == 0); 933 BUG_ON(intmask == 0);
930 934
931 if (!host->cmd) { 935 if (!host->cmd) {
932 printk(KERN_ERR "%s: Got command interrupt even though no " 936 printk(KERN_ERR "%s: Got command interrupt 0x%08x even "
933 "command operation was in progress.\n", 937 "though no command operation was in progress.\n",
934 mmc_hostname(host->mmc)); 938 mmc_hostname(host->mmc), (unsigned)intmask);
935 sdhci_dumpregs(host); 939 sdhci_dumpregs(host);
936 return; 940 return;
937 } 941 }
@@ -961,9 +965,9 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
961 if (intmask & SDHCI_INT_DATA_END) 965 if (intmask & SDHCI_INT_DATA_END)
962 return; 966 return;
963 967
964 printk(KERN_ERR "%s: Got data interrupt even though no " 968 printk(KERN_ERR "%s: Got data interrupt 0x%08x even "
965 "data operation was in progress.\n", 969 "though no data operation was in progress.\n",
966 mmc_hostname(host->mmc)); 970 mmc_hostname(host->mmc), (unsigned)intmask);
967 sdhci_dumpregs(host); 971 sdhci_dumpregs(host);
968 972
969 return; 973 return;
@@ -991,8 +995,18 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
991 writel(readl(host->ioaddr + SDHCI_DMA_ADDRESS), 995 writel(readl(host->ioaddr + SDHCI_DMA_ADDRESS),
992 host->ioaddr + SDHCI_DMA_ADDRESS); 996 host->ioaddr + SDHCI_DMA_ADDRESS);
993 997
994 if (intmask & SDHCI_INT_DATA_END) 998 if (intmask & SDHCI_INT_DATA_END) {
995 sdhci_finish_data(host); 999 if (host->cmd) {
1000 /*
1001 * Data managed to finish before the
1002 * command completed. Make sure we do
1003 * things in the proper order.
1004 */
1005 host->data_early = 1;
1006 } else {
1007 sdhci_finish_data(host);
1008 }
1009 }
996 } 1010 }
997} 1011}
998 1012
@@ -1347,12 +1361,11 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1347 */ 1361 */
1348 mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT; 1362 mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
1349 if (mmc->max_blk_size >= 3) { 1363 if (mmc->max_blk_size >= 3) {
1350 printk(KERN_ERR "%s: Invalid maximum block size.\n", 1364 printk(KERN_WARNING "%s: Invalid maximum block size, assuming 512\n",
1351 host->slot_descr); 1365 host->slot_descr);
1352 ret = -ENODEV; 1366 mmc->max_blk_size = 512;
1353 goto unmap; 1367 } else
1354 } 1368 mmc->max_blk_size = 512 << mmc->max_blk_size;
1355 mmc->max_blk_size = 512 << mmc->max_blk_size;
1356 1369
1357 /* 1370 /*
1358 * Maximum block count. 1371 * Maximum block count.
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index d157776c1149..e28987d6d2eb 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -182,6 +182,7 @@ struct sdhci_host {
182 struct mmc_request *mrq; /* Current request */ 182 struct mmc_request *mrq; /* Current request */
183 struct mmc_command *cmd; /* Current command */ 183 struct mmc_command *cmd; /* Current command */
184 struct mmc_data *data; /* Current data request */ 184 struct mmc_data *data; /* Current data request */
185 int data_early:1; /* Data finished before cmd */
185 186
186 struct scatterlist *cur_sg; /* We're working on this */ 187 struct scatterlist *cur_sg; /* We're working on this */
187 int num_sg; /* Entries left */ 188 int num_sg; /* Entries left */
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 79ff6b4de3a6..37d72f123a80 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -1746,10 +1746,8 @@ static void pushbutton_helper_thread(unsigned long data)
1746static int event_thread(void* data) 1746static int event_thread(void* data)
1747{ 1747{
1748 struct controller *ctrl; 1748 struct controller *ctrl;
1749 lock_kernel(); 1749
1750 daemonize("phpd_event"); 1750 daemonize("phpd_event");
1751
1752 unlock_kernel();
1753 1751
1754 while (1) { 1752 while (1) {
1755 dbg("!!!!event_thread sleeping\n"); 1753 dbg("!!!!event_thread sleeping\n");
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index c6e132d7c0f7..4c36e80f6d26 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -5,12 +5,7 @@ extern int pci_uevent(struct device *dev, char **envp, int num_envp,
5extern int pci_create_sysfs_dev_files(struct pci_dev *pdev); 5extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
6extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev); 6extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
7extern void pci_cleanup_rom(struct pci_dev *dev); 7extern void pci_cleanup_rom(struct pci_dev *dev);
8extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, 8
9 resource_size_t size, resource_size_t align,
10 resource_size_t min, unsigned int type_mask,
11 void (*alignf)(void *, struct resource *,
12 resource_size_t, resource_size_t),
13 void *alignf_data);
14/* Firmware callbacks */ 9/* Firmware callbacks */
15extern pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); 10extern pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
16extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); 11extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state);
@@ -35,7 +30,6 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; }
35 30
36/* Functions for PCI Hotplug drivers to use */ 31/* Functions for PCI Hotplug drivers to use */
37extern unsigned int pci_do_scan_bus(struct pci_bus *bus); 32extern unsigned int pci_do_scan_bus(struct pci_bus *bus);
38extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap);
39 33
40extern void pci_remove_legacy_files(struct pci_bus *bus); 34extern void pci_remove_legacy_files(struct pci_bus *bus);
41 35
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 34b8dae0d90f..27e00b2d7b5b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -653,20 +653,20 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
653 653
654 sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number); 654 sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number);
655 655
656 /* Has only triggered on CardBus, fixup is in yenta_socket */
656 while (bus->parent) { 657 while (bus->parent) {
657 if ((child->subordinate > bus->subordinate) || 658 if ((child->subordinate > bus->subordinate) ||
658 (child->number > bus->subordinate) || 659 (child->number > bus->subordinate) ||
659 (child->number < bus->number) || 660 (child->number < bus->number) ||
660 (child->subordinate < bus->number)) { 661 (child->subordinate < bus->number)) {
661 printk(KERN_WARNING "PCI: Bus #%02x (-#%02x) is " 662 pr_debug("PCI: Bus #%02x (-#%02x) is %s"
662 "hidden behind%s bridge #%02x (-#%02x)%s\n", 663 "hidden behind%s bridge #%02x (-#%02x)\n",
663 child->number, child->subordinate, 664 child->number, child->subordinate,
664 bus->self->transparent ? " transparent" : " ", 665 (bus->number > child->subordinate &&
665 bus->number, bus->subordinate, 666 bus->subordinate < child->number) ?
666 pcibios_assign_all_busses() ? " " : 667 "wholly " : " partially",
667 " (try 'pci=assign-busses')"); 668 bus->self->transparent ? " transparent" : " ",
668 printk(KERN_WARNING "Please report the result to " 669 bus->number, bus->subordinate);
669 "<bk@suse.de> to fix this permanently\n");
670 } 670 }
671 bus = bus->parent; 671 bus = bus->parent;
672 } 672 }
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index c559085c89a5..2d40f437b9fc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -947,7 +947,7 @@ static void k8t_sound_hostbridge(struct pci_dev *dev)
947 unsigned char val; 947 unsigned char val;
948 948
949 pci_read_config_byte(dev, 0x50, &val); 949 pci_read_config_byte(dev, 0x50, &val);
950 if (val == 0x88 || val == 0xc8) { 950 if (val == 0xc8) {
951 /* Assume it's probably a MSI-K8T-Neo2Fir */ 951 /* Assume it's probably a MSI-K8T-Neo2Fir */
952 printk(KERN_INFO "PCI: MSI-K8T-Neo2Fir, attempting to turn soundcard ON\n"); 952 printk(KERN_INFO "PCI: MSI-K8T-Neo2Fir, attempting to turn soundcard ON\n");
953 pci_write_config_byte(dev, 0x50, val & (~0x40)); 953 pci_write_config_byte(dev, 0x50, val & (~0x40));
@@ -1485,7 +1485,7 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
1485 1485
1486 iounmap(csr); 1486 iounmap(csr);
1487} 1487}
1488DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt); 1488DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt);
1489 1489
1490static void __devinit fixup_rev1_53c810(struct pci_dev* dev) 1490static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
1491{ 1491{
@@ -1650,6 +1650,9 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCN
1650DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi); 1650DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi);
1651DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi); 1651DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
1652DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi); 1652DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
1653DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RD580, quirk_disable_all_msi);
1654DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RX790, quirk_disable_all_msi);
1655DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS690, quirk_disable_all_msi);
1653DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi); 1656DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
1654 1657
1655/* Disable MSI on chipsets that are known to not support it */ 1658/* Disable MSI on chipsets that are known to not support it */
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 63436892688c..7580aa5da0f8 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -21,6 +21,7 @@ config USB_ARCH_HAS_HCD
21 default y if USB_ARCH_HAS_EHCI 21 default y if USB_ARCH_HAS_EHCI
22 default y if PCMCIA && !M32R # sl811_cs 22 default y if PCMCIA && !M32R # sl811_cs
23 default y if ARM # SL-811 23 default y if ARM # SL-811
24 default y if SUPERH # r8a66597-hcd
24 default PCI 25 default PCI
25 26
26# many non-PCI SOC chips embed OHCI 27# many non-PCI SOC chips embed OHCI
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 02c52f8d5dbf..a73e714288e5 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -456,7 +456,6 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
456 int* actual_length) 456 int* actual_length)
457{ 457{
458 struct timer_list timer; 458 struct timer_list timer;
459 int status = urb->status;
460 459
461 init_timer(&timer); 460 init_timer(&timer);
462 timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT); 461 timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT);
@@ -468,7 +467,7 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
468 467
469 if (actual_length) 468 if (actual_length)
470 *actual_length = urb->actual_length; 469 *actual_length = urb->actual_length;
471 return status; 470 return urb->status; /* must read status after completion */
472} 471}
473 472
474static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm, 473static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index a1a1c9d467e0..29807d048b04 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1721,9 +1721,12 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
1721 1721
1722 ret = uea_boot(sc); 1722 ret = uea_boot(sc);
1723 if (ret < 0) 1723 if (ret < 0)
1724 goto error; 1724 goto error_rm_grp;
1725 1725
1726 return 0; 1726 return 0;
1727
1728error_rm_grp:
1729 sysfs_remove_group(&intf->dev.kobj, &attr_grp);
1727error: 1730error:
1728 kfree(sc); 1731 kfree(sc);
1729 return ret; 1732 return ret;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index fe940e0536e0..f51e22490edf 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -921,6 +921,10 @@ skip_normal_probe:
921 return -EINVAL; 921 return -EINVAL;
922 } 922 }
923 } 923 }
924
925 /* Accept probe requests only for the control interface */
926 if (intf != control_interface)
927 return -ENODEV;
924 928
925 if (usb_interface_claimed(data_interface)) { /* valid in this context */ 929 if (usb_interface_claimed(data_interface)) { /* valid in this context */
926 dev_dbg(&intf->dev,"The data interface isn't available"); 930 dev_dbg(&intf->dev,"The data interface isn't available");
@@ -1109,10 +1113,12 @@ static void acm_disconnect(struct usb_interface *intf)
1109 return; 1113 return;
1110 } 1114 }
1111 if (acm->country_codes){ 1115 if (acm->country_codes){
1112 device_remove_file(&intf->dev, &dev_attr_wCountryCodes); 1116 device_remove_file(&acm->control->dev,
1113 device_remove_file(&intf->dev, &dev_attr_iCountryCodeRelDate); 1117 &dev_attr_wCountryCodes);
1118 device_remove_file(&acm->control->dev,
1119 &dev_attr_iCountryCodeRelDate);
1114 } 1120 }
1115 device_remove_file(&intf->dev, &dev_attr_bmCapabilities); 1121 device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities);
1116 acm->dev = NULL; 1122 acm->dev = NULL;
1117 usb_set_intfdata(acm->control, NULL); 1123 usb_set_intfdata(acm->control, NULL);
1118 usb_set_intfdata(acm->data, NULL); 1124 usb_set_intfdata(acm->data, NULL);
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 654857493a82..a1ad11d0c47c 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1224,6 +1224,8 @@ static int usb_autopm_do_device(struct usb_device *udev, int inc_usage_cnt)
1224 udev->auto_pm = 1; 1224 udev->auto_pm = 1;
1225 udev->pm_usage_cnt += inc_usage_cnt; 1225 udev->pm_usage_cnt += inc_usage_cnt;
1226 WARN_ON(udev->pm_usage_cnt < 0); 1226 WARN_ON(udev->pm_usage_cnt < 0);
1227 if (inc_usage_cnt)
1228 udev->last_busy = jiffies;
1227 if (inc_usage_cnt >= 0 && udev->pm_usage_cnt > 0) { 1229 if (inc_usage_cnt >= 0 && udev->pm_usage_cnt > 0) {
1228 if (udev->state == USB_STATE_SUSPENDED) 1230 if (udev->state == USB_STATE_SUSPENDED)
1229 status = usb_resume_both(udev); 1231 status = usb_resume_both(udev);
@@ -1232,8 +1234,6 @@ static int usb_autopm_do_device(struct usb_device *udev, int inc_usage_cnt)
1232 else if (inc_usage_cnt) 1234 else if (inc_usage_cnt)
1233 udev->last_busy = jiffies; 1235 udev->last_busy = jiffies;
1234 } else if (inc_usage_cnt <= 0 && udev->pm_usage_cnt <= 0) { 1236 } else if (inc_usage_cnt <= 0 && udev->pm_usage_cnt <= 0) {
1235 if (inc_usage_cnt)
1236 udev->last_busy = jiffies;
1237 status = usb_suspend_both(udev, PMSG_SUSPEND); 1237 status = usb_suspend_both(udev, PMSG_SUSPEND);
1238 } 1238 }
1239 usb_pm_unlock(udev); 1239 usb_pm_unlock(udev);
@@ -1342,16 +1342,15 @@ static int usb_autopm_do_interface(struct usb_interface *intf,
1342 else { 1342 else {
1343 udev->auto_pm = 1; 1343 udev->auto_pm = 1;
1344 intf->pm_usage_cnt += inc_usage_cnt; 1344 intf->pm_usage_cnt += inc_usage_cnt;
1345 udev->last_busy = jiffies;
1345 if (inc_usage_cnt >= 0 && intf->pm_usage_cnt > 0) { 1346 if (inc_usage_cnt >= 0 && intf->pm_usage_cnt > 0) {
1346 if (udev->state == USB_STATE_SUSPENDED) 1347 if (udev->state == USB_STATE_SUSPENDED)
1347 status = usb_resume_both(udev); 1348 status = usb_resume_both(udev);
1348 if (status != 0) 1349 if (status != 0)
1349 intf->pm_usage_cnt -= inc_usage_cnt; 1350 intf->pm_usage_cnt -= inc_usage_cnt;
1350 else if (inc_usage_cnt) 1351 else
1351 udev->last_busy = jiffies; 1352 udev->last_busy = jiffies;
1352 } else if (inc_usage_cnt <= 0 && intf->pm_usage_cnt <= 0) { 1353 } else if (inc_usage_cnt <= 0 && intf->pm_usage_cnt <= 0) {
1353 if (inc_usage_cnt)
1354 udev->last_busy = jiffies;
1355 status = usb_suspend_both(udev, PMSG_SUSPEND); 1354 status = usb_suspend_both(udev, PMSG_SUSPEND);
1356 } 1355 }
1357 } 1356 }
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index e341a1da517f..f7b337feb3ea 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1644,9 +1644,10 @@ static int finish_port_resume(struct usb_device *udev)
1644 * and device drivers will know about any resume quirks. 1644 * and device drivers will know about any resume quirks.
1645 */ 1645 */
1646 if (status == 0) { 1646 if (status == 0) {
1647 devstatus = 0;
1647 status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); 1648 status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
1648 if (status >= 0) 1649 if (status >= 0)
1649 status = (status == 2 ? 0 : -ENODEV); 1650 status = (status > 0 ? 0 : -ENODEV);
1650 } 1651 }
1651 1652
1652 if (status) { 1653 if (status) {
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index b6bd05e3d439..d8f7b089a8f0 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -637,12 +637,12 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char
637 memset(buf,0,size); // Make sure we parse really received data 637 memset(buf,0,size); // Make sure we parse really received data
638 638
639 for (i = 0; i < 3; ++i) { 639 for (i = 0; i < 3; ++i) {
640 /* retry on length 0 or stall; some devices are flakey */ 640 /* retry on length 0 or error; some devices are flakey */
641 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 641 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
642 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, 642 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
643 (type << 8) + index, 0, buf, size, 643 (type << 8) + index, 0, buf, size,
644 USB_CTRL_GET_TIMEOUT); 644 USB_CTRL_GET_TIMEOUT);
645 if (result == 0 || result == -EPIPE) 645 if (result <= 0 && result != -ETIMEDOUT)
646 continue; 646 continue;
647 if (result > 1 && ((u8 *)buf)[1] != type) { 647 if (result > 1 && ((u8 *)buf)[1] != type) {
648 result = -EPROTO; 648 result = -EPROTO;
@@ -1358,6 +1358,30 @@ static int usb_if_uevent(struct device *dev, char **envp, int num_envp,
1358 usb_dev = interface_to_usbdev(intf); 1358 usb_dev = interface_to_usbdev(intf);
1359 alt = intf->cur_altsetting; 1359 alt = intf->cur_altsetting;
1360 1360
1361#ifdef CONFIG_USB_DEVICEFS
1362 if (add_uevent_var(envp, num_envp, &i,
1363 buffer, buffer_size, &length,
1364 "DEVICE=/proc/bus/usb/%03d/%03d",
1365 usb_dev->bus->busnum, usb_dev->devnum))
1366 return -ENOMEM;
1367#endif
1368
1369 if (add_uevent_var(envp, num_envp, &i,
1370 buffer, buffer_size, &length,
1371 "PRODUCT=%x/%x/%x",
1372 le16_to_cpu(usb_dev->descriptor.idVendor),
1373 le16_to_cpu(usb_dev->descriptor.idProduct),
1374 le16_to_cpu(usb_dev->descriptor.bcdDevice)))
1375 return -ENOMEM;
1376
1377 if (add_uevent_var(envp, num_envp, &i,
1378 buffer, buffer_size, &length,
1379 "TYPE=%d/%d/%d",
1380 usb_dev->descriptor.bDeviceClass,
1381 usb_dev->descriptor.bDeviceSubClass,
1382 usb_dev->descriptor.bDeviceProtocol))
1383 return -ENOMEM;
1384
1361 if (add_uevent_var(envp, num_envp, &i, 1385 if (add_uevent_var(envp, num_envp, &i,
1362 buffer, buffer_size, &length, 1386 buffer, buffer_size, &length,
1363 "INTERFACE=%d/%d/%d", 1387 "INTERFACE=%d/%d/%d",
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index b7917c5a3c6f..9e467118dc94 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -30,6 +30,8 @@
30static const struct usb_device_id usb_quirk_list[] = { 30static const struct usb_device_id usb_quirk_list[] = {
31 /* HP 5300/5370C scanner */ 31 /* HP 5300/5370C scanner */
32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, 32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
33 /* Hewlett-Packard PhotoSmart 720 / PhotoSmart 935 (storage) */
34 { USB_DEVICE(0x03f0, 0x4002), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
33 /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */ 35 /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */
34 { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 36 { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
35 /* Benq S2W 3300U */ 37 /* Benq S2W 3300U */
@@ -56,6 +58,8 @@ static const struct usb_device_id usb_quirk_list[] = {
56 { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 58 { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
57 /* Seiko Epson Corp.*/ 59 /* Seiko Epson Corp.*/
58 { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 60 { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
61 /* Samsung ML-2010 printer */
62 { USB_DEVICE(0x04e8, 0x326c), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
59 /* Samsung ML-2510 Series printer */ 63 /* Samsung ML-2510 Series printer */
60 { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 64 { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
61 /* Elsa MicroLink 56k (V.250) */ 65 /* Elsa MicroLink 56k (V.250) */
@@ -64,12 +68,20 @@ static const struct usb_device_id usb_quirk_list[] = {
64 { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 68 { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
65 /* Agfa Snapscan1212u */ 69 /* Agfa Snapscan1212u */
66 { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 70 { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
71 /* Seagate RSS LLC */
72 { USB_DEVICE(0x0bc2, 0x3000), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
67 /* Umax [hex] Astra 3400U */ 73 /* Umax [hex] Astra 3400U */
68 { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 74 { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
69 75
70 /* Philips PSC805 audio device */ 76 /* Philips PSC805 audio device */
71 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, 77 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
72 78
79 /* Alcor multi-card reader */
80 { USB_DEVICE(0x058f, 0x6366), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
81
82 /* Canon EOS 5D in PC Connection mode */
83 { USB_DEVICE(0x04a9, 0x3101), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
84
73 /* RIM Blackberry */ 85 /* RIM Blackberry */
74 { USB_DEVICE(0x0fca, 0x0001), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 86 { USB_DEVICE(0x0fca, 0x0001), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
75 { USB_DEVICE(0x0fca, 0x0004), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 87 { USB_DEVICE(0x0fca, 0x0004), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index f2fbdc7fe376..d008d1360a7a 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -34,8 +34,6 @@
34 * bypassing some hardware (and driver) issues. UML could help too. 34 * bypassing some hardware (and driver) issues. UML could help too.
35 */ 35 */
36 36
37#define DEBUG
38
39#include <linux/module.h> 37#include <linux/module.h>
40#include <linux/kernel.h> 38#include <linux/kernel.h>
41#include <linux/delay.h> 39#include <linux/delay.h>
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index be7a1bd2823b..965ad7bec7b7 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -599,7 +599,6 @@ enum fsg_buffer_state {
599 599
600struct fsg_buffhd { 600struct fsg_buffhd {
601 void *buf; 601 void *buf;
602 dma_addr_t dma;
603 enum fsg_buffer_state state; 602 enum fsg_buffer_state state;
604 struct fsg_buffhd *next; 603 struct fsg_buffhd *next;
605 604
@@ -1295,6 +1294,7 @@ static int class_setup_req(struct fsg_dev *fsg,
1295 struct usb_request *req = fsg->ep0req; 1294 struct usb_request *req = fsg->ep0req;
1296 int value = -EOPNOTSUPP; 1295 int value = -EOPNOTSUPP;
1297 u16 w_index = le16_to_cpu(ctrl->wIndex); 1296 u16 w_index = le16_to_cpu(ctrl->wIndex);
1297 u16 w_value = le16_to_cpu(ctrl->wValue);
1298 u16 w_length = le16_to_cpu(ctrl->wLength); 1298 u16 w_length = le16_to_cpu(ctrl->wLength);
1299 1299
1300 if (!fsg->config) 1300 if (!fsg->config)
@@ -1308,7 +1308,7 @@ static int class_setup_req(struct fsg_dev *fsg,
1308 if (ctrl->bRequestType != (USB_DIR_OUT | 1308 if (ctrl->bRequestType != (USB_DIR_OUT |
1309 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 1309 USB_TYPE_CLASS | USB_RECIP_INTERFACE))
1310 break; 1310 break;
1311 if (w_index != 0) { 1311 if (w_index != 0 || w_value != 0) {
1312 value = -EDOM; 1312 value = -EDOM;
1313 break; 1313 break;
1314 } 1314 }
@@ -1324,7 +1324,7 @@ static int class_setup_req(struct fsg_dev *fsg,
1324 if (ctrl->bRequestType != (USB_DIR_IN | 1324 if (ctrl->bRequestType != (USB_DIR_IN |
1325 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 1325 USB_TYPE_CLASS | USB_RECIP_INTERFACE))
1326 break; 1326 break;
1327 if (w_index != 0) { 1327 if (w_index != 0 || w_value != 0) {
1328 value = -EDOM; 1328 value = -EDOM;
1329 break; 1329 break;
1330 } 1330 }
@@ -1343,7 +1343,7 @@ static int class_setup_req(struct fsg_dev *fsg,
1343 if (ctrl->bRequestType != (USB_DIR_OUT | 1343 if (ctrl->bRequestType != (USB_DIR_OUT |
1344 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 1344 USB_TYPE_CLASS | USB_RECIP_INTERFACE))
1345 break; 1345 break;
1346 if (w_index != 0) { 1346 if (w_index != 0 || w_value != 0) {
1347 value = -EDOM; 1347 value = -EDOM;
1348 break; 1348 break;
1349 } 1349 }
@@ -2611,7 +2611,6 @@ static int send_status(struct fsg_dev *fsg)
2611 2611
2612 fsg->intr_buffhd = bh; // Point to the right buffhd 2612 fsg->intr_buffhd = bh; // Point to the right buffhd
2613 fsg->intreq->buf = bh->inreq->buf; 2613 fsg->intreq->buf = bh->inreq->buf;
2614 fsg->intreq->dma = bh->inreq->dma;
2615 fsg->intreq->context = bh; 2614 fsg->intreq->context = bh;
2616 start_transfer(fsg, fsg->intr_in, fsg->intreq, 2615 start_transfer(fsg, fsg->intr_in, fsg->intreq,
2617 &fsg->intreq_busy, &bh->state); 2616 &fsg->intreq_busy, &bh->state);
@@ -3200,7 +3199,6 @@ reset:
3200 if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0) 3199 if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0)
3201 goto reset; 3200 goto reset;
3202 bh->inreq->buf = bh->outreq->buf = bh->buf; 3201 bh->inreq->buf = bh->outreq->buf = bh->buf;
3203 bh->inreq->dma = bh->outreq->dma = bh->dma;
3204 bh->inreq->context = bh->outreq->context = bh; 3202 bh->inreq->context = bh->outreq->context = bh;
3205 bh->inreq->complete = bulk_in_complete; 3203 bh->inreq->complete = bulk_in_complete;
3206 bh->outreq->complete = bulk_out_complete; 3204 bh->outreq->complete = bulk_out_complete;
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 10b2b33b8698..d57bcfbc08a5 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -1277,31 +1277,32 @@ static void setup_received_irq(struct fsl_udc *udc,
1277 1277
1278 udc_reset_ep_queue(udc, 0); 1278 udc_reset_ep_queue(udc, 0);
1279 1279
1280 /* We process some stardard setup requests here */
1280 switch (setup->bRequest) { 1281 switch (setup->bRequest) {
1281 /* Request that need Data+Status phase from udc */
1282 case USB_REQ_GET_STATUS: 1282 case USB_REQ_GET_STATUS:
1283 if ((setup->bRequestType & (USB_DIR_IN | USB_TYPE_STANDARD)) 1283 /* Data+Status phase from udc */
1284 if ((setup->bRequestType & (USB_DIR_IN | USB_TYPE_MASK))
1284 != (USB_DIR_IN | USB_TYPE_STANDARD)) 1285 != (USB_DIR_IN | USB_TYPE_STANDARD))
1285 break; 1286 break;
1286 ch9getstatus(udc, setup->bRequestType, wValue, wIndex, wLength); 1287 ch9getstatus(udc, setup->bRequestType, wValue, wIndex, wLength);
1287 break; 1288 return;
1288 1289
1289 /* Requests that need Status phase from udc */
1290 case USB_REQ_SET_ADDRESS: 1290 case USB_REQ_SET_ADDRESS:
1291 /* Status phase from udc */
1291 if (setup->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD 1292 if (setup->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD
1292 | USB_RECIP_DEVICE)) 1293 | USB_RECIP_DEVICE))
1293 break; 1294 break;
1294 ch9setaddress(udc, wValue, wIndex, wLength); 1295 ch9setaddress(udc, wValue, wIndex, wLength);
1295 break; 1296 return;
1296 1297
1297 /* Handled by udc, no data, status by udc */
1298 case USB_REQ_CLEAR_FEATURE: 1298 case USB_REQ_CLEAR_FEATURE:
1299 case USB_REQ_SET_FEATURE: 1299 case USB_REQ_SET_FEATURE:
1300 { /* status transaction */ 1300 /* Status phase from udc */
1301 {
1301 int rc = -EOPNOTSUPP; 1302 int rc = -EOPNOTSUPP;
1302 1303
1303 if ((setup->bRequestType & USB_RECIP_MASK) 1304 if ((setup->bRequestType & (USB_RECIP_MASK | USB_TYPE_MASK))
1304 == USB_RECIP_ENDPOINT) { 1305 == (USB_RECIP_ENDPOINT | USB_TYPE_STANDARD)) {
1305 int pipe = get_pipe_by_windex(wIndex); 1306 int pipe = get_pipe_by_windex(wIndex);
1306 struct fsl_ep *ep; 1307 struct fsl_ep *ep;
1307 1308
@@ -1315,8 +1316,9 @@ static void setup_received_irq(struct fsl_udc *udc,
1315 ? 1 : 0); 1316 ? 1 : 0);
1316 spin_lock(&udc->lock); 1317 spin_lock(&udc->lock);
1317 1318
1318 } else if ((setup->bRequestType & USB_RECIP_MASK) 1319 } else if ((setup->bRequestType & (USB_RECIP_MASK
1319 == USB_RECIP_DEVICE) { 1320 | USB_TYPE_MASK)) == (USB_RECIP_DEVICE
1321 | USB_TYPE_STANDARD)) {
1320 /* Note: The driver has not include OTG support yet. 1322 /* Note: The driver has not include OTG support yet.
1321 * This will be set when OTG support is added */ 1323 * This will be set when OTG support is added */
1322 if (!udc->gadget.is_otg) 1324 if (!udc->gadget.is_otg)
@@ -1329,39 +1331,42 @@ static void setup_received_irq(struct fsl_udc *udc,
1329 USB_DEVICE_A_ALT_HNP_SUPPORT) 1331 USB_DEVICE_A_ALT_HNP_SUPPORT)
1330 udc->gadget.a_alt_hnp_support = 1; 1332 udc->gadget.a_alt_hnp_support = 1;
1331 rc = 0; 1333 rc = 0;
1332 } 1334 } else
1335 break;
1336
1333 if (rc == 0) { 1337 if (rc == 0) {
1334 if (ep0_prime_status(udc, EP_DIR_IN)) 1338 if (ep0_prime_status(udc, EP_DIR_IN))
1335 ep0stall(udc); 1339 ep0stall(udc);
1336 } 1340 }
1337 break; 1341 return;
1338 } 1342 }
1339 /* Requests handled by gadget */
1340 default:
1341 if (wLength) {
1342 /* Data phase from gadget, status phase from udc */
1343 udc->ep0_dir = (setup->bRequestType & USB_DIR_IN)
1344 ? USB_DIR_IN : USB_DIR_OUT;
1345 spin_unlock(&udc->lock);
1346 if (udc->driver->setup(&udc->gadget,
1347 &udc->local_setup_buff) < 0)
1348 ep0stall(udc);
1349 spin_lock(&udc->lock);
1350 udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
1351 ? DATA_STATE_XMIT : DATA_STATE_RECV;
1352 1343
1353 } else { 1344 default:
1354 /* No data phase, IN status from gadget */
1355 udc->ep0_dir = USB_DIR_IN;
1356 spin_unlock(&udc->lock);
1357 if (udc->driver->setup(&udc->gadget,
1358 &udc->local_setup_buff) < 0)
1359 ep0stall(udc);
1360 spin_lock(&udc->lock);
1361 udc->ep0_state = WAIT_FOR_OUT_STATUS;
1362 }
1363 break; 1345 break;
1364 } 1346 }
1347
1348 /* Requests handled by gadget */
1349 if (wLength) {
1350 /* Data phase from gadget, status phase from udc */
1351 udc->ep0_dir = (setup->bRequestType & USB_DIR_IN)
1352 ? USB_DIR_IN : USB_DIR_OUT;
1353 spin_unlock(&udc->lock);
1354 if (udc->driver->setup(&udc->gadget,
1355 &udc->local_setup_buff) < 0)
1356 ep0stall(udc);
1357 spin_lock(&udc->lock);
1358 udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
1359 ? DATA_STATE_XMIT : DATA_STATE_RECV;
1360 } else {
1361 /* No data phase, IN status from gadget */
1362 udc->ep0_dir = USB_DIR_IN;
1363 spin_unlock(&udc->lock);
1364 if (udc->driver->setup(&udc->gadget,
1365 &udc->local_setup_buff) < 0)
1366 ep0stall(udc);
1367 spin_lock(&udc->lock);
1368 udc->ep0_state = WAIT_FOR_OUT_STATUS;
1369 }
1365} 1370}
1366 1371
1367/* Process request for Data or Status phase of ep0 1372/* Process request for Data or Status phase of ep0
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 72b4ebbf132d..1407ad1c8128 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -967,7 +967,7 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active)
967 udc = container_of(_gadget, struct pxa2xx_udc, gadget); 967 udc = container_of(_gadget, struct pxa2xx_udc, gadget);
968 968
969 /* not all boards support pullup control */ 969 /* not all boards support pullup control */
970 if (!udc->mach->udc_command) 970 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
971 return -EOPNOTSUPP; 971 return -EOPNOTSUPP;
972 972
973 is_active = (is_active != 0); 973 is_active = (is_active != 0);
@@ -2309,7 +2309,7 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
2309{ 2309{
2310 struct pxa2xx_udc *udc = platform_get_drvdata(dev); 2310 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
2311 2311
2312 if (!udc->mach->udc_command) 2312 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
2313 WARN("USB host won't detect disconnect!\n"); 2313 WARN("USB host won't detect disconnect!\n");
2314 pullup(udc, 0); 2314 pullup(udc, 0);
2315 2315
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 2f529828c74d..565d6ef4c4cf 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -237,7 +237,7 @@ config USB_SL811_CS
237 module will be called "sl811_cs". 237 module will be called "sl811_cs".
238 238
239config USB_R8A66597_HCD 239config USB_R8A66597_HCD
240 tristate "R8A66597 HCD suppoort" 240 tristate "R8A66597 HCD support"
241 depends on USB 241 depends on USB
242 help 242 help
243 The R8A66597 is a USB 2.0 host and peripheral controller. 243 The R8A66597 is a USB 2.0 host and peripheral controller.
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 5d1b12aad776..b1d19268cb23 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * EHCI HCD (Host Controller Driver) for USB. 2 * EHCI HCD (Host Controller Driver) for USB.
3 * 3 *
4 * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
5 *
6 * Bus Glue for AMD Alchemy Au1xxx 4 * Bus Glue for AMD Alchemy Au1xxx
7 * 5 *
8 * Based on "ohci-au1xxx.c" by Matt Porter <mporter@kernel.crashing.org> 6 * Based on "ohci-au1xxx.c" by Matt Porter <mporter@kernel.crashing.org>
@@ -196,6 +194,9 @@ static const struct hc_driver ehci_au1xxx_hc_driver = {
196 194
197 /* 195 /*
198 * basic lifecycle operations 196 * basic lifecycle operations
197 *
198 * FIXME -- ehci_init() doesn't do enough here.
199 * See ehci-ppc-soc for a complete implementation.
199 */ 200 */
200 .reset = ehci_init, 201 .reset = ehci_init,
201 .start = ehci_run, 202 .start = ehci_run,
diff --git a/drivers/usb/host/ehci-ppc-soc.c b/drivers/usb/host/ehci-ppc-soc.c
index c2cedb09ed8b..4f99b0eb27bc 100644
--- a/drivers/usb/host/ehci-ppc-soc.c
+++ b/drivers/usb/host/ehci-ppc-soc.c
@@ -6,7 +6,7 @@
6 * Bus Glue for PPC On-Chip EHCI driver 6 * Bus Glue for PPC On-Chip EHCI driver
7 * Tested on AMCC 440EPx 7 * Tested on AMCC 440EPx
8 * 8 *
9 * Based on "ehci-au12xx.c" by David Brownell <dbrownell@users.sourceforge.net> 9 * Based on "ehci-au1xxx.c" by K.Boge <karsten.boge@amd.com>
10 * 10 *
11 * This file is licenced under the GPL. 11 * This file is licenced under the GPL.
12 */ 12 */
@@ -15,6 +15,24 @@
15 15
16extern int usb_disabled(void); 16extern int usb_disabled(void);
17 17
18/* called during probe() after chip reset completes */
19static int ehci_ppc_soc_setup(struct usb_hcd *hcd)
20{
21 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
22 int retval;
23
24 retval = ehci_halt(ehci);
25 if (retval)
26 return retval;
27
28 retval = ehci_init(hcd);
29 if (retval)
30 return retval;
31
32 ehci->sbrn = 0x20;
33 return ehci_reset(ehci);
34}
35
18/** 36/**
19 * usb_ehci_ppc_soc_probe - initialize PPC-SoC-based HCDs 37 * usb_ehci_ppc_soc_probe - initialize PPC-SoC-based HCDs
20 * Context: !in_interrupt() 38 * Context: !in_interrupt()
@@ -120,7 +138,7 @@ static const struct hc_driver ehci_ppc_soc_hc_driver = {
120 /* 138 /*
121 * basic lifecycle operations 139 * basic lifecycle operations
122 */ 140 */
123 .reset = ehci_init, 141 .reset = ehci_ppc_soc_setup,
124 .start = ehci_run, 142 .start = ehci_run,
125 .stop = ehci_stop, 143 .stop = ehci_stop,
126 .shutdown = ehci_shutdown, 144 .shutdown = ehci_shutdown,
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 6f9e43e9a6ca..f61c6cdd06f2 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -74,7 +74,7 @@ urb_print (struct urb * urb, char * str, int small)
74 74
75#define ohci_dbg_sw(ohci, next, size, format, arg...) \ 75#define ohci_dbg_sw(ohci, next, size, format, arg...) \
76 do { \ 76 do { \
77 if (next) { \ 77 if (next != NULL) { \
78 unsigned s_len; \ 78 unsigned s_len; \
79 s_len = scnprintf (*next, *size, format, ## arg ); \ 79 s_len = scnprintf (*next, *size, format, ## arg ); \
80 *size -= s_len; *next += s_len; \ 80 *size -= s_len; *next += s_len; \
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index d60f1985320c..40a1de4c256e 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2208,8 +2208,6 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2208clean_up: 2208clean_up:
2209 if (reg) 2209 if (reg)
2210 iounmap(reg); 2210 iounmap(reg);
2211 if (res)
2212 release_mem_region(res->start, 1);
2213 2211
2214 return ret; 2212 return ret;
2215} 2213}
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 7f765ec038cd..b88eb3c62c02 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -1520,12 +1520,15 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1520 } 1520 }
1521 } 1521 }
1522} 1522}
1523#ifdef CONFIG_PM
1523 1524
1524static void port_power(struct u132 *u132, int pn, int is_on) 1525static void port_power(struct u132 *u132, int pn, int is_on)
1525{ 1526{
1526 u132->port[pn].power = is_on; 1527 u132->port[pn].power = is_on;
1527} 1528}
1528 1529
1530#endif
1531
1529static void u132_power(struct u132 *u132, int is_on) 1532static void u132_power(struct u132 *u132, int is_on)
1530{ 1533{
1531 struct usb_hcd *hcd = u132_to_hcd(u132) 1534 struct usb_hcd *hcd = u132_to_hcd(u132)
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index cff6fd190a28..77bb893bf2e9 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -18,7 +18,6 @@
18 18
19static struct usb_device_id id_table [] = { 19static struct usb_device_id id_table [] = {
20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ 20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
21 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */
22 { }, 21 { },
23}; 22};
24MODULE_DEVICE_TABLE(usb, id_table); 23MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index e67ce25f7512..86724e885704 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -383,6 +383,10 @@ static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios
383 } 383 }
384 384
385 baud = tty_get_baud_rate(port->tty); 385 baud = tty_get_baud_rate(port->tty);
386 if (baud == 0) {
387 dbg("%s - tty_get_baud_rate says 0 baud", __FUNCTION__);
388 return;
389 }
386 urb_value = BELKIN_SA_BAUD(baud); 390 urb_value = BELKIN_SA_BAUD(baud);
387 /* Clip to maximum speed */ 391 /* Clip to maximum speed */
388 if (urb_value == 0) 392 if (urb_value == 0)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 7b1673a44077..1370c423d7c2 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -538,6 +538,8 @@ static struct usb_device_id id_table_combined [] = {
538 { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_VCP_PID) }, 538 { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_VCP_PID) },
539 { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_D2XX_PID) }, 539 { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_D2XX_PID) },
540 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, 540 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
541 { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) },
542 { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) },
541 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, 543 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) },
542 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, 544 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) },
543 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, 545 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) },
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index d9e49716db13..c70e1de6389e 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -430,6 +430,9 @@
430 */ 430 */
431#define EVOLUTION_VID 0xDEEE /* Vendor ID */ 431#define EVOLUTION_VID 0xDEEE /* Vendor ID */
432#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */ 432#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */
433#define EVO_8U232AM_PID 0x02FF /* Evolution robotics RCM2 (FT232AM)*/
434#define EVO_HYBRID_PID 0x0302 /* Evolution robotics RCM4 PID (FT232BM)*/
435#define EVO_RCM4_PID 0x0303 /* Evolution robotics RCM4 PID */
433 436
434/* Pyramid Computer GmbH */ 437/* Pyramid Computer GmbH */
435#define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */ 438#define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 04bd3b7a2985..f1c90cfe7251 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Garmin GPS driver 2 * Garmin GPS driver
3 * 3 *
4 * Copyright (C) 2006 Hermann Kneissel herkne@users.sourceforge.net 4 * Copyright (C) 2006,2007 Hermann Kneissel herkne@users.sourceforge.net
5 * 5 *
6 * The latest version of the driver can be found at 6 * The latest version of the driver can be found at
7 * http://sourceforge.net/projects/garmin-gps/ 7 * http://sourceforge.net/projects/garmin-gps/
@@ -34,6 +34,7 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/spinlock.h> 35#include <linux/spinlock.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/atomic.h>
37#include <linux/usb.h> 38#include <linux/usb.h>
38#include <linux/usb/serial.h> 39#include <linux/usb/serial.h>
39 40
@@ -52,7 +53,7 @@ static int debug = 0;
52 */ 53 */
53 54
54#define VERSION_MAJOR 0 55#define VERSION_MAJOR 0
55#define VERSION_MINOR 28 56#define VERSION_MINOR 31
56 57
57#define _STR(s) #s 58#define _STR(s) #s
58#define _DRIVER_VERSION(a,b) "v" _STR(a) "." _STR(b) 59#define _DRIVER_VERSION(a,b) "v" _STR(a) "." _STR(b)
@@ -141,6 +142,8 @@ struct garmin_data {
141 __u8 inbuffer [GPS_IN_BUFSIZ]; /* tty -> usb */ 142 __u8 inbuffer [GPS_IN_BUFSIZ]; /* tty -> usb */
142 __u8 outbuffer[GPS_OUT_BUFSIZ]; /* usb -> tty */ 143 __u8 outbuffer[GPS_OUT_BUFSIZ]; /* usb -> tty */
143 __u8 privpkt[4*6]; 144 __u8 privpkt[4*6];
145 atomic_t req_count;
146 atomic_t resp_count;
144 spinlock_t lock; 147 spinlock_t lock;
145 struct list_head pktlist; 148 struct list_head pktlist;
146}; 149};
@@ -171,8 +174,6 @@ struct garmin_data {
171#define CLEAR_HALT_REQUIRED 0x0001 174#define CLEAR_HALT_REQUIRED 0x0001
172 175
173#define FLAGS_QUEUING 0x0100 176#define FLAGS_QUEUING 0x0100
174#define FLAGS_APP_RESP_SEEN 0x0200
175#define FLAGS_APP_REQ_SEEN 0x0400
176#define FLAGS_DROP_DATA 0x0800 177#define FLAGS_DROP_DATA 0x0800
177 178
178#define FLAGS_GSP_SKIP 0x1000 179#define FLAGS_GSP_SKIP 0x1000
@@ -186,7 +187,8 @@ struct garmin_data {
186/* function prototypes */ 187/* function prototypes */
187static void gsp_next_packet(struct garmin_data * garmin_data_p); 188static void gsp_next_packet(struct garmin_data * garmin_data_p);
188static int garmin_write_bulk(struct usb_serial_port *port, 189static int garmin_write_bulk(struct usb_serial_port *port,
189 const unsigned char *buf, int count); 190 const unsigned char *buf, int count,
191 int dismiss_ack);
190 192
191/* some special packets to be send or received */ 193/* some special packets to be send or received */
192static unsigned char const GARMIN_START_SESSION_REQ[] 194static unsigned char const GARMIN_START_SESSION_REQ[]
@@ -233,9 +235,7 @@ static struct usb_driver garmin_driver = {
233 235
234static inline int noResponseFromAppLayer(struct garmin_data * garmin_data_p) 236static inline int noResponseFromAppLayer(struct garmin_data * garmin_data_p)
235{ 237{
236 return ((garmin_data_p->flags 238 return atomic_read(&garmin_data_p->req_count) == atomic_read(&garmin_data_p->resp_count);
237 & (FLAGS_APP_REQ_SEEN|FLAGS_APP_RESP_SEEN))
238 == FLAGS_APP_REQ_SEEN);
239} 239}
240 240
241 241
@@ -463,7 +463,7 @@ static int gsp_rec_packet(struct garmin_data * garmin_data_p, int count)
463 usbdata[2] = __cpu_to_le32(size); 463 usbdata[2] = __cpu_to_le32(size);
464 464
465 garmin_write_bulk (garmin_data_p->port, garmin_data_p->inbuffer, 465 garmin_write_bulk (garmin_data_p->port, garmin_data_p->inbuffer,
466 GARMIN_PKTHDR_LENGTH+size); 466 GARMIN_PKTHDR_LENGTH+size, 0);
467 467
468 /* if this was an abort-transfer command, flush all 468 /* if this was an abort-transfer command, flush all
469 queued data. */ 469 queued data. */
@@ -818,7 +818,7 @@ static int nat_receive(struct garmin_data * garmin_data_p,
818 if (garmin_data_p->insize >= len) { 818 if (garmin_data_p->insize >= len) {
819 garmin_write_bulk (garmin_data_p->port, 819 garmin_write_bulk (garmin_data_p->port,
820 garmin_data_p->inbuffer, 820 garmin_data_p->inbuffer,
821 len); 821 len, 0);
822 garmin_data_p->insize = 0; 822 garmin_data_p->insize = 0;
823 823
824 /* if this was an abort-transfer command, 824 /* if this was an abort-transfer command,
@@ -893,10 +893,11 @@ static int garmin_clear(struct garmin_data * garmin_data_p)
893 893
894 struct usb_serial_port *port = garmin_data_p->port; 894 struct usb_serial_port *port = garmin_data_p->port;
895 895
896 if (port != NULL && garmin_data_p->flags & FLAGS_APP_RESP_SEEN) { 896 if (port != NULL && atomic_read(&garmin_data_p->resp_count)) {
897 /* send a terminate command */ 897 /* send a terminate command */
898 status = garmin_write_bulk(port, GARMIN_STOP_TRANSFER_REQ, 898 status = garmin_write_bulk(port, GARMIN_STOP_TRANSFER_REQ,
899 sizeof(GARMIN_STOP_TRANSFER_REQ)); 899 sizeof(GARMIN_STOP_TRANSFER_REQ),
900 1);
900 } 901 }
901 902
902 /* flush all queued data */ 903 /* flush all queued data */
@@ -939,7 +940,8 @@ static int garmin_init_session(struct usb_serial_port *port)
939 dbg("%s - starting session ...", __FUNCTION__); 940 dbg("%s - starting session ...", __FUNCTION__);
940 garmin_data_p->state = STATE_ACTIVE; 941 garmin_data_p->state = STATE_ACTIVE;
941 status = garmin_write_bulk(port, GARMIN_START_SESSION_REQ, 942 status = garmin_write_bulk(port, GARMIN_START_SESSION_REQ,
942 sizeof(GARMIN_START_SESSION_REQ)); 943 sizeof(GARMIN_START_SESSION_REQ),
944 0);
943 945
944 if (status >= 0) { 946 if (status >= 0) {
945 947
@@ -950,7 +952,8 @@ static int garmin_init_session(struct usb_serial_port *port)
950 /* not needed, but the win32 driver does it too ... */ 952 /* not needed, but the win32 driver does it too ... */
951 status = garmin_write_bulk(port, 953 status = garmin_write_bulk(port,
952 GARMIN_START_SESSION_REQ2, 954 GARMIN_START_SESSION_REQ2,
953 sizeof(GARMIN_START_SESSION_REQ2)); 955 sizeof(GARMIN_START_SESSION_REQ2),
956 0);
954 if (status >= 0) { 957 if (status >= 0) {
955 status = 0; 958 status = 0;
956 spin_lock_irqsave(&garmin_data_p->lock, flags); 959 spin_lock_irqsave(&garmin_data_p->lock, flags);
@@ -987,6 +990,8 @@ static int garmin_open (struct usb_serial_port *port, struct file *filp)
987 garmin_data_p->mode = initial_mode; 990 garmin_data_p->mode = initial_mode;
988 garmin_data_p->count = 0; 991 garmin_data_p->count = 0;
989 garmin_data_p->flags = 0; 992 garmin_data_p->flags = 0;
993 atomic_set(&garmin_data_p->req_count, 0);
994 atomic_set(&garmin_data_p->resp_count, 0);
990 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 995 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
991 996
992 /* shutdown any bulk reads that might be going on */ 997 /* shutdown any bulk reads that might be going on */
@@ -1035,28 +1040,39 @@ static void garmin_write_bulk_callback (struct urb *urb)
1035{ 1040{
1036 unsigned long flags; 1041 unsigned long flags;
1037 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 1042 struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
1038 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1039 int status = urb->status; 1043 int status = urb->status;
1040 1044
1041 /* free up the transfer buffer, as usb_free_urb() does not do this */ 1045 if (port) {
1042 kfree (urb->transfer_buffer); 1046 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1043 1047
1044 dbg("%s - port %d", __FUNCTION__, port->number); 1048 dbg("%s - port %d", __FUNCTION__, port->number);
1045 1049
1046 if (status) { 1050 if (GARMIN_LAYERID_APPL == getLayerId(urb->transfer_buffer)
1047 dbg("%s - nonzero write bulk status received: %d", 1051 && (garmin_data_p->mode == MODE_GARMIN_SERIAL)) {
1048 __FUNCTION__, status); 1052 gsp_send_ack(garmin_data_p, ((__u8 *)urb->transfer_buffer)[4]);
1049 spin_lock_irqsave(&garmin_data_p->lock, flags); 1053 }
1050 garmin_data_p->flags |= CLEAR_HALT_REQUIRED; 1054
1051 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1055 if (status) {
1056 dbg("%s - nonzero write bulk status received: %d",
1057 __FUNCTION__, urb->status);
1058 spin_lock_irqsave(&garmin_data_p->lock, flags);
1059 garmin_data_p->flags |= CLEAR_HALT_REQUIRED;
1060 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1061 }
1062
1063 usb_serial_port_softint(port);
1052 } 1064 }
1053 1065
1054 usb_serial_port_softint(port); 1066 /* Ignore errors that resulted from garmin_write_bulk with dismiss_ack=1 */
1067
1068 /* free up the transfer buffer, as usb_free_urb() does not do this */
1069 kfree (urb->transfer_buffer);
1055} 1070}
1056 1071
1057 1072
1058static int garmin_write_bulk (struct usb_serial_port *port, 1073static int garmin_write_bulk (struct usb_serial_port *port,
1059 const unsigned char *buf, int count) 1074 const unsigned char *buf, int count,
1075 int dismiss_ack)
1060{ 1076{
1061 unsigned long flags; 1077 unsigned long flags;
1062 struct usb_serial *serial = port->serial; 1078 struct usb_serial *serial = port->serial;
@@ -1093,13 +1109,12 @@ static int garmin_write_bulk (struct usb_serial_port *port,
1093 usb_sndbulkpipe (serial->dev, 1109 usb_sndbulkpipe (serial->dev,
1094 port->bulk_out_endpointAddress), 1110 port->bulk_out_endpointAddress),
1095 buffer, count, 1111 buffer, count,
1096 garmin_write_bulk_callback, port); 1112 garmin_write_bulk_callback,
1113 dismiss_ack ? NULL : port);
1097 urb->transfer_flags |= URB_ZERO_PACKET; 1114 urb->transfer_flags |= URB_ZERO_PACKET;
1098 1115
1099 if (GARMIN_LAYERID_APPL == getLayerId(buffer)) { 1116 if (GARMIN_LAYERID_APPL == getLayerId(buffer)) {
1100 spin_lock_irqsave(&garmin_data_p->lock, flags); 1117 atomic_inc(&garmin_data_p->req_count);
1101 garmin_data_p->flags |= FLAGS_APP_REQ_SEEN;
1102 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1103 if (garmin_data_p->mode == MODE_GARMIN_SERIAL) { 1118 if (garmin_data_p->mode == MODE_GARMIN_SERIAL) {
1104 pkt_clear(garmin_data_p); 1119 pkt_clear(garmin_data_p);
1105 garmin_data_p->state = STATE_GSP_WAIT_DATA; 1120 garmin_data_p->state = STATE_GSP_WAIT_DATA;
@@ -1114,13 +1129,6 @@ static int garmin_write_bulk (struct usb_serial_port *port,
1114 "failed with status = %d\n", 1129 "failed with status = %d\n",
1115 __FUNCTION__, status); 1130 __FUNCTION__, status);
1116 count = status; 1131 count = status;
1117 } else {
1118
1119 if (GARMIN_LAYERID_APPL == getLayerId(buffer)
1120 && (garmin_data_p->mode == MODE_GARMIN_SERIAL)) {
1121
1122 gsp_send_ack(garmin_data_p, buffer[4]);
1123 }
1124 } 1132 }
1125 1133
1126 /* we are done with this urb, so let the host driver 1134 /* we are done with this urb, so let the host driver
@@ -1135,7 +1143,6 @@ static int garmin_write_bulk (struct usb_serial_port *port,
1135static int garmin_write (struct usb_serial_port *port, 1143static int garmin_write (struct usb_serial_port *port,
1136 const unsigned char *buf, int count) 1144 const unsigned char *buf, int count)
1137{ 1145{
1138 unsigned long flags;
1139 int pktid, pktsiz, len; 1146 int pktid, pktsiz, len;
1140 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); 1147 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1141 __le32 *privpkt = (__le32 *)garmin_data_p->privpkt; 1148 __le32 *privpkt = (__le32 *)garmin_data_p->privpkt;
@@ -1186,9 +1193,7 @@ static int garmin_write (struct usb_serial_port *port,
1186 break; 1193 break;
1187 1194
1188 case PRIV_PKTID_RESET_REQ: 1195 case PRIV_PKTID_RESET_REQ:
1189 spin_lock_irqsave(&garmin_data_p->lock, flags); 1196 atomic_inc(&garmin_data_p->req_count);
1190 garmin_data_p->flags |= FLAGS_APP_REQ_SEEN;
1191 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1192 break; 1197 break;
1193 1198
1194 case PRIV_PKTID_SET_DEF_MODE: 1199 case PRIV_PKTID_SET_DEF_MODE:
@@ -1241,8 +1246,6 @@ static int garmin_chars_in_buffer (struct usb_serial_port *port)
1241static void garmin_read_process(struct garmin_data * garmin_data_p, 1246static void garmin_read_process(struct garmin_data * garmin_data_p,
1242 unsigned char *data, unsigned data_length) 1247 unsigned char *data, unsigned data_length)
1243{ 1248{
1244 unsigned long flags;
1245
1246 if (garmin_data_p->flags & FLAGS_DROP_DATA) { 1249 if (garmin_data_p->flags & FLAGS_DROP_DATA) {
1247 /* abort-transfer cmd is actice */ 1250 /* abort-transfer cmd is actice */
1248 dbg("%s - pkt dropped", __FUNCTION__); 1251 dbg("%s - pkt dropped", __FUNCTION__);
@@ -1254,9 +1257,7 @@ static void garmin_read_process(struct garmin_data * garmin_data_p,
1254 the device */ 1257 the device */
1255 if (0 == memcmp(data, GARMIN_APP_LAYER_REPLY, 1258 if (0 == memcmp(data, GARMIN_APP_LAYER_REPLY,
1256 sizeof(GARMIN_APP_LAYER_REPLY))) { 1259 sizeof(GARMIN_APP_LAYER_REPLY))) {
1257 spin_lock_irqsave(&garmin_data_p->lock, flags); 1260 atomic_inc(&garmin_data_p->resp_count);
1258 garmin_data_p->flags |= FLAGS_APP_RESP_SEEN;
1259 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1260 } 1261 }
1261 1262
1262 /* if throttling is active or postprecessing is required 1263 /* if throttling is active or postprecessing is required
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 0455c1552ae9..6a3a704b5849 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -545,6 +545,7 @@ static struct usb_device_id ipaq_id_table [] = {
545 { USB_DEVICE(0x413C, 0x4009) }, /* Dell Axim USB Sync */ 545 { USB_DEVICE(0x413C, 0x4009) }, /* Dell Axim USB Sync */
546 { USB_DEVICE(0x4505, 0x0010) }, /* Smartphone */ 546 { USB_DEVICE(0x4505, 0x0010) }, /* Smartphone */
547 { USB_DEVICE(0x5E04, 0xCE00) }, /* SAGEM Wireless Assistant */ 547 { USB_DEVICE(0x5E04, 0xCE00) }, /* SAGEM Wireless Assistant */
548 { USB_DEVICE(0x0BB4, 0x00CF) }, /* HTC smartphone modems */
548 { } /* Terminating entry */ 549 { } /* Terminating entry */
549}; 550};
550 551
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 84c12b5f1271..4cb3c165742b 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -110,6 +110,7 @@ static int option_send_setup(struct usb_serial_port *port);
110#define HUAWEI_PRODUCT_E220 0x1003 110#define HUAWEI_PRODUCT_E220 0x1003
111 111
112#define NOVATELWIRELESS_VENDOR_ID 0x1410 112#define NOVATELWIRELESS_VENDOR_ID 0x1410
113#define DELL_VENDOR_ID 0x413C
113 114
114#define ANYDATA_VENDOR_ID 0x16d5 115#define ANYDATA_VENDOR_ID 0x16d5
115#define ANYDATA_PRODUCT_ADU_E100A 0x6501 116#define ANYDATA_PRODUCT_ADU_E100A 0x6501
@@ -119,8 +120,6 @@ static int option_send_setup(struct usb_serial_port *port);
119#define BANDRICH_PRODUCT_C100_1 0x1002 120#define BANDRICH_PRODUCT_C100_1 0x1002
120#define BANDRICH_PRODUCT_C100_2 0x1003 121#define BANDRICH_PRODUCT_C100_2 0x1003
121 122
122#define DELL_VENDOR_ID 0x413C
123
124static struct usb_device_id option_ids[] = { 123static struct usb_device_id option_ids[] = {
125 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 124 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
126 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 125 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -171,11 +170,16 @@ static struct usb_device_id option_ids[] = {
171 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ 170 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */
172 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ 171 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */
173 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ 172 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */
173 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
174 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
175 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
176 { USB_DEVICE(DELL_VENDOR_ID, 0x8117) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */
177 { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */
178 { USB_DEVICE(DELL_VENDOR_ID, 0x8128) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */
174 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, 179 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
175 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 180 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
176 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, 181 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) },
177 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, 182 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) },
178 { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard */
179 { } /* Terminating entry */ 183 { } /* Terminating entry */
180}; 184};
181MODULE_DEVICE_TABLE(usb, option_ids); 185MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index d7db71eca520..833ada47fc54 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -818,19 +818,17 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file,
818 818
819 switch (cmd) { 819 switch (cmd) {
820 case TCGETS: 820 case TCGETS:
821 if (copy_to_user(user_arg, port->tty->termios, 821 if (kernel_termios_to_user_termios((struct ktermios __user *)arg,
822 sizeof(struct ktermios))) { 822 port->tty->termios))
823 return -EFAULT; 823 return -EFAULT;
824 }
825 return 0; 824 return 0;
826 825
827 case TCSETS: 826 case TCSETS:
828 case TCSETSW: /* FIXME: this is not the same! */ 827 case TCSETSW: /* FIXME: this is not the same! */
829 case TCSETSF: /* FIXME: this is not the same! */ 828 case TCSETSF: /* FIXME: this is not the same! */
830 if (copy_from_user(port->tty->termios, user_arg, 829 if (user_termios_to_kernel_termios(port->tty->termios,
831 sizeof(struct ktermios))) { 830 (struct ktermios __user *)arg))
832 return -EFAULT; 831 return -EFAULT;
833 }
834 oti6858_set_termios(port, NULL); 832 oti6858_set_termios(port, NULL);
835 return 0; 833 return 0;
836 834
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index 86899d55d8d8..51669b7622bb 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -74,13 +74,13 @@
74#include <linux/usb/serial.h> 74#include <linux/usb/serial.h>
75 75
76 76
77#ifndef CONFIG_USB_SAFE_PADDED 77#ifndef CONFIG_USB_SERIAL_SAFE_PADDED
78#define CONFIG_USB_SAFE_PADDED 0 78#define CONFIG_USB_SERIAL_SAFE_PADDED 0
79#endif 79#endif
80 80
81static int debug; 81static int debug;
82static int safe = 1; 82static int safe = 1;
83static int padded = CONFIG_USB_SAFE_PADDED; 83static int padded = CONFIG_USB_SERIAL_SAFE_PADDED;
84 84
85#define DRIVER_VERSION "v0.0b" 85#define DRIVER_VERSION "v0.0b"
86#define DRIVER_AUTHOR "sl@lineo.com, tbr@lineo.com" 86#define DRIVER_AUTHOR "sl@lineo.com, tbr@lineo.com"
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 7d84a7647e81..30e08c0bcdc2 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -104,6 +104,8 @@ static struct usb_device_id id_table [] = {
104 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 104 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
105 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID), 105 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID),
106 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 106 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
107 { USB_DEVICE(ACER_VENDOR_ID, ACER_S10_ID),
108 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
107 { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID), 109 { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID),
108 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 110 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
109 { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), 111 { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID),
diff --git a/drivers/usb/serial/visor.h b/drivers/usb/serial/visor.h
index 4ce6f62a6f39..57229cf66477 100644
--- a/drivers/usb/serial/visor.h
+++ b/drivers/usb/serial/visor.h
@@ -48,6 +48,9 @@
48#define SONY_CLIE_UX50_ID 0x0144 48#define SONY_CLIE_UX50_ID 0x0144
49#define SONY_CLIE_TJ25_ID 0x0169 49#define SONY_CLIE_TJ25_ID 0x0169
50 50
51#define ACER_VENDOR_ID 0x0502
52#define ACER_S10_ID 0x0001
53
51#define SAMSUNG_VENDOR_ID 0x04E8 54#define SAMSUNG_VENDOR_ID 0x04E8
52#define SAMSUNG_SCH_I330_ID 0x8001 55#define SAMSUNG_SCH_I330_ID 0x8001
53#define SAMSUNG_SPH_I500_ID 0x6601 56#define SAMSUNG_SPH_I500_ID 0x6601
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index d8d008d42946..2d92ce31018f 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -342,7 +342,7 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
342 US_FL_FIX_CAPACITY), 342 US_FL_FIX_CAPACITY),
343 343
344/* Reported by Emil Larsson <emil@swip.net> */ 344/* Reported by Emil Larsson <emil@swip.net> */
345UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0100, 345UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101,
346 "NIKON", 346 "NIKON",
347 "NIKON DSC D80", 347 "NIKON DSC D80",
348 US_SC_DEVICE, US_PR_DEVICE, NULL, 348 US_SC_DEVICE, US_PR_DEVICE, NULL,
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 28842d208bb0..25e557d4fe6b 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -112,13 +112,6 @@ module_param(delay_use, uint, S_IRUGO | S_IWUSR);
112MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device"); 112MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
113 113
114 114
115/* These are used to make sure the module doesn't unload before all the
116 * threads have exited.
117 */
118static atomic_t total_threads = ATOMIC_INIT(0);
119static DECLARE_COMPLETION(threads_gone);
120
121
122/* 115/*
123 * The entries in this table correspond, line for line, 116 * The entries in this table correspond, line for line,
124 * with the entries of us_unusual_dev_list[]. 117 * with the entries of us_unusual_dev_list[].
@@ -879,9 +872,6 @@ static void quiesce_and_remove_host(struct us_data *us)
879 usb_stor_stop_transport(us); 872 usb_stor_stop_transport(us);
880 wake_up(&us->delay_wait); 873 wake_up(&us->delay_wait);
881 874
882 /* It doesn't matter if the SCSI-scanning thread is still running.
883 * The thread will exit when it sees the DISCONNECTING flag. */
884
885 /* queuecommand won't accept any new commands and the control 875 /* queuecommand won't accept any new commands and the control
886 * thread won't execute a previously-queued command. If there 876 * thread won't execute a previously-queued command. If there
887 * is such a command pending, complete it with an error. */ 877 * is such a command pending, complete it with an error. */
@@ -891,12 +881,16 @@ static void quiesce_and_remove_host(struct us_data *us)
891 scsi_lock(host); 881 scsi_lock(host);
892 us->srb->scsi_done(us->srb); 882 us->srb->scsi_done(us->srb);
893 us->srb = NULL; 883 us->srb = NULL;
884 complete(&us->notify); /* in case of an abort */
894 scsi_unlock(host); 885 scsi_unlock(host);
895 } 886 }
896 mutex_unlock(&us->dev_mutex); 887 mutex_unlock(&us->dev_mutex);
897 888
898 /* Now we own no commands so it's safe to remove the SCSI host */ 889 /* Now we own no commands so it's safe to remove the SCSI host */
899 scsi_remove_host(host); 890 scsi_remove_host(host);
891
892 /* Wait for the SCSI-scanning thread to stop */
893 wait_for_completion(&us->scanning_done);
900} 894}
901 895
902/* Second stage of disconnect processing: deallocate all resources */ 896/* Second stage of disconnect processing: deallocate all resources */
@@ -947,9 +941,8 @@ retry:
947 /* Should we unbind if no devices were detected? */ 941 /* Should we unbind if no devices were detected? */
948 } 942 }
949 943
950 scsi_host_put(us_to_host(us));
951 usb_autopm_put_interface(us->pusb_intf); 944 usb_autopm_put_interface(us->pusb_intf);
952 complete_and_exit(&threads_gone, 0); 945 complete_and_exit(&us->scanning_done, 0);
953} 946}
954 947
955 948
@@ -984,6 +977,7 @@ static int storage_probe(struct usb_interface *intf,
984 init_MUTEX_LOCKED(&(us->sema)); 977 init_MUTEX_LOCKED(&(us->sema));
985 init_completion(&(us->notify)); 978 init_completion(&(us->notify));
986 init_waitqueue_head(&us->delay_wait); 979 init_waitqueue_head(&us->delay_wait);
980 init_completion(&us->scanning_done);
987 981
988 /* Associate the us_data structure with the USB device */ 982 /* Associate the us_data structure with the USB device */
989 result = associate_dev(us, intf); 983 result = associate_dev(us, intf);
@@ -1033,11 +1027,6 @@ static int storage_probe(struct usb_interface *intf,
1033 goto BadDevice; 1027 goto BadDevice;
1034 } 1028 }
1035 1029
1036 /* Take a reference to the host for the scanning thread and
1037 * count it among all the threads we have launched. Then
1038 * start it up. */
1039 scsi_host_get(us_to_host(us));
1040 atomic_inc(&total_threads);
1041 usb_autopm_get_interface(intf); /* dropped in the scanning thread */ 1030 usb_autopm_get_interface(intf); /* dropped in the scanning thread */
1042 wake_up_process(th); 1031 wake_up_process(th);
1043 1032
@@ -1104,16 +1093,6 @@ static void __exit usb_stor_exit(void)
1104 US_DEBUGP("-- calling usb_deregister()\n"); 1093 US_DEBUGP("-- calling usb_deregister()\n");
1105 usb_deregister(&usb_storage_driver) ; 1094 usb_deregister(&usb_storage_driver) ;
1106 1095
1107 /* Don't return until all of our control and scanning threads
1108 * have exited. Since each thread signals threads_gone as its
1109 * last act, we have to call wait_for_completion the right number
1110 * of times.
1111 */
1112 while (atomic_read(&total_threads) > 0) {
1113 wait_for_completion(&threads_gone);
1114 atomic_dec(&total_threads);
1115 }
1116
1117 usb_usual_clear_present(USB_US_TYPE_STOR); 1096 usb_usual_clear_present(USB_US_TYPE_STOR);
1118} 1097}
1119 1098
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 6445665b1577..8d87503e2560 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -150,6 +150,7 @@ struct us_data {
150 struct semaphore sema; /* to sleep thread on */ 150 struct semaphore sema; /* to sleep thread on */
151 struct completion notify; /* thread begin/end */ 151 struct completion notify; /* thread begin/end */
152 wait_queue_head_t delay_wait; /* wait during scan, reset */ 152 wait_queue_head_t delay_wait; /* wait during scan, reset */
153 struct completion scanning_done; /* wait for scan thread */
153 154
154 /* subdriver information */ 155 /* subdriver information */
155 void *extra; /* Any extra data */ 156 void *extra; /* Any extra data */