diff options
Diffstat (limited to 'drivers')
77 files changed, 865 insertions, 521 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 7c49e103cf8f..e2ce4a9c1c92 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -7,6 +7,7 @@ menu "ACPI (Advanced Configuration and Power Interface) Support" | |||
7 | depends on !X86_VISWS | 7 | depends on !X86_VISWS |
8 | depends on !IA64_HP_SIM | 8 | depends on !IA64_HP_SIM |
9 | depends on IA64 || X86 | 9 | depends on IA64 || X86 |
10 | depends on PM | ||
10 | 11 | ||
11 | config ACPI | 12 | config ACPI |
12 | bool "ACPI Support" | 13 | bool "ACPI Support" |
@@ -243,6 +244,17 @@ config ACPI_IBM_DOCK | |||
243 | 244 | ||
244 | If you are not sure, say N here. | 245 | If you are not sure, say N here. |
245 | 246 | ||
247 | config ACPI_IBM_BAY | ||
248 | bool "Legacy Removable Bay Support" | ||
249 | depends on ACPI_IBM | ||
250 | default y | ||
251 | ---help--- | ||
252 | Allows the ibm_acpi driver to handle removable bays. It will allow | ||
253 | disabling the device in the bay, and also generate notifications when | ||
254 | the bay lever is ejected or inserted. | ||
255 | |||
256 | If you are not sure, say Y here. | ||
257 | |||
246 | config ACPI_TOSHIBA | 258 | config ACPI_TOSHIBA |
247 | tristate "Toshiba Laptop Extras" | 259 | tristate "Toshiba Laptop Extras" |
248 | depends on X86 | 260 | depends on X86 |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index f289fd41e77d..3ec110ce00c8 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -79,11 +79,17 @@ static int __init blacklist_by_year(void) | |||
79 | { | 79 | { |
80 | int year = dmi_get_year(DMI_BIOS_DATE); | 80 | int year = dmi_get_year(DMI_BIOS_DATE); |
81 | /* Doesn't exist? Likely an old system */ | 81 | /* Doesn't exist? Likely an old system */ |
82 | if (year == -1) | 82 | if (year == -1) { |
83 | printk(KERN_ERR PREFIX "no DMI BIOS year, " | ||
84 | "acpi=force is required to enable ACPI\n" ); | ||
83 | return 1; | 85 | return 1; |
86 | } | ||
84 | /* 0? Likely a buggy new BIOS */ | 87 | /* 0? Likely a buggy new BIOS */ |
85 | if (year == 0) | 88 | if (year == 0) { |
89 | printk(KERN_ERR PREFIX "DMI BIOS year==0, " | ||
90 | "assuming ACPI-capable machine\n" ); | ||
86 | return 0; | 91 | return 0; |
92 | } | ||
87 | if (year < CONFIG_ACPI_BLACKLIST_YEAR) { | 93 | if (year < CONFIG_ACPI_BLACKLIST_YEAR) { |
88 | printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " | 94 | printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " |
89 | "acpi=force is required to enable ACPI\n", | 95 | "acpi=force is required to enable ACPI\n", |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index ab6888373795..a802962ff2b4 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -100,6 +100,7 @@ static struct acpi_ec { | |||
100 | unsigned long global_lock; | 100 | unsigned long global_lock; |
101 | struct mutex lock; | 101 | struct mutex lock; |
102 | atomic_t query_pending; | 102 | atomic_t query_pending; |
103 | atomic_t event_count; | ||
103 | atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ | 104 | atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ |
104 | wait_queue_head_t wait; | 105 | wait_queue_head_t wait; |
105 | } *ec_ecdt; | 106 | } *ec_ecdt; |
@@ -131,10 +132,12 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) | |||
131 | outb(data, ec->data_addr); | 132 | outb(data, ec->data_addr); |
132 | } | 133 | } |
133 | 134 | ||
134 | static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | 135 | static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event, |
136 | unsigned old_count) | ||
135 | { | 137 | { |
136 | u8 status = acpi_ec_read_status(ec); | 138 | u8 status = acpi_ec_read_status(ec); |
137 | 139 | if (old_count == atomic_read(&ec->event_count)) | |
140 | return 0; | ||
138 | if (event == ACPI_EC_EVENT_OBF_1) { | 141 | if (event == ACPI_EC_EVENT_OBF_1) { |
139 | if (status & ACPI_EC_FLAG_OBF) | 142 | if (status & ACPI_EC_FLAG_OBF) |
140 | return 1; | 143 | return 1; |
@@ -146,19 +149,19 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | |||
146 | return 0; | 149 | return 0; |
147 | } | 150 | } |
148 | 151 | ||
149 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event) | 152 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, unsigned count) |
150 | { | 153 | { |
151 | if (acpi_ec_mode == EC_POLL) { | 154 | if (acpi_ec_mode == EC_POLL) { |
152 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 155 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
153 | while (time_before(jiffies, delay)) { | 156 | while (time_before(jiffies, delay)) { |
154 | if (acpi_ec_check_status(ec, event)) | 157 | if (acpi_ec_check_status(ec, event, 0)) |
155 | return 0; | 158 | return 0; |
156 | } | 159 | } |
157 | } else { | 160 | } else { |
158 | if (wait_event_timeout(ec->wait, | 161 | if (wait_event_timeout(ec->wait, |
159 | acpi_ec_check_status(ec, event), | 162 | acpi_ec_check_status(ec, event, count), |
160 | msecs_to_jiffies(ACPI_EC_DELAY)) || | 163 | msecs_to_jiffies(ACPI_EC_DELAY)) || |
161 | acpi_ec_check_status(ec, event)) { | 164 | acpi_ec_check_status(ec, event, 0)) { |
162 | return 0; | 165 | return 0; |
163 | } else { | 166 | } else { |
164 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," | 167 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," |
@@ -225,21 +228,22 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
225 | u8 * rdata, unsigned rdata_len) | 228 | u8 * rdata, unsigned rdata_len) |
226 | { | 229 | { |
227 | int result = 0; | 230 | int result = 0; |
228 | 231 | unsigned count = atomic_read(&ec->event_count); | |
229 | acpi_ec_write_cmd(ec, command); | 232 | acpi_ec_write_cmd(ec, command); |
230 | 233 | ||
231 | for (; wdata_len > 0; --wdata_len) { | 234 | for (; wdata_len > 0; --wdata_len) { |
232 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 235 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count); |
233 | if (result) { | 236 | if (result) { |
234 | printk(KERN_ERR PREFIX | 237 | printk(KERN_ERR PREFIX |
235 | "write_cmd timeout, command = %d\n", command); | 238 | "write_cmd timeout, command = %d\n", command); |
236 | goto end; | 239 | goto end; |
237 | } | 240 | } |
241 | count = atomic_read(&ec->event_count); | ||
238 | acpi_ec_write_data(ec, *(wdata++)); | 242 | acpi_ec_write_data(ec, *(wdata++)); |
239 | } | 243 | } |
240 | 244 | ||
241 | if (!rdata_len) { | 245 | if (!rdata_len) { |
242 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 246 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count); |
243 | if (result) { | 247 | if (result) { |
244 | printk(KERN_ERR PREFIX | 248 | printk(KERN_ERR PREFIX |
245 | "finish-write timeout, command = %d\n", command); | 249 | "finish-write timeout, command = %d\n", command); |
@@ -250,13 +254,13 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
250 | } | 254 | } |
251 | 255 | ||
252 | for (; rdata_len > 0; --rdata_len) { | 256 | for (; rdata_len > 0; --rdata_len) { |
253 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); | 257 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count); |
254 | if (result) { | 258 | if (result) { |
255 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 259 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", |
256 | command); | 260 | command); |
257 | goto end; | 261 | goto end; |
258 | } | 262 | } |
259 | 263 | count = atomic_read(&ec->event_count); | |
260 | *(rdata++) = acpi_ec_read_data(ec); | 264 | *(rdata++) = acpi_ec_read_data(ec); |
261 | } | 265 | } |
262 | end: | 266 | end: |
@@ -288,7 +292,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
288 | /* Make sure GPE is enabled before doing transaction */ | 292 | /* Make sure GPE is enabled before doing transaction */ |
289 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 293 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); |
290 | 294 | ||
291 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 295 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); |
292 | if (status) { | 296 | if (status) { |
293 | printk(KERN_DEBUG PREFIX | 297 | printk(KERN_DEBUG PREFIX |
294 | "input buffer is not empty, aborting transaction\n"); | 298 | "input buffer is not empty, aborting transaction\n"); |
@@ -369,8 +373,8 @@ int ec_write(u8 addr, u8 val) | |||
369 | EXPORT_SYMBOL(ec_write); | 373 | EXPORT_SYMBOL(ec_write); |
370 | 374 | ||
371 | int ec_transaction(u8 command, | 375 | int ec_transaction(u8 command, |
372 | const u8 * wdata, unsigned wdata_len, | 376 | const u8 * wdata, unsigned wdata_len, |
373 | u8 * rdata, unsigned rdata_len) | 377 | u8 * rdata, unsigned rdata_len) |
374 | { | 378 | { |
375 | struct acpi_ec *ec; | 379 | struct acpi_ec *ec; |
376 | 380 | ||
@@ -435,7 +439,7 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
435 | acpi_status status = AE_OK; | 439 | acpi_status status = AE_OK; |
436 | u8 value; | 440 | u8 value; |
437 | struct acpi_ec *ec = (struct acpi_ec *)data; | 441 | struct acpi_ec *ec = (struct acpi_ec *)data; |
438 | 442 | atomic_inc(&ec->event_count); | |
439 | if (acpi_ec_mode == EC_INTR) { | 443 | if (acpi_ec_mode == EC_INTR) { |
440 | wake_up(&ec->wait); | 444 | wake_up(&ec->wait); |
441 | } | 445 | } |
@@ -633,6 +637,7 @@ static int acpi_ec_add(struct acpi_device *device) | |||
633 | ec->uid = -1; | 637 | ec->uid = -1; |
634 | mutex_init(&ec->lock); | 638 | mutex_init(&ec->lock); |
635 | atomic_set(&ec->query_pending, 0); | 639 | atomic_set(&ec->query_pending, 0); |
640 | atomic_set(&ec->event_count, 1); | ||
636 | if (acpi_ec_mode == EC_INTR) { | 641 | if (acpi_ec_mode == EC_INTR) { |
637 | atomic_set(&ec->leaving_burst, 1); | 642 | atomic_set(&ec->leaving_burst, 1); |
638 | init_waitqueue_head(&ec->wait); | 643 | init_waitqueue_head(&ec->wait); |
@@ -807,6 +812,7 @@ acpi_fake_ecdt_callback(acpi_handle handle, | |||
807 | acpi_status status; | 812 | acpi_status status; |
808 | 813 | ||
809 | mutex_init(&ec_ecdt->lock); | 814 | mutex_init(&ec_ecdt->lock); |
815 | atomic_set(&ec_ecdt->event_count, 1); | ||
810 | if (acpi_ec_mode == EC_INTR) { | 816 | if (acpi_ec_mode == EC_INTR) { |
811 | init_waitqueue_head(&ec_ecdt->wait); | 817 | init_waitqueue_head(&ec_ecdt->wait); |
812 | } | 818 | } |
@@ -888,6 +894,7 @@ static int __init acpi_ec_get_real_ecdt(void) | |||
888 | return -ENOMEM; | 894 | return -ENOMEM; |
889 | 895 | ||
890 | mutex_init(&ec_ecdt->lock); | 896 | mutex_init(&ec_ecdt->lock); |
897 | atomic_set(&ec_ecdt->event_count, 1); | ||
891 | if (acpi_ec_mode == EC_INTR) { | 898 | if (acpi_ec_mode == EC_INTR) { |
892 | init_waitqueue_head(&ec_ecdt->wait); | 899 | init_waitqueue_head(&ec_ecdt->wait); |
893 | } | 900 | } |
@@ -1016,8 +1023,7 @@ static int __init acpi_ec_set_intr_mode(char *str) | |||
1016 | acpi_ec_mode = EC_POLL; | 1023 | acpi_ec_mode = EC_POLL; |
1017 | } | 1024 | } |
1018 | acpi_ec_driver.ops.add = acpi_ec_add; | 1025 | acpi_ec_driver.ops.add = acpi_ec_add; |
1019 | printk(KERN_NOTICE PREFIX "%s mode.\n", | 1026 | printk(KERN_NOTICE PREFIX "%s mode.\n", intr ? "interrupt" : "polling"); |
1020 | intr ? "interrupt" : "polling"); | ||
1021 | 1027 | ||
1022 | return 1; | 1028 | return 1; |
1023 | } | 1029 | } |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index d572700197f3..8dcade63b04b 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -423,6 +423,8 @@ static acpi_status acpi_ev_remove_global_lock_handler(void) | |||
423 | * the global lock appear as a standard mutex on the OS side. | 423 | * the global lock appear as a standard mutex on the OS side. |
424 | * | 424 | * |
425 | *****************************************************************************/ | 425 | *****************************************************************************/ |
426 | static acpi_thread_id acpi_ev_global_lock_thread_id; | ||
427 | static int acpi_ev_global_lock_acquired; | ||
426 | 428 | ||
427 | acpi_status acpi_ev_acquire_global_lock(u16 timeout) | 429 | acpi_status acpi_ev_acquire_global_lock(u16 timeout) |
428 | { | 430 | { |
@@ -435,11 +437,24 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
435 | * Only one thread can acquire the GL at a time, the global_lock_mutex | 437 | * Only one thread can acquire the GL at a time, the global_lock_mutex |
436 | * enforces this. This interface releases the interpreter if we must wait. | 438 | * enforces this. This interface releases the interpreter if we must wait. |
437 | */ | 439 | */ |
438 | status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout); | 440 | status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 0); |
441 | if (status == AE_TIME) { | ||
442 | if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) { | ||
443 | acpi_ev_global_lock_acquired++; | ||
444 | return AE_OK; | ||
445 | } | ||
446 | } | ||
447 | |||
448 | if (ACPI_FAILURE(status)) { | ||
449 | status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout); | ||
450 | } | ||
439 | if (ACPI_FAILURE(status)) { | 451 | if (ACPI_FAILURE(status)) { |
440 | return_ACPI_STATUS(status); | 452 | return_ACPI_STATUS(status); |
441 | } | 453 | } |
442 | 454 | ||
455 | acpi_ev_global_lock_thread_id = acpi_os_get_thread_id(); | ||
456 | acpi_ev_global_lock_acquired++; | ||
457 | |||
443 | /* | 458 | /* |
444 | * Make sure that a global lock actually exists. If not, just treat | 459 | * Make sure that a global lock actually exists. If not, just treat |
445 | * the lock as a standard mutex. | 460 | * the lock as a standard mutex. |
@@ -506,6 +521,11 @@ acpi_status acpi_ev_release_global_lock(void) | |||
506 | return_ACPI_STATUS(AE_NOT_ACQUIRED); | 521 | return_ACPI_STATUS(AE_NOT_ACQUIRED); |
507 | } | 522 | } |
508 | 523 | ||
524 | acpi_ev_global_lock_acquired--; | ||
525 | if (acpi_ev_global_lock_acquired > 0) { | ||
526 | return AE_OK; | ||
527 | } | ||
528 | |||
509 | if (acpi_gbl_global_lock_present) { | 529 | if (acpi_gbl_global_lock_present) { |
510 | 530 | ||
511 | /* Allow any thread to release the lock */ | 531 | /* Allow any thread to release the lock */ |
@@ -529,7 +549,8 @@ acpi_status acpi_ev_release_global_lock(void) | |||
529 | acpi_gbl_global_lock_acquired = FALSE; | 549 | acpi_gbl_global_lock_acquired = FALSE; |
530 | 550 | ||
531 | /* Release the local GL mutex */ | 551 | /* Release the local GL mutex */ |
532 | 552 | acpi_ev_global_lock_thread_id = 0; | |
553 | acpi_ev_global_lock_acquired = 0; | ||
533 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex); | 554 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex); |
534 | return_ACPI_STATUS(status); | 555 | return_ACPI_STATUS(status); |
535 | } | 556 | } |
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 4cc534e36e81..36901362fd24 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -86,6 +86,7 @@ | |||
86 | 86 | ||
87 | #include <linux/proc_fs.h> | 87 | #include <linux/proc_fs.h> |
88 | #include <linux/backlight.h> | 88 | #include <linux/backlight.h> |
89 | #include <linux/fb.h> | ||
89 | #include <asm/uaccess.h> | 90 | #include <asm/uaccess.h> |
90 | 91 | ||
91 | #include <linux/dmi.h> | 92 | #include <linux/dmi.h> |
@@ -157,6 +158,7 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */ | |||
157 | "\\_SB.PCI.ISA.SLCE", /* 570 */ | 158 | "\\_SB.PCI.ISA.SLCE", /* 570 */ |
158 | ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */ | 159 | ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */ |
159 | #endif | 160 | #endif |
161 | #ifdef CONFIG_ACPI_IBM_BAY | ||
160 | IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */ | 162 | IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */ |
161 | "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */ | 163 | "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */ |
162 | "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */ | 164 | "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */ |
@@ -174,6 +176,7 @@ IBM_HANDLE(bay2, root, "\\_SB.PCI0.IDE0.PRIM.SLAV", /* A3x, R32 */ | |||
174 | IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */ | 176 | IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */ |
175 | "_EJ0", /* 770x */ | 177 | "_EJ0", /* 770x */ |
176 | ); /* all others */ | 178 | ); /* all others */ |
179 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
177 | 180 | ||
178 | /* don't list other alternatives as we install a notify handler on the 570 */ | 181 | /* don't list other alternatives as we install a notify handler on the 570 */ |
179 | IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ | 182 | IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ |
@@ -1044,6 +1047,7 @@ static int light_write(char *buf) | |||
1044 | return 0; | 1047 | return 0; |
1045 | } | 1048 | } |
1046 | 1049 | ||
1050 | #if defined(CONFIG_ACPI_IBM_DOCK) || defined(CONFIG_ACPI_IBM_BAY) | ||
1047 | static int _sta(acpi_handle handle) | 1051 | static int _sta(acpi_handle handle) |
1048 | { | 1052 | { |
1049 | int status; | 1053 | int status; |
@@ -1053,6 +1057,7 @@ static int _sta(acpi_handle handle) | |||
1053 | 1057 | ||
1054 | return status; | 1058 | return status; |
1055 | } | 1059 | } |
1060 | #endif | ||
1056 | 1061 | ||
1057 | #ifdef CONFIG_ACPI_IBM_DOCK | 1062 | #ifdef CONFIG_ACPI_IBM_DOCK |
1058 | #define dock_docked() (_sta(dock_handle) & 1) | 1063 | #define dock_docked() (_sta(dock_handle) & 1) |
@@ -1119,6 +1124,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event) | |||
1119 | } | 1124 | } |
1120 | #endif | 1125 | #endif |
1121 | 1126 | ||
1127 | #ifdef CONFIG_ACPI_IBM_BAY | ||
1122 | static int bay_status_supported; | 1128 | static int bay_status_supported; |
1123 | static int bay_status2_supported; | 1129 | static int bay_status2_supported; |
1124 | static int bay_eject_supported; | 1130 | static int bay_eject_supported; |
@@ -1194,6 +1200,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event) | |||
1194 | { | 1200 | { |
1195 | acpi_bus_generate_event(ibm->device, event, 0); | 1201 | acpi_bus_generate_event(ibm->device, event, 0); |
1196 | } | 1202 | } |
1203 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
1197 | 1204 | ||
1198 | static int cmos_read(char *p) | 1205 | static int cmos_read(char *p) |
1199 | { | 1206 | { |
@@ -1701,7 +1708,10 @@ static int brightness_write(char *buf) | |||
1701 | 1708 | ||
1702 | static int brightness_update_status(struct backlight_device *bd) | 1709 | static int brightness_update_status(struct backlight_device *bd) |
1703 | { | 1710 | { |
1704 | return brightness_set(bd->props.brightness); | 1711 | return brightness_set( |
1712 | (bd->props.fb_blank == FB_BLANK_UNBLANK && | ||
1713 | bd->props.power == FB_BLANK_UNBLANK) ? | ||
1714 | bd->props.brightness : 0); | ||
1705 | } | 1715 | } |
1706 | 1716 | ||
1707 | static struct backlight_ops ibm_backlight_data = { | 1717 | static struct backlight_ops ibm_backlight_data = { |
@@ -1711,6 +1721,12 @@ static struct backlight_ops ibm_backlight_data = { | |||
1711 | 1721 | ||
1712 | static int brightness_init(void) | 1722 | static int brightness_init(void) |
1713 | { | 1723 | { |
1724 | int b; | ||
1725 | |||
1726 | b = brightness_get(NULL); | ||
1727 | if (b < 0) | ||
1728 | return b; | ||
1729 | |||
1714 | ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, | 1730 | ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, |
1715 | &ibm_backlight_data); | 1731 | &ibm_backlight_data); |
1716 | if (IS_ERR(ibm_backlight_device)) { | 1732 | if (IS_ERR(ibm_backlight_device)) { |
@@ -1718,7 +1734,9 @@ static int brightness_init(void) | |||
1718 | return PTR_ERR(ibm_backlight_device); | 1734 | return PTR_ERR(ibm_backlight_device); |
1719 | } | 1735 | } |
1720 | 1736 | ||
1721 | ibm_backlight_device->props.max_brightness = 7; | 1737 | ibm_backlight_device->props.max_brightness = 7; |
1738 | ibm_backlight_device->props.brightness = b; | ||
1739 | backlight_update_status(ibm_backlight_device); | ||
1722 | 1740 | ||
1723 | return 0; | 1741 | return 0; |
1724 | } | 1742 | } |
@@ -2353,6 +2371,7 @@ static struct ibm_struct ibms[] = { | |||
2353 | .type = ACPI_SYSTEM_NOTIFY, | 2371 | .type = ACPI_SYSTEM_NOTIFY, |
2354 | }, | 2372 | }, |
2355 | #endif | 2373 | #endif |
2374 | #ifdef CONFIG_ACPI_IBM_BAY | ||
2356 | { | 2375 | { |
2357 | .name = "bay", | 2376 | .name = "bay", |
2358 | .init = bay_init, | 2377 | .init = bay_init, |
@@ -2362,6 +2381,7 @@ static struct ibm_struct ibms[] = { | |||
2362 | .handle = &bay_handle, | 2381 | .handle = &bay_handle, |
2363 | .type = ACPI_SYSTEM_NOTIFY, | 2382 | .type = ACPI_SYSTEM_NOTIFY, |
2364 | }, | 2383 | }, |
2384 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
2365 | { | 2385 | { |
2366 | .name = "cmos", | 2386 | .name = "cmos", |
2367 | .read = cmos_read, | 2387 | .read = cmos_read, |
@@ -2647,7 +2667,9 @@ IBM_PARAM(light); | |||
2647 | #ifdef CONFIG_ACPI_IBM_DOCK | 2667 | #ifdef CONFIG_ACPI_IBM_DOCK |
2648 | IBM_PARAM(dock); | 2668 | IBM_PARAM(dock); |
2649 | #endif | 2669 | #endif |
2670 | #ifdef CONFIG_ACPI_IBM_BAY | ||
2650 | IBM_PARAM(bay); | 2671 | IBM_PARAM(bay); |
2672 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
2651 | IBM_PARAM(cmos); | 2673 | IBM_PARAM(cmos); |
2652 | IBM_PARAM(led); | 2674 | IBM_PARAM(led); |
2653 | IBM_PARAM(beep); | 2675 | IBM_PARAM(beep); |
@@ -2723,12 +2745,14 @@ static int __init acpi_ibm_init(void) | |||
2723 | IBM_HANDLE_INIT(dock); | 2745 | IBM_HANDLE_INIT(dock); |
2724 | #endif | 2746 | #endif |
2725 | IBM_HANDLE_INIT(pci); | 2747 | IBM_HANDLE_INIT(pci); |
2748 | #ifdef CONFIG_ACPI_IBM_BAY | ||
2726 | IBM_HANDLE_INIT(bay); | 2749 | IBM_HANDLE_INIT(bay); |
2727 | if (bay_handle) | 2750 | if (bay_handle) |
2728 | IBM_HANDLE_INIT(bay_ej); | 2751 | IBM_HANDLE_INIT(bay_ej); |
2729 | IBM_HANDLE_INIT(bay2); | 2752 | IBM_HANDLE_INIT(bay2); |
2730 | if (bay2_handle) | 2753 | if (bay2_handle) |
2731 | IBM_HANDLE_INIT(bay2_ej); | 2754 | IBM_HANDLE_INIT(bay2_ej); |
2755 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
2732 | IBM_HANDLE_INIT(beep); | 2756 | IBM_HANDLE_INIT(beep); |
2733 | IBM_HANDLE_INIT(ecrd); | 2757 | IBM_HANDLE_INIT(ecrd); |
2734 | IBM_HANDLE_INIT(ecwr); | 2758 | IBM_HANDLE_INIT(ecwr); |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 1ef338545dfe..4ffecd179702 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -436,8 +436,6 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
436 | cl = &device->power.states[device->power.state].resources; | 436 | cl = &device->power.states[device->power.state].resources; |
437 | tl = &device->power.states[state].resources; | 437 | tl = &device->power.states[state].resources; |
438 | 438 | ||
439 | device->power.state = ACPI_STATE_UNKNOWN; | ||
440 | |||
441 | if (!cl->count && !tl->count) { | 439 | if (!cl->count && !tl->count) { |
442 | result = -ENODEV; | 440 | result = -ENODEV; |
443 | goto end; | 441 | goto end; |
@@ -468,12 +466,15 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
468 | goto end; | 466 | goto end; |
469 | } | 467 | } |
470 | 468 | ||
471 | /* We shouldn't change the state till all above operations succeed */ | 469 | end: |
472 | device->power.state = state; | 470 | if (result) { |
473 | end: | 471 | device->power.state = ACPI_STATE_UNKNOWN; |
474 | if (result) | ||
475 | printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", | 472 | printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", |
476 | device->pnp.bus_id, state); | 473 | device->pnp.bus_id, state); |
474 | } else { | ||
475 | /* We shouldn't change the state till all above operations succeed */ | ||
476 | device->power.state = state; | ||
477 | } | ||
477 | 478 | ||
478 | return result; | 479 | return result; |
479 | } | 480 | } |
@@ -687,13 +688,6 @@ static int acpi_power_resume(struct acpi_device *device) | |||
687 | return result; | 688 | return result; |
688 | 689 | ||
689 | mutex_lock(&resource->resource_lock); | 690 | mutex_lock(&resource->resource_lock); |
690 | if ((resource->state == ACPI_POWER_RESOURCE_STATE_ON) && | ||
691 | list_empty(&resource->reference)) { | ||
692 | mutex_unlock(&resource->resource_lock); | ||
693 | result = acpi_power_off_device(device->handle, NULL); | ||
694 | return result; | ||
695 | } | ||
696 | |||
697 | if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) && | 691 | if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) && |
698 | !list_empty(&resource->reference)) { | 692 | !list_empty(&resource->reference)) { |
699 | ref = container_of(resource->reference.next, struct acpi_power_reference, node); | 693 | ref = container_of(resource->reference.next, struct acpi_power_reference, node); |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 1358c06a969c..cc48ab05676c 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -191,6 +191,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); | 191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); |
192 | 192 | ||
193 | for (index = 0; index < number_of_elements; index++) { | 193 | for (index = 0; index < number_of_elements; index++) { |
194 | int source_name_index = 2; | ||
195 | int source_index_index = 3; | ||
196 | |||
194 | /* | 197 | /* |
195 | * Point user_prt past this current structure | 198 | * Point user_prt past this current structure |
196 | * | 199 | * |
@@ -261,10 +264,28 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
261 | } | 264 | } |
262 | 265 | ||
263 | /* | 266 | /* |
267 | * If BIOS erroneously reversed the _PRT source_name and source_index, | ||
268 | * then reverse them back. | ||
269 | */ | ||
270 | if (ACPI_GET_OBJECT_TYPE (sub_object_list[3]) != ACPI_TYPE_INTEGER) { | ||
271 | if (acpi_gbl_enable_interpreter_slack) { | ||
272 | source_name_index = 3; | ||
273 | source_index_index = 2; | ||
274 | printk(KERN_WARNING "ACPI: Handling Garbled _PRT entry\n"); | ||
275 | } else { | ||
276 | ACPI_ERROR((AE_INFO, | ||
277 | "(PRT[%X].source_index) Need Integer, found %s", | ||
278 | index, | ||
279 | acpi_ut_get_object_type_name(sub_object_list[3]))); | ||
280 | return_ACPI_STATUS(AE_BAD_DATA); | ||
281 | } | ||
282 | } | ||
283 | |||
284 | /* | ||
264 | * 3) Third subobject: Dereference the PRT.source_name | 285 | * 3) Third subobject: Dereference the PRT.source_name |
265 | * The name may be unresolved (slack mode), so allow a null object | 286 | * The name may be unresolved (slack mode), so allow a null object |
266 | */ | 287 | */ |
267 | obj_desc = sub_object_list[2]; | 288 | obj_desc = sub_object_list[source_name_index]; |
268 | if (obj_desc) { | 289 | if (obj_desc) { |
269 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 290 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
270 | case ACPI_TYPE_LOCAL_REFERENCE: | 291 | case ACPI_TYPE_LOCAL_REFERENCE: |
@@ -339,7 +360,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
339 | 360 | ||
340 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 361 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
341 | 362 | ||
342 | obj_desc = sub_object_list[3]; | 363 | obj_desc = sub_object_list[source_index_index]; |
343 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 364 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
344 | user_prt->source_index = (u32) obj_desc->integer.value; | 365 | user_prt->source_index = (u32) obj_desc->integer.value; |
345 | } else { | 366 | } else { |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 0771b434feb2..00d25b347255 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -102,9 +102,9 @@ struct acpi_video_bus_cap { | |||
102 | 102 | ||
103 | struct acpi_video_device_attrib { | 103 | struct acpi_video_device_attrib { |
104 | u32 display_index:4; /* A zero-based instance of the Display */ | 104 | u32 display_index:4; /* A zero-based instance of the Display */ |
105 | u32 display_port_attachment:4; /*This field differenates displays type */ | 105 | u32 display_port_attachment:4; /*This field differentiates the display type */ |
106 | u32 display_type:4; /*Describe the specific type in use */ | 106 | u32 display_type:4; /*Describe the specific type in use */ |
107 | u32 vendor_specific:4; /*Chipset Vendor Specifi */ | 107 | u32 vendor_specific:4; /*Chipset Vendor Specific */ |
108 | u32 bios_can_detect:1; /*BIOS can detect the device */ | 108 | u32 bios_can_detect:1; /*BIOS can detect the device */ |
109 | u32 depend_on_vga:1; /*Non-VGA output device whose power is related to | 109 | u32 depend_on_vga:1; /*Non-VGA output device whose power is related to |
110 | the VGA device. */ | 110 | the VGA device. */ |
@@ -484,16 +484,16 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, | |||
484 | * 0. The system BIOS should NOT automatically switch(toggle) | 484 | * 0. The system BIOS should NOT automatically switch(toggle) |
485 | * the active display output. | 485 | * the active display output. |
486 | * 1. The system BIOS should automatically switch (toggle) the | 486 | * 1. The system BIOS should automatically switch (toggle) the |
487 | * active display output. No swich event. | 487 | * active display output. No switch event. |
488 | * 2. The _DGS value should be locked. | 488 | * 2. The _DGS value should be locked. |
489 | * 3. The system BIOS should not automatically switch (toggle) the | 489 | * 3. The system BIOS should not automatically switch (toggle) the |
490 | * active display output, but instead generate the display switch | 490 | * active display output, but instead generate the display switch |
491 | * event notify code. | 491 | * event notify code. |
492 | * lcd_flag : | 492 | * lcd_flag : |
493 | * 0. The system BIOS should automatically control the brightness level | 493 | * 0. The system BIOS should automatically control the brightness level |
494 | * of the LCD, when the power changes from AC to DC | 494 | * of the LCD when the power changes from AC to DC |
495 | * 1. The system BIOS should NOT automatically control the brightness | 495 | * 1. The system BIOS should NOT automatically control the brightness |
496 | * level of the LCD, when the power changes from AC to DC. | 496 | * level of the LCD when the power changes from AC to DC. |
497 | * Return Value: | 497 | * Return Value: |
498 | * -1 wrong arg. | 498 | * -1 wrong arg. |
499 | */ | 499 | */ |
@@ -525,7 +525,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
525 | * Return Value: | 525 | * Return Value: |
526 | * None | 526 | * None |
527 | * | 527 | * |
528 | * Find out all required AML method defined under the output | 528 | * Find out all required AML methods defined under the output |
529 | * device. | 529 | * device. |
530 | */ | 530 | */ |
531 | 531 | ||
@@ -636,7 +636,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
636 | * Return Value: | 636 | * Return Value: |
637 | * None | 637 | * None |
638 | * | 638 | * |
639 | * Find out all required AML method defined under the video bus device. | 639 | * Find out all required AML methods defined under the video bus device. |
640 | */ | 640 | */ |
641 | 641 | ||
642 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | 642 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) |
@@ -681,19 +681,19 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
681 | * to check well known required nodes. | 681 | * to check well known required nodes. |
682 | */ | 682 | */ |
683 | 683 | ||
684 | /* Does this device able to support video switching ? */ | 684 | /* Does this device support video switching? */ |
685 | if (video->cap._DOS) { | 685 | if (video->cap._DOS) { |
686 | video->flags.multihead = 1; | 686 | video->flags.multihead = 1; |
687 | status = 0; | 687 | status = 0; |
688 | } | 688 | } |
689 | 689 | ||
690 | /* Does this device able to retrieve a retrieve a video ROM ? */ | 690 | /* Does this device support retrieving a video ROM? */ |
691 | if (video->cap._ROM) { | 691 | if (video->cap._ROM) { |
692 | video->flags.rom = 1; | 692 | video->flags.rom = 1; |
693 | status = 0; | 693 | status = 0; |
694 | } | 694 | } |
695 | 695 | ||
696 | /* Does this device able to configure which video device to POST ? */ | 696 | /* Does this device support configuring which video device to POST? */ |
697 | if (video->cap._GPD && video->cap._SPD && video->cap._VPO) { | 697 | if (video->cap._GPD && video->cap._SPD && video->cap._VPO) { |
698 | video->flags.post = 1; | 698 | video->flags.post = 1; |
699 | status = 0; | 699 | status = 0; |
@@ -860,7 +860,7 @@ acpi_video_device_write_brightness(struct file *file, | |||
860 | if (level > 100) | 860 | if (level > 100) |
861 | return -EFAULT; | 861 | return -EFAULT; |
862 | 862 | ||
863 | /* validate though the list of available levels */ | 863 | /* validate through the list of available levels */ |
864 | for (i = 0; i < dev->brightness->count; i++) | 864 | for (i = 0; i < dev->brightness->count; i++) |
865 | if (level == dev->brightness->levels[i]) { | 865 | if (level == dev->brightness->levels[i]) { |
866 | if (ACPI_SUCCESS | 866 | if (ACPI_SUCCESS |
@@ -1065,10 +1065,10 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) | |||
1065 | printk(KERN_WARNING PREFIX | 1065 | printk(KERN_WARNING PREFIX |
1066 | "The motherboard VGA device is not listed as a possible POST device.\n"); | 1066 | "The motherboard VGA device is not listed as a possible POST device.\n"); |
1067 | printk(KERN_WARNING PREFIX | 1067 | printk(KERN_WARNING PREFIX |
1068 | "This indicate a BIOS bug. Please contact the manufacturer.\n"); | 1068 | "This indicates a BIOS bug. Please contact the manufacturer.\n"); |
1069 | } | 1069 | } |
1070 | printk("%lx\n", options); | 1070 | printk("%lx\n", options); |
1071 | seq_printf(seq, "can POST: <intgrated video>"); | 1071 | seq_printf(seq, "can POST: <integrated video>"); |
1072 | if (options & 2) | 1072 | if (options & 2) |
1073 | seq_printf(seq, " <PCI video>"); | 1073 | seq_printf(seq, " <PCI video>"); |
1074 | if (options & 4) | 1074 | if (options & 4) |
@@ -1102,7 +1102,7 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) | |||
1102 | seq_printf(seq, "<not supported>\n"); | 1102 | seq_printf(seq, "<not supported>\n"); |
1103 | goto end; | 1103 | goto end; |
1104 | } | 1104 | } |
1105 | seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); | 1105 | seq_printf(seq, "device POSTed is <%s>\n", device_decode[id & 3]); |
1106 | 1106 | ||
1107 | end: | 1107 | end: |
1108 | return 0; | 1108 | return 0; |
@@ -1156,7 +1156,7 @@ acpi_video_bus_write_POST(struct file *file, | |||
1156 | if (opt > 3) | 1156 | if (opt > 3) |
1157 | return -EFAULT; | 1157 | return -EFAULT; |
1158 | 1158 | ||
1159 | /* just in case an OEM 'forget' the motherboard... */ | 1159 | /* just in case an OEM 'forgot' the motherboard... */ |
1160 | options |= 1; | 1160 | options |= 1; |
1161 | 1161 | ||
1162 | if (options & (1ul << opt)) { | 1162 | if (options & (1ul << opt)) { |
@@ -1527,13 +1527,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1527 | /* | 1527 | /* |
1528 | * Arg: | 1528 | * Arg: |
1529 | * video : video bus device | 1529 | * video : video bus device |
1530 | * event : Nontify Event | 1530 | * event : notify event |
1531 | * | 1531 | * |
1532 | * Return: | 1532 | * Return: |
1533 | * < 0 : error | 1533 | * < 0 : error |
1534 | * | 1534 | * |
1535 | * 1. Find out the current active output device. | 1535 | * 1. Find out the current active output device. |
1536 | * 2. Identify the next output device to switch | 1536 | * 2. Identify the next output device to switch to. |
1537 | * 3. call _DSS to do actual switch. | 1537 | * 3. call _DSS to do actual switch. |
1538 | */ | 1538 | */ |
1539 | 1539 | ||
@@ -1723,12 +1723,12 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
1723 | device = video->device; | 1723 | device = video->device; |
1724 | 1724 | ||
1725 | switch (event) { | 1725 | switch (event) { |
1726 | case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, | 1726 | case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch, |
1727 | * most likely via hotkey. */ | 1727 | * most likely via hotkey. */ |
1728 | acpi_bus_generate_event(device, event, 0); | 1728 | acpi_bus_generate_event(device, event, 0); |
1729 | break; | 1729 | break; |
1730 | 1730 | ||
1731 | case ACPI_VIDEO_NOTIFY_PROBE: /* User plug or remove a video | 1731 | case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video |
1732 | * connector. */ | 1732 | * connector. */ |
1733 | acpi_video_device_enumerate(video); | 1733 | acpi_video_device_enumerate(video); |
1734 | acpi_video_device_rebind(video); | 1734 | acpi_video_device_rebind(video); |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index dc42ba1b46f7..b952c584338f 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -93,7 +93,7 @@ | |||
93 | #include <linux/libata.h> | 93 | #include <linux/libata.h> |
94 | 94 | ||
95 | #define DRV_NAME "ata_piix" | 95 | #define DRV_NAME "ata_piix" |
96 | #define DRV_VERSION "2.10" | 96 | #define DRV_VERSION "2.10ac1" |
97 | 97 | ||
98 | enum { | 98 | enum { |
99 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ | 99 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ |
@@ -667,14 +667,9 @@ static int ich_pata_prereset(struct ata_port *ap) | |||
667 | { | 667 | { |
668 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 668 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
669 | 669 | ||
670 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) { | 670 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) |
671 | ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); | 671 | return -ENOENT; |
672 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | ||
673 | return 0; | ||
674 | } | ||
675 | |||
676 | ich_pata_cbl_detect(ap); | 672 | ich_pata_cbl_detect(ap); |
677 | |||
678 | return ata_std_prereset(ap); | 673 | return ata_std_prereset(ap); |
679 | } | 674 | } |
680 | 675 | ||
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index d14a48e75f1b..c428a56e6f31 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -34,6 +34,13 @@ struct taskfile_array { | |||
34 | u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ | 34 | u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ |
35 | }; | 35 | }; |
36 | 36 | ||
37 | /* | ||
38 | * Helper - belongs in the PCI layer somewhere eventually | ||
39 | */ | ||
40 | static int is_pci_dev(struct device *dev) | ||
41 | { | ||
42 | return (dev->bus == &pci_bus_type); | ||
43 | } | ||
37 | 44 | ||
38 | /** | 45 | /** |
39 | * sata_get_dev_handle - finds acpi_handle and PCI device.function | 46 | * sata_get_dev_handle - finds acpi_handle and PCI device.function |
@@ -53,6 +60,9 @@ static int sata_get_dev_handle(struct device *dev, acpi_handle *handle, | |||
53 | struct pci_dev *pci_dev; | 60 | struct pci_dev *pci_dev; |
54 | acpi_integer addr; | 61 | acpi_integer addr; |
55 | 62 | ||
63 | if (!is_pci_dev(dev)) | ||
64 | return -ENODEV; | ||
65 | |||
56 | pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */ | 66 | pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */ |
57 | /* Please refer to the ACPI spec for the syntax of _ADR. */ | 67 | /* Please refer to the ACPI spec for the syntax of _ADR. */ |
58 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); | 68 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); |
@@ -84,7 +94,12 @@ static int pata_get_dev_handle(struct device *dev, acpi_handle *handle, | |||
84 | acpi_status status; | 94 | acpi_status status; |
85 | struct acpi_device_info *dinfo = NULL; | 95 | struct acpi_device_info *dinfo = NULL; |
86 | int ret = -ENODEV; | 96 | int ret = -ENODEV; |
87 | struct pci_dev *pdev = to_pci_dev(dev); | 97 | struct pci_dev *pdev; |
98 | |||
99 | if (!is_pci_dev(dev)) | ||
100 | return -ENODEV; | ||
101 | |||
102 | pdev = to_pci_dev(dev); | ||
88 | 103 | ||
89 | bus = pdev->bus->number; | 104 | bus = pdev->bus->number; |
90 | devnum = PCI_SLOT(pdev->devfn); | 105 | devnum = PCI_SLOT(pdev->devfn); |
@@ -561,6 +576,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
561 | 576 | ||
562 | if (noacpi) | 577 | if (noacpi) |
563 | return 0; | 578 | return 0; |
579 | /* | ||
580 | * TBD - implement PATA support. For now, | ||
581 | * we should not run GTF on PATA devices since some | ||
582 | * PATA require execution of GTM/STM before GTF. | ||
583 | */ | ||
584 | if (!(ap->cbl == ATA_CBL_SATA)) | ||
585 | return 0; | ||
564 | 586 | ||
565 | for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { | 587 | for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { |
566 | if (!ata_dev_enabled(&ap->device[ix])) | 588 | if (!ata_dev_enabled(&ap->device[ix])) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index dc362fa01ca4..3c1f8830ac8b 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3455,7 +3455,8 @@ static void ata_dev_xfermask(struct ata_device *dev) | |||
3455 | "device is on DMA blacklist, disabling DMA\n"); | 3455 | "device is on DMA blacklist, disabling DMA\n"); |
3456 | } | 3456 | } |
3457 | 3457 | ||
3458 | if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed != ap) { | 3458 | if ((host->flags & ATA_HOST_SIMPLEX) && |
3459 | host->simplex_claimed && host->simplex_claimed != ap) { | ||
3459 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 3460 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
3460 | ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " | 3461 | ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " |
3461 | "other device, disabling DMA\n"); | 3462 | "other device, disabling DMA\n"); |
@@ -5684,18 +5685,22 @@ static void ata_host_release(struct device *gendev, void *res) | |||
5684 | for (i = 0; i < host->n_ports; i++) { | 5685 | for (i = 0; i < host->n_ports; i++) { |
5685 | struct ata_port *ap = host->ports[i]; | 5686 | struct ata_port *ap = host->ports[i]; |
5686 | 5687 | ||
5687 | if (!ap) | 5688 | if (ap && ap->ops->port_stop) |
5688 | continue; | ||
5689 | |||
5690 | if (ap->ops->port_stop) | ||
5691 | ap->ops->port_stop(ap); | 5689 | ap->ops->port_stop(ap); |
5692 | |||
5693 | scsi_host_put(ap->scsi_host); | ||
5694 | } | 5690 | } |
5695 | 5691 | ||
5696 | if (host->ops->host_stop) | 5692 | if (host->ops->host_stop) |
5697 | host->ops->host_stop(host); | 5693 | host->ops->host_stop(host); |
5698 | 5694 | ||
5695 | for (i = 0; i < host->n_ports; i++) { | ||
5696 | struct ata_port *ap = host->ports[i]; | ||
5697 | |||
5698 | if (ap) | ||
5699 | scsi_host_put(ap->scsi_host); | ||
5700 | |||
5701 | host->ports[i] = NULL; | ||
5702 | } | ||
5703 | |||
5699 | dev_set_drvdata(gendev, NULL); | 5704 | dev_set_drvdata(gendev, NULL); |
5700 | } | 5705 | } |
5701 | 5706 | ||
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 388d07fab5f7..9d9670a9b117 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -874,8 +874,14 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
874 | 874 | ||
875 | if (status & (NV_ADMA_STAT_DONE | | 875 | if (status & (NV_ADMA_STAT_DONE | |
876 | NV_ADMA_STAT_CPBERR)) { | 876 | NV_ADMA_STAT_CPBERR)) { |
877 | u32 check_commands = notifier | notifier_error; | 877 | u32 check_commands; |
878 | int pos, error = 0; | 878 | int pos, error = 0; |
879 | |||
880 | if(ata_tag_valid(ap->active_tag)) | ||
881 | check_commands = 1 << ap->active_tag; | ||
882 | else | ||
883 | check_commands = ap->sactive; | ||
884 | |||
879 | /** Check CPBs for completed commands */ | 885 | /** Check CPBs for completed commands */ |
880 | while ((pos = ffs(check_commands)) && !error) { | 886 | while ((pos = ffs(check_commands)) && !error) { |
881 | pos--; | 887 | pos--; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index cf2a398aaaa1..f191afe62b4d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -584,17 +584,17 @@ int device_add(struct device *dev) | |||
584 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) | 584 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) |
585 | sysfs_create_link(&dev->class->subsys.kset.kobj, | 585 | sysfs_create_link(&dev->class->subsys.kset.kobj, |
586 | &dev->kobj, dev->bus_id); | 586 | &dev->kobj, dev->bus_id); |
587 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
588 | if (parent) { | 587 | if (parent) { |
589 | sysfs_create_link(&dev->kobj, &dev->parent->kobj, | 588 | sysfs_create_link(&dev->kobj, &dev->parent->kobj, |
590 | "device"); | 589 | "device"); |
590 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
591 | class_name = make_class_name(dev->class->name, | 591 | class_name = make_class_name(dev->class->name, |
592 | &dev->kobj); | 592 | &dev->kobj); |
593 | if (class_name) | 593 | if (class_name) |
594 | sysfs_create_link(&dev->parent->kobj, | 594 | sysfs_create_link(&dev->parent->kobj, |
595 | &dev->kobj, class_name); | 595 | &dev->kobj, class_name); |
596 | } | ||
597 | #endif | 596 | #endif |
597 | } | ||
598 | } | 598 | } |
599 | 599 | ||
600 | if ((error = device_add_attrs(dev))) | 600 | if ((error = device_add_attrs(dev))) |
@@ -651,17 +651,17 @@ int device_add(struct device *dev) | |||
651 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) | 651 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) |
652 | sysfs_remove_link(&dev->class->subsys.kset.kobj, | 652 | sysfs_remove_link(&dev->class->subsys.kset.kobj, |
653 | dev->bus_id); | 653 | dev->bus_id); |
654 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
655 | if (parent) { | 654 | if (parent) { |
655 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
656 | char *class_name = make_class_name(dev->class->name, | 656 | char *class_name = make_class_name(dev->class->name, |
657 | &dev->kobj); | 657 | &dev->kobj); |
658 | if (class_name) | 658 | if (class_name) |
659 | sysfs_remove_link(&dev->parent->kobj, | 659 | sysfs_remove_link(&dev->parent->kobj, |
660 | class_name); | 660 | class_name); |
661 | kfree(class_name); | 661 | kfree(class_name); |
662 | #endif | ||
662 | sysfs_remove_link(&dev->kobj, "device"); | 663 | sysfs_remove_link(&dev->kobj, "device"); |
663 | } | 664 | } |
664 | #endif | ||
665 | 665 | ||
666 | down(&dev->class->sem); | 666 | down(&dev->class->sem); |
667 | /* notify any interfaces that the device is now gone */ | 667 | /* notify any interfaces that the device is now gone */ |
@@ -761,17 +761,17 @@ void device_del(struct device * dev) | |||
761 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) | 761 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) |
762 | sysfs_remove_link(&dev->class->subsys.kset.kobj, | 762 | sysfs_remove_link(&dev->class->subsys.kset.kobj, |
763 | dev->bus_id); | 763 | dev->bus_id); |
764 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
765 | if (parent) { | 764 | if (parent) { |
765 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
766 | char *class_name = make_class_name(dev->class->name, | 766 | char *class_name = make_class_name(dev->class->name, |
767 | &dev->kobj); | 767 | &dev->kobj); |
768 | if (class_name) | 768 | if (class_name) |
769 | sysfs_remove_link(&dev->parent->kobj, | 769 | sysfs_remove_link(&dev->parent->kobj, |
770 | class_name); | 770 | class_name); |
771 | kfree(class_name); | 771 | kfree(class_name); |
772 | #endif | ||
772 | sysfs_remove_link(&dev->kobj, "device"); | 773 | sysfs_remove_link(&dev->kobj, "device"); |
773 | } | 774 | } |
774 | #endif | ||
775 | 775 | ||
776 | down(&dev->class->sem); | 776 | down(&dev->class->sem); |
777 | /* notify any interfaces that the device is now gone */ | 777 | /* notify any interfaces that the device is now gone */ |
@@ -787,6 +787,13 @@ void device_del(struct device * dev) | |||
787 | device_remove_attrs(dev); | 787 | device_remove_attrs(dev); |
788 | bus_remove_device(dev); | 788 | bus_remove_device(dev); |
789 | 789 | ||
790 | /* | ||
791 | * Some platform devices are driven without driver attached | ||
792 | * and managed resources may have been acquired. Make sure | ||
793 | * all resources are released. | ||
794 | */ | ||
795 | devres_release_all(dev); | ||
796 | |||
790 | /* Notify the platform of the removal, in case they | 797 | /* Notify the platform of the removal, in case they |
791 | * need to do anything... | 798 | * need to do anything... |
792 | */ | 799 | */ |
@@ -1058,14 +1065,14 @@ int device_rename(struct device *dev, char *new_name) | |||
1058 | 1065 | ||
1059 | return error; | 1066 | return error; |
1060 | } | 1067 | } |
1061 | 1068 | EXPORT_SYMBOL_GPL(device_rename); | |
1062 | 1069 | ||
1063 | static int device_move_class_links(struct device *dev, | 1070 | static int device_move_class_links(struct device *dev, |
1064 | struct device *old_parent, | 1071 | struct device *old_parent, |
1065 | struct device *new_parent) | 1072 | struct device *new_parent) |
1066 | { | 1073 | { |
1074 | int error = 0; | ||
1067 | #ifdef CONFIG_SYSFS_DEPRECATED | 1075 | #ifdef CONFIG_SYSFS_DEPRECATED |
1068 | int error; | ||
1069 | char *class_name; | 1076 | char *class_name; |
1070 | 1077 | ||
1071 | class_name = make_class_name(dev->class->name, &dev->kobj); | 1078 | class_name = make_class_name(dev->class->name, &dev->kobj); |
@@ -1093,7 +1100,12 @@ out: | |||
1093 | kfree(class_name); | 1100 | kfree(class_name); |
1094 | return error; | 1101 | return error; |
1095 | #else | 1102 | #else |
1096 | return 0; | 1103 | if (old_parent) |
1104 | sysfs_remove_link(&dev->kobj, "device"); | ||
1105 | if (new_parent) | ||
1106 | error = sysfs_create_link(&dev->kobj, &new_parent->kobj, | ||
1107 | "device"); | ||
1108 | return error; | ||
1097 | #endif | 1109 | #endif |
1098 | } | 1110 | } |
1099 | 1111 | ||
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c index 6d58b0370802..59146e3365ba 100644 --- a/drivers/char/ds1286.c +++ b/drivers/char/ds1286.c | |||
@@ -197,6 +197,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, | |||
197 | 197 | ||
198 | hrs = alm_tm.tm_hour; | 198 | hrs = alm_tm.tm_hour; |
199 | min = alm_tm.tm_min; | 199 | min = alm_tm.tm_min; |
200 | sec = alm_tm.tm_sec; | ||
200 | 201 | ||
201 | if (hrs >= 24) | 202 | if (hrs >= 24) |
202 | hrs = 0xff; | 203 | hrs = 0xff; |
@@ -204,9 +205,11 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, | |||
204 | if (min >= 60) | 205 | if (min >= 60) |
205 | min = 0xff; | 206 | min = 0xff; |
206 | 207 | ||
207 | BIN_TO_BCD(sec); | 208 | if (sec != 0) |
208 | BIN_TO_BCD(min); | 209 | return -EINVAL; |
209 | BIN_TO_BCD(hrs); | 210 | |
211 | min = BIN2BCD(min); | ||
212 | min = BIN2BCD(hrs); | ||
210 | 213 | ||
211 | spin_lock(&ds1286_lock); | 214 | spin_lock(&ds1286_lock); |
212 | rtc_write(hrs, RTC_HOURS_ALARM); | 215 | rtc_write(hrs, RTC_HOURS_ALARM); |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index a44db75bc25b..a905f7820331 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(cn_netlink_send); | |||
128 | */ | 128 | */ |
129 | static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data) | 129 | static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data) |
130 | { | 130 | { |
131 | struct cn_callback_entry *__cbq; | 131 | struct cn_callback_entry *__cbq, *__new_cbq; |
132 | struct cn_dev *dev = &cdev; | 132 | struct cn_dev *dev = &cdev; |
133 | int err = -ENODEV; | 133 | int err = -ENODEV; |
134 | 134 | ||
@@ -148,27 +148,27 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
148 | } else { | 148 | } else { |
149 | struct cn_callback_data *d; | 149 | struct cn_callback_data *d; |
150 | 150 | ||
151 | __cbq = kzalloc(sizeof(*__cbq), GFP_ATOMIC); | 151 | err = -ENOMEM; |
152 | if (__cbq) { | 152 | __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); |
153 | d = &__cbq->data; | 153 | if (__new_cbq) { |
154 | d = &__new_cbq->data; | ||
154 | d->callback_priv = msg; | 155 | d->callback_priv = msg; |
155 | d->callback = __cbq->data.callback; | 156 | d->callback = __cbq->data.callback; |
156 | d->ddata = data; | 157 | d->ddata = data; |
157 | d->destruct_data = destruct_data; | 158 | d->destruct_data = destruct_data; |
158 | d->free = __cbq; | 159 | d->free = __new_cbq; |
159 | 160 | ||
160 | INIT_WORK(&__cbq->work, | 161 | INIT_WORK(&__new_cbq->work, |
161 | &cn_queue_wrapper); | 162 | &cn_queue_wrapper); |
162 | 163 | ||
163 | if (queue_work(dev->cbdev->cn_queue, | 164 | if (queue_work(dev->cbdev->cn_queue, |
164 | &__cbq->work)) | 165 | &__new_cbq->work)) |
165 | err = 0; | 166 | err = 0; |
166 | else { | 167 | else { |
167 | kfree(__cbq); | 168 | kfree(__new_cbq); |
168 | err = -EINVAL; | 169 | err = -EINVAL; |
169 | } | 170 | } |
170 | } else | 171 | } |
171 | err = -ENOMEM; | ||
172 | } | 172 | } |
173 | break; | 173 | break; |
174 | } | 174 | } |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index d441815a3e0c..fde92ce45153 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -1821,7 +1821,7 @@ static int cma_alloc_port(struct idr *ps, struct rdma_id_private *id_priv, | |||
1821 | struct rdma_bind_list *bind_list; | 1821 | struct rdma_bind_list *bind_list; |
1822 | int port, ret; | 1822 | int port, ret; |
1823 | 1823 | ||
1824 | bind_list = kmalloc(sizeof *bind_list, GFP_KERNEL); | 1824 | bind_list = kzalloc(sizeof *bind_list, GFP_KERNEL); |
1825 | if (!bind_list) | 1825 | if (!bind_list) |
1826 | return -ENOMEM; | 1826 | return -ENOMEM; |
1827 | 1827 | ||
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index b516b93b8550..c859134c1daa 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -266,7 +266,7 @@ static int ucma_event_handler(struct rdma_cm_id *cm_id, | |||
266 | mutex_lock(&ctx->file->mut); | 266 | mutex_lock(&ctx->file->mut); |
267 | if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) { | 267 | if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) { |
268 | if (!ctx->backlog) { | 268 | if (!ctx->backlog) { |
269 | ret = -EDQUOT; | 269 | ret = -ENOMEM; |
270 | kfree(uevent); | 270 | kfree(uevent); |
271 | goto out; | 271 | goto out; |
272 | } | 272 | } |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index d737c738d876..818cf1aee8c7 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/dma-mapping.h> | ||
39 | 40 | ||
40 | #include "cxio_resource.h" | 41 | #include "cxio_resource.h" |
41 | #include "cxio_hal.h" | 42 | #include "cxio_hal.h" |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index b21fde8b659d..d0ed1d35ca3e 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -305,8 +305,7 @@ static int status2errno(int status) | |||
305 | */ | 305 | */ |
306 | static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) | 306 | static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) |
307 | { | 307 | { |
308 | if (skb) { | 308 | if (skb && !skb_is_nonlinear(skb) && !skb_cloned(skb)) { |
309 | BUG_ON(skb_cloned(skb)); | ||
310 | skb_trim(skb, 0); | 309 | skb_trim(skb, 0); |
311 | skb_get(skb); | 310 | skb_get(skb); |
312 | } else { | 311 | } else { |
@@ -1415,6 +1414,7 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1415 | wake_up(&ep->com.waitq); | 1414 | wake_up(&ep->com.waitq); |
1416 | break; | 1415 | break; |
1417 | case FPDU_MODE: | 1416 | case FPDU_MODE: |
1417 | start_ep_timer(ep); | ||
1418 | __state_set(&ep->com, CLOSING); | 1418 | __state_set(&ep->com, CLOSING); |
1419 | attrs.next_state = IWCH_QP_STATE_CLOSING; | 1419 | attrs.next_state = IWCH_QP_STATE_CLOSING; |
1420 | iwch_modify_qp(ep->com.qp->rhp, ep->com.qp, | 1420 | iwch_modify_qp(ep->com.qp->rhp, ep->com.qp, |
@@ -1425,7 +1425,6 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1425 | disconnect = 0; | 1425 | disconnect = 0; |
1426 | break; | 1426 | break; |
1427 | case CLOSING: | 1427 | case CLOSING: |
1428 | start_ep_timer(ep); | ||
1429 | __state_set(&ep->com, MORIBUND); | 1428 | __state_set(&ep->com, MORIBUND); |
1430 | disconnect = 0; | 1429 | disconnect = 0; |
1431 | break; | 1430 | break; |
@@ -1487,8 +1486,10 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1487 | case CONNECTING: | 1486 | case CONNECTING: |
1488 | break; | 1487 | break; |
1489 | case MPA_REQ_WAIT: | 1488 | case MPA_REQ_WAIT: |
1489 | stop_ep_timer(ep); | ||
1490 | break; | 1490 | break; |
1491 | case MPA_REQ_SENT: | 1491 | case MPA_REQ_SENT: |
1492 | stop_ep_timer(ep); | ||
1492 | connect_reply_upcall(ep, -ECONNRESET); | 1493 | connect_reply_upcall(ep, -ECONNRESET); |
1493 | break; | 1494 | break; |
1494 | case MPA_REP_SENT: | 1495 | case MPA_REP_SENT: |
@@ -1507,9 +1508,10 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1507 | get_ep(&ep->com); | 1508 | get_ep(&ep->com); |
1508 | break; | 1509 | break; |
1509 | case MORIBUND: | 1510 | case MORIBUND: |
1511 | case CLOSING: | ||
1510 | stop_ep_timer(ep); | 1512 | stop_ep_timer(ep); |
1513 | /*FALLTHROUGH*/ | ||
1511 | case FPDU_MODE: | 1514 | case FPDU_MODE: |
1512 | case CLOSING: | ||
1513 | if (ep->com.cm_id && ep->com.qp) { | 1515 | if (ep->com.cm_id && ep->com.qp) { |
1514 | attrs.next_state = IWCH_QP_STATE_ERROR; | 1516 | attrs.next_state = IWCH_QP_STATE_ERROR; |
1515 | ret = iwch_modify_qp(ep->com.qp->rhp, | 1517 | ret = iwch_modify_qp(ep->com.qp->rhp, |
@@ -1570,7 +1572,6 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1570 | spin_lock_irqsave(&ep->com.lock, flags); | 1572 | spin_lock_irqsave(&ep->com.lock, flags); |
1571 | switch (ep->com.state) { | 1573 | switch (ep->com.state) { |
1572 | case CLOSING: | 1574 | case CLOSING: |
1573 | start_ep_timer(ep); | ||
1574 | __state_set(&ep->com, MORIBUND); | 1575 | __state_set(&ep->com, MORIBUND); |
1575 | break; | 1576 | break; |
1576 | case MORIBUND: | 1577 | case MORIBUND: |
@@ -1586,6 +1587,8 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1586 | __state_set(&ep->com, DEAD); | 1587 | __state_set(&ep->com, DEAD); |
1587 | release = 1; | 1588 | release = 1; |
1588 | break; | 1589 | break; |
1590 | case ABORTING: | ||
1591 | break; | ||
1589 | case DEAD: | 1592 | case DEAD: |
1590 | default: | 1593 | default: |
1591 | BUG_ON(1); | 1594 | BUG_ON(1); |
@@ -1659,6 +1662,7 @@ static void ep_timeout(unsigned long arg) | |||
1659 | break; | 1662 | break; |
1660 | case MPA_REQ_WAIT: | 1663 | case MPA_REQ_WAIT: |
1661 | break; | 1664 | break; |
1665 | case CLOSING: | ||
1662 | case MORIBUND: | 1666 | case MORIBUND: |
1663 | if (ep->com.cm_id && ep->com.qp) { | 1667 | if (ep->com.cm_id && ep->com.qp) { |
1664 | attrs.next_state = IWCH_QP_STATE_ERROR; | 1668 | attrs.next_state = IWCH_QP_STATE_ERROR; |
@@ -1687,12 +1691,11 @@ int iwch_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len) | |||
1687 | return -ECONNRESET; | 1691 | return -ECONNRESET; |
1688 | } | 1692 | } |
1689 | BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD); | 1693 | BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD); |
1690 | state_set(&ep->com, CLOSING); | ||
1691 | if (mpa_rev == 0) | 1694 | if (mpa_rev == 0) |
1692 | abort_connection(ep, NULL, GFP_KERNEL); | 1695 | abort_connection(ep, NULL, GFP_KERNEL); |
1693 | else { | 1696 | else { |
1694 | err = send_mpa_reject(ep, pdata, pdata_len); | 1697 | err = send_mpa_reject(ep, pdata, pdata_len); |
1695 | err = send_halfclose(ep, GFP_KERNEL); | 1698 | err = iwch_ep_disconnect(ep, 0, GFP_KERNEL); |
1696 | } | 1699 | } |
1697 | return 0; | 1700 | return 0; |
1698 | } | 1701 | } |
@@ -1957,11 +1960,11 @@ int iwch_ep_disconnect(struct iwch_ep *ep, int abrupt, gfp_t gfp) | |||
1957 | case MPA_REQ_RCVD: | 1960 | case MPA_REQ_RCVD: |
1958 | case MPA_REP_SENT: | 1961 | case MPA_REP_SENT: |
1959 | case FPDU_MODE: | 1962 | case FPDU_MODE: |
1963 | start_ep_timer(ep); | ||
1960 | ep->com.state = CLOSING; | 1964 | ep->com.state = CLOSING; |
1961 | close = 1; | 1965 | close = 1; |
1962 | break; | 1966 | break; |
1963 | case CLOSING: | 1967 | case CLOSING: |
1964 | start_ep_timer(ep); | ||
1965 | ep->com.state = MORIBUND; | 1968 | ep->com.state = MORIBUND; |
1966 | close = 1; | 1969 | close = 1; |
1967 | break; | 1970 | break; |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_ev.c b/drivers/infiniband/hw/cxgb3/iwch_ev.c index 54362afbf72f..b40676662a8a 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_ev.c +++ b/drivers/infiniband/hw/cxgb3/iwch_ev.c | |||
@@ -47,12 +47,6 @@ static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp, | |||
47 | struct iwch_qp_attributes attrs; | 47 | struct iwch_qp_attributes attrs; |
48 | struct iwch_qp *qhp; | 48 | struct iwch_qp *qhp; |
49 | 49 | ||
50 | printk(KERN_ERR "%s - AE qpid 0x%x opcode %d status 0x%x " | ||
51 | "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__, | ||
52 | CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe), | ||
53 | CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe), | ||
54 | CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe)); | ||
55 | |||
56 | spin_lock(&rnicp->lock); | 50 | spin_lock(&rnicp->lock); |
57 | qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe)); | 51 | qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe)); |
58 | 52 | ||
@@ -73,6 +67,12 @@ static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp, | |||
73 | return; | 67 | return; |
74 | } | 68 | } |
75 | 69 | ||
70 | printk(KERN_ERR "%s - AE qpid 0x%x opcode %d status 0x%x " | ||
71 | "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__, | ||
72 | CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe), | ||
73 | CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe), | ||
74 | CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe)); | ||
75 | |||
76 | atomic_inc(&qhp->refcnt); | 76 | atomic_inc(&qhp->refcnt); |
77 | spin_unlock(&rnicp->lock); | 77 | spin_unlock(&rnicp->lock); |
78 | 78 | ||
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index 9947a144a929..f2774ae906bf 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -331,6 +331,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
331 | int ret = 0; | 331 | int ret = 0; |
332 | struct iwch_mm_entry *mm; | 332 | struct iwch_mm_entry *mm; |
333 | struct iwch_ucontext *ucontext; | 333 | struct iwch_ucontext *ucontext; |
334 | u64 addr; | ||
334 | 335 | ||
335 | PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff, | 336 | PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff, |
336 | key, len); | 337 | key, len); |
@@ -345,10 +346,11 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
345 | mm = remove_mmap(ucontext, key, len); | 346 | mm = remove_mmap(ucontext, key, len); |
346 | if (!mm) | 347 | if (!mm) |
347 | return -EINVAL; | 348 | return -EINVAL; |
349 | addr = mm->addr; | ||
348 | kfree(mm); | 350 | kfree(mm); |
349 | 351 | ||
350 | if ((mm->addr >= rdev_p->rnic_info.udbell_physbase) && | 352 | if ((addr >= rdev_p->rnic_info.udbell_physbase) && |
351 | (mm->addr < (rdev_p->rnic_info.udbell_physbase + | 353 | (addr < (rdev_p->rnic_info.udbell_physbase + |
352 | rdev_p->rnic_info.udbell_len))) { | 354 | rdev_p->rnic_info.udbell_len))) { |
353 | 355 | ||
354 | /* | 356 | /* |
@@ -362,7 +364,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
362 | vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; | 364 | vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; |
363 | vma->vm_flags &= ~VM_MAYREAD; | 365 | vma->vm_flags &= ~VM_MAYREAD; |
364 | ret = io_remap_pfn_range(vma, vma->vm_start, | 366 | ret = io_remap_pfn_range(vma, vma->vm_start, |
365 | mm->addr >> PAGE_SHIFT, | 367 | addr >> PAGE_SHIFT, |
366 | len, vma->vm_page_prot); | 368 | len, vma->vm_page_prot); |
367 | } else { | 369 | } else { |
368 | 370 | ||
@@ -370,7 +372,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
370 | * Map WQ or CQ contig dma memory... | 372 | * Map WQ or CQ contig dma memory... |
371 | */ | 373 | */ |
372 | ret = remap_pfn_range(vma, vma->vm_start, | 374 | ret = remap_pfn_range(vma, vma->vm_start, |
373 | mm->addr >> PAGE_SHIFT, | 375 | addr >> PAGE_SHIFT, |
374 | len, vma->vm_page_prot); | 376 | len, vma->vm_page_prot); |
375 | } | 377 | } |
376 | 378 | ||
@@ -463,9 +465,6 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd, | |||
463 | php = to_iwch_pd(pd); | 465 | php = to_iwch_pd(pd); |
464 | rhp = php->rhp; | 466 | rhp = php->rhp; |
465 | 467 | ||
466 | acc = iwch_convert_access(acc); | ||
467 | |||
468 | |||
469 | mhp = kzalloc(sizeof(*mhp), GFP_KERNEL); | 468 | mhp = kzalloc(sizeof(*mhp), GFP_KERNEL); |
470 | if (!mhp) | 469 | if (!mhp) |
471 | return ERR_PTR(-ENOMEM); | 470 | return ERR_PTR(-ENOMEM); |
@@ -491,12 +490,7 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd, | |||
491 | mhp->attr.pdid = php->pdid; | 490 | mhp->attr.pdid = php->pdid; |
492 | mhp->attr.zbva = 0; | 491 | mhp->attr.zbva = 0; |
493 | 492 | ||
494 | /* NOTE: TPT perms are backwards from BIND WR perms! */ | 493 | mhp->attr.perms = iwch_ib_to_tpt_access(acc); |
495 | mhp->attr.perms = (acc & 0x1) << 3; | ||
496 | mhp->attr.perms |= (acc & 0x2) << 1; | ||
497 | mhp->attr.perms |= (acc & 0x4) >> 1; | ||
498 | mhp->attr.perms |= (acc & 0x8) >> 3; | ||
499 | |||
500 | mhp->attr.va_fbo = *iova_start; | 494 | mhp->attr.va_fbo = *iova_start; |
501 | mhp->attr.page_size = shift - 12; | 495 | mhp->attr.page_size = shift - 12; |
502 | 496 | ||
@@ -525,7 +519,6 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr, | |||
525 | struct iwch_mr mh, *mhp; | 519 | struct iwch_mr mh, *mhp; |
526 | struct iwch_pd *php; | 520 | struct iwch_pd *php; |
527 | struct iwch_dev *rhp; | 521 | struct iwch_dev *rhp; |
528 | int new_acc; | ||
529 | __be64 *page_list = NULL; | 522 | __be64 *page_list = NULL; |
530 | int shift = 0; | 523 | int shift = 0; |
531 | u64 total_size; | 524 | u64 total_size; |
@@ -546,14 +539,12 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr, | |||
546 | if (rhp != php->rhp) | 539 | if (rhp != php->rhp) |
547 | return -EINVAL; | 540 | return -EINVAL; |
548 | 541 | ||
549 | new_acc = mhp->attr.perms; | ||
550 | |||
551 | memcpy(&mh, mhp, sizeof *mhp); | 542 | memcpy(&mh, mhp, sizeof *mhp); |
552 | 543 | ||
553 | if (mr_rereg_mask & IB_MR_REREG_PD) | 544 | if (mr_rereg_mask & IB_MR_REREG_PD) |
554 | php = to_iwch_pd(pd); | 545 | php = to_iwch_pd(pd); |
555 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) | 546 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) |
556 | mh.attr.perms = iwch_convert_access(acc); | 547 | mh.attr.perms = iwch_ib_to_tpt_access(acc); |
557 | if (mr_rereg_mask & IB_MR_REREG_TRANS) | 548 | if (mr_rereg_mask & IB_MR_REREG_TRANS) |
558 | ret = build_phys_page_list(buffer_list, num_phys_buf, | 549 | ret = build_phys_page_list(buffer_list, num_phys_buf, |
559 | iova_start, | 550 | iova_start, |
@@ -568,7 +559,7 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr, | |||
568 | if (mr_rereg_mask & IB_MR_REREG_PD) | 559 | if (mr_rereg_mask & IB_MR_REREG_PD) |
569 | mhp->attr.pdid = php->pdid; | 560 | mhp->attr.pdid = php->pdid; |
570 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) | 561 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) |
571 | mhp->attr.perms = acc; | 562 | mhp->attr.perms = iwch_ib_to_tpt_access(acc); |
572 | if (mr_rereg_mask & IB_MR_REREG_TRANS) { | 563 | if (mr_rereg_mask & IB_MR_REREG_TRANS) { |
573 | mhp->attr.zbva = 0; | 564 | mhp->attr.zbva = 0; |
574 | mhp->attr.va_fbo = *iova_start; | 565 | mhp->attr.va_fbo = *iova_start; |
@@ -613,8 +604,6 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, struct ib_umem *region, | |||
613 | goto err; | 604 | goto err; |
614 | } | 605 | } |
615 | 606 | ||
616 | acc = iwch_convert_access(acc); | ||
617 | |||
618 | i = n = 0; | 607 | i = n = 0; |
619 | 608 | ||
620 | list_for_each_entry(chunk, ®ion->chunk_list, list) | 609 | list_for_each_entry(chunk, ®ion->chunk_list, list) |
@@ -630,10 +619,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, struct ib_umem *region, | |||
630 | mhp->rhp = rhp; | 619 | mhp->rhp = rhp; |
631 | mhp->attr.pdid = php->pdid; | 620 | mhp->attr.pdid = php->pdid; |
632 | mhp->attr.zbva = 0; | 621 | mhp->attr.zbva = 0; |
633 | mhp->attr.perms = (acc & 0x1) << 3; | 622 | mhp->attr.perms = iwch_ib_to_tpt_access(acc); |
634 | mhp->attr.perms |= (acc & 0x2) << 1; | ||
635 | mhp->attr.perms |= (acc & 0x4) >> 1; | ||
636 | mhp->attr.perms |= (acc & 0x8) >> 3; | ||
637 | mhp->attr.va_fbo = region->virt_base; | 623 | mhp->attr.va_fbo = region->virt_base; |
638 | mhp->attr.page_size = shift - 12; | 624 | mhp->attr.page_size = shift - 12; |
639 | mhp->attr.len = (u32) region->length; | 625 | mhp->attr.len = (u32) region->length; |
@@ -736,10 +722,8 @@ static int iwch_destroy_qp(struct ib_qp *ib_qp) | |||
736 | qhp = to_iwch_qp(ib_qp); | 722 | qhp = to_iwch_qp(ib_qp); |
737 | rhp = qhp->rhp; | 723 | rhp = qhp->rhp; |
738 | 724 | ||
739 | if (qhp->attr.state == IWCH_QP_STATE_RTS) { | 725 | attrs.next_state = IWCH_QP_STATE_ERROR; |
740 | attrs.next_state = IWCH_QP_STATE_ERROR; | 726 | iwch_modify_qp(rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, &attrs, 0); |
741 | iwch_modify_qp(rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, &attrs, 0); | ||
742 | } | ||
743 | wait_event(qhp->wait, !qhp->ep); | 727 | wait_event(qhp->wait, !qhp->ep); |
744 | 728 | ||
745 | remove_handle(rhp, &rhp->qpidr, qhp->wq.qpid); | 729 | remove_handle(rhp, &rhp->qpidr, qhp->wq.qpid); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h b/drivers/infiniband/hw/cxgb3/iwch_provider.h index de0fe1b93a0c..93bcc56756bd 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.h +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h | |||
@@ -286,27 +286,20 @@ static inline int iwch_convert_state(enum ib_qp_state ib_state) | |||
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | enum iwch_mem_perms { | 289 | static inline u32 iwch_ib_to_tpt_access(int acc) |
290 | IWCH_MEM_ACCESS_LOCAL_READ = 1 << 0, | ||
291 | IWCH_MEM_ACCESS_LOCAL_WRITE = 1 << 1, | ||
292 | IWCH_MEM_ACCESS_REMOTE_READ = 1 << 2, | ||
293 | IWCH_MEM_ACCESS_REMOTE_WRITE = 1 << 3, | ||
294 | IWCH_MEM_ACCESS_ATOMICS = 1 << 4, | ||
295 | IWCH_MEM_ACCESS_BINDING = 1 << 5, | ||
296 | IWCH_MEM_ACCESS_LOCAL = | ||
297 | (IWCH_MEM_ACCESS_LOCAL_READ | IWCH_MEM_ACCESS_LOCAL_WRITE), | ||
298 | IWCH_MEM_ACCESS_REMOTE = | ||
299 | (IWCH_MEM_ACCESS_REMOTE_WRITE | IWCH_MEM_ACCESS_REMOTE_READ) | ||
300 | /* cannot go beyond 1 << 31 */ | ||
301 | } __attribute__ ((packed)); | ||
302 | |||
303 | static inline u32 iwch_convert_access(int acc) | ||
304 | { | 290 | { |
305 | return (acc & IB_ACCESS_REMOTE_WRITE ? IWCH_MEM_ACCESS_REMOTE_WRITE : 0) | 291 | return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) | |
306 | | (acc & IB_ACCESS_REMOTE_READ ? IWCH_MEM_ACCESS_REMOTE_READ : 0) | | 292 | (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0) | |
307 | (acc & IB_ACCESS_LOCAL_WRITE ? IWCH_MEM_ACCESS_LOCAL_WRITE : 0) | | 293 | (acc & IB_ACCESS_LOCAL_WRITE ? TPT_LOCAL_WRITE : 0) | |
308 | (acc & IB_ACCESS_MW_BIND ? IWCH_MEM_ACCESS_BINDING : 0) | | 294 | TPT_LOCAL_READ; |
309 | IWCH_MEM_ACCESS_LOCAL_READ; | 295 | } |
296 | |||
297 | static inline u32 iwch_ib_to_mwbind_access(int acc) | ||
298 | { | ||
299 | return (acc & IB_ACCESS_REMOTE_WRITE ? T3_MEM_ACCESS_REM_WRITE : 0) | | ||
300 | (acc & IB_ACCESS_REMOTE_READ ? T3_MEM_ACCESS_REM_READ : 0) | | ||
301 | (acc & IB_ACCESS_LOCAL_WRITE ? T3_MEM_ACCESS_LOCAL_WRITE : 0) | | ||
302 | T3_MEM_ACCESS_LOCAL_READ; | ||
310 | } | 303 | } |
311 | 304 | ||
312 | enum iwch_mmid_state { | 305 | enum iwch_mmid_state { |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index 9ea00cc4a5f8..0a472c9b44db 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -439,7 +439,7 @@ int iwch_bind_mw(struct ib_qp *qp, | |||
439 | wqe->bind.type = T3_VA_BASED_TO; | 439 | wqe->bind.type = T3_VA_BASED_TO; |
440 | 440 | ||
441 | /* TBD: check perms */ | 441 | /* TBD: check perms */ |
442 | wqe->bind.perms = iwch_convert_access(mw_bind->mw_access_flags); | 442 | wqe->bind.perms = iwch_ib_to_mwbind_access(mw_bind->mw_access_flags); |
443 | wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey); | 443 | wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey); |
444 | wqe->bind.mw_stag = cpu_to_be32(mw->rkey); | 444 | wqe->bind.mw_stag = cpu_to_be32(mw->rkey); |
445 | wqe->bind.mw_len = cpu_to_be32(mw_bind->length); | 445 | wqe->bind.mw_len = cpu_to_be32(mw_bind->length); |
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 40404c9e2817..82ded44c6cee 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -52,6 +52,8 @@ struct ehca_mw; | |||
52 | struct ehca_pd; | 52 | struct ehca_pd; |
53 | struct ehca_av; | 53 | struct ehca_av; |
54 | 54 | ||
55 | #include <linux/wait.h> | ||
56 | |||
55 | #include <rdma/ib_verbs.h> | 57 | #include <rdma/ib_verbs.h> |
56 | #include <rdma/ib_user_verbs.h> | 58 | #include <rdma/ib_user_verbs.h> |
57 | 59 | ||
@@ -153,7 +155,9 @@ struct ehca_cq { | |||
153 | spinlock_t cb_lock; | 155 | spinlock_t cb_lock; |
154 | struct hlist_head qp_hashtab[QP_HASHTAB_LEN]; | 156 | struct hlist_head qp_hashtab[QP_HASHTAB_LEN]; |
155 | struct list_head entry; | 157 | struct list_head entry; |
156 | u32 nr_callbacks; | 158 | u32 nr_callbacks; /* #events assigned to cpu by scaling code */ |
159 | u32 nr_events; /* #events seen */ | ||
160 | wait_queue_head_t wait_completion; | ||
157 | spinlock_t task_lock; | 161 | spinlock_t task_lock; |
158 | u32 ownpid; | 162 | u32 ownpid; |
159 | /* mmap counter for resources mapped into user space */ | 163 | /* mmap counter for resources mapped into user space */ |
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c index 6ebfa27e4e16..e2cdc1a16fe9 100644 --- a/drivers/infiniband/hw/ehca/ehca_cq.c +++ b/drivers/infiniband/hw/ehca/ehca_cq.c | |||
@@ -146,6 +146,7 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, | |||
146 | spin_lock_init(&my_cq->spinlock); | 146 | spin_lock_init(&my_cq->spinlock); |
147 | spin_lock_init(&my_cq->cb_lock); | 147 | spin_lock_init(&my_cq->cb_lock); |
148 | spin_lock_init(&my_cq->task_lock); | 148 | spin_lock_init(&my_cq->task_lock); |
149 | init_waitqueue_head(&my_cq->wait_completion); | ||
149 | my_cq->ownpid = current->tgid; | 150 | my_cq->ownpid = current->tgid; |
150 | 151 | ||
151 | cq = &my_cq->ib_cq; | 152 | cq = &my_cq->ib_cq; |
@@ -302,6 +303,16 @@ create_cq_exit1: | |||
302 | return cq; | 303 | return cq; |
303 | } | 304 | } |
304 | 305 | ||
306 | static int get_cq_nr_events(struct ehca_cq *my_cq) | ||
307 | { | ||
308 | int ret; | ||
309 | unsigned long flags; | ||
310 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
311 | ret = my_cq->nr_events; | ||
312 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
313 | return ret; | ||
314 | } | ||
315 | |||
305 | int ehca_destroy_cq(struct ib_cq *cq) | 316 | int ehca_destroy_cq(struct ib_cq *cq) |
306 | { | 317 | { |
307 | u64 h_ret; | 318 | u64 h_ret; |
@@ -329,10 +340,11 @@ int ehca_destroy_cq(struct ib_cq *cq) | |||
329 | } | 340 | } |
330 | 341 | ||
331 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | 342 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); |
332 | while (my_cq->nr_callbacks) { | 343 | while (my_cq->nr_events) { |
333 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | 344 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); |
334 | yield(); | 345 | wait_event(my_cq->wait_completion, !get_cq_nr_events(my_cq)); |
335 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | 346 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); |
347 | /* recheck nr_events to assure no cqe has just arrived */ | ||
336 | } | 348 | } |
337 | 349 | ||
338 | idr_remove(&ehca_cq_idr, my_cq->token); | 350 | idr_remove(&ehca_cq_idr, my_cq->token); |
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c index 3ec53c687d08..20f36bf8b2b6 100644 --- a/drivers/infiniband/hw/ehca/ehca_irq.c +++ b/drivers/infiniband/hw/ehca/ehca_irq.c | |||
@@ -404,10 +404,11 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe) | |||
404 | u32 token; | 404 | u32 token; |
405 | unsigned long flags; | 405 | unsigned long flags; |
406 | struct ehca_cq *cq; | 406 | struct ehca_cq *cq; |
407 | |||
407 | eqe_value = eqe->entry; | 408 | eqe_value = eqe->entry; |
408 | ehca_dbg(&shca->ib_device, "eqe_value=%lx", eqe_value); | 409 | ehca_dbg(&shca->ib_device, "eqe_value=%lx", eqe_value); |
409 | if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) { | 410 | if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) { |
410 | ehca_dbg(&shca->ib_device, "... completion event"); | 411 | ehca_dbg(&shca->ib_device, "Got completion event"); |
411 | token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value); | 412 | token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value); |
412 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | 413 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); |
413 | cq = idr_find(&ehca_cq_idr, token); | 414 | cq = idr_find(&ehca_cq_idr, token); |
@@ -419,16 +420,20 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe) | |||
419 | return; | 420 | return; |
420 | } | 421 | } |
421 | reset_eq_pending(cq); | 422 | reset_eq_pending(cq); |
422 | if (ehca_scaling_code) { | 423 | cq->nr_events++; |
424 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
425 | if (ehca_scaling_code) | ||
423 | queue_comp_task(cq); | 426 | queue_comp_task(cq); |
424 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | 427 | else { |
425 | } else { | ||
426 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
427 | comp_event_callback(cq); | 428 | comp_event_callback(cq); |
429 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
430 | cq->nr_events--; | ||
431 | if (!cq->nr_events) | ||
432 | wake_up(&cq->wait_completion); | ||
433 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
428 | } | 434 | } |
429 | } else { | 435 | } else { |
430 | ehca_dbg(&shca->ib_device, | 436 | ehca_dbg(&shca->ib_device, "Got non completion event"); |
431 | "Got non completion event"); | ||
432 | parse_identifier(shca, eqe_value); | 437 | parse_identifier(shca, eqe_value); |
433 | } | 438 | } |
434 | } | 439 | } |
@@ -478,6 +483,7 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq) | |||
478 | "token=%x", token); | 483 | "token=%x", token); |
479 | continue; | 484 | continue; |
480 | } | 485 | } |
486 | eqe_cache[eqe_cnt].cq->nr_events++; | ||
481 | spin_unlock(&ehca_cq_idr_lock); | 487 | spin_unlock(&ehca_cq_idr_lock); |
482 | } else | 488 | } else |
483 | eqe_cache[eqe_cnt].cq = NULL; | 489 | eqe_cache[eqe_cnt].cq = NULL; |
@@ -504,12 +510,18 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq) | |||
504 | /* call completion handler for cached eqes */ | 510 | /* call completion handler for cached eqes */ |
505 | for (i = 0; i < eqe_cnt; i++) | 511 | for (i = 0; i < eqe_cnt; i++) |
506 | if (eq->eqe_cache[i].cq) { | 512 | if (eq->eqe_cache[i].cq) { |
507 | if (ehca_scaling_code) { | 513 | if (ehca_scaling_code) |
508 | spin_lock(&ehca_cq_idr_lock); | ||
509 | queue_comp_task(eq->eqe_cache[i].cq); | 514 | queue_comp_task(eq->eqe_cache[i].cq); |
510 | spin_unlock(&ehca_cq_idr_lock); | 515 | else { |
511 | } else | 516 | struct ehca_cq *cq = eq->eqe_cache[i].cq; |
512 | comp_event_callback(eq->eqe_cache[i].cq); | 517 | comp_event_callback(cq); |
518 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
519 | cq->nr_events--; | ||
520 | if (!cq->nr_events) | ||
521 | wake_up(&cq->wait_completion); | ||
522 | spin_unlock_irqrestore(&ehca_cq_idr_lock, | ||
523 | flags); | ||
524 | } | ||
513 | } else { | 525 | } else { |
514 | ehca_dbg(&shca->ib_device, "Got non completion event"); | 526 | ehca_dbg(&shca->ib_device, "Got non completion event"); |
515 | parse_identifier(shca, eq->eqe_cache[i].eqe->entry); | 527 | parse_identifier(shca, eq->eqe_cache[i].eqe->entry); |
@@ -523,7 +535,6 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq) | |||
523 | if (!eqe) | 535 | if (!eqe) |
524 | break; | 536 | break; |
525 | process_eqe(shca, eqe); | 537 | process_eqe(shca, eqe); |
526 | eqe_cnt++; | ||
527 | } while (1); | 538 | } while (1); |
528 | 539 | ||
529 | unlock_irq_spinlock: | 540 | unlock_irq_spinlock: |
@@ -567,8 +578,7 @@ static void __queue_comp_task(struct ehca_cq *__cq, | |||
567 | list_add_tail(&__cq->entry, &cct->cq_list); | 578 | list_add_tail(&__cq->entry, &cct->cq_list); |
568 | cct->cq_jobs++; | 579 | cct->cq_jobs++; |
569 | wake_up(&cct->wait_queue); | 580 | wake_up(&cct->wait_queue); |
570 | } | 581 | } else |
571 | else | ||
572 | __cq->nr_callbacks++; | 582 | __cq->nr_callbacks++; |
573 | 583 | ||
574 | spin_unlock(&__cq->task_lock); | 584 | spin_unlock(&__cq->task_lock); |
@@ -577,18 +587,21 @@ static void __queue_comp_task(struct ehca_cq *__cq, | |||
577 | 587 | ||
578 | static void queue_comp_task(struct ehca_cq *__cq) | 588 | static void queue_comp_task(struct ehca_cq *__cq) |
579 | { | 589 | { |
580 | int cpu; | ||
581 | int cpu_id; | 590 | int cpu_id; |
582 | struct ehca_cpu_comp_task *cct; | 591 | struct ehca_cpu_comp_task *cct; |
592 | int cq_jobs; | ||
593 | unsigned long flags; | ||
583 | 594 | ||
584 | cpu = get_cpu(); | ||
585 | cpu_id = find_next_online_cpu(pool); | 595 | cpu_id = find_next_online_cpu(pool); |
586 | BUG_ON(!cpu_online(cpu_id)); | 596 | BUG_ON(!cpu_online(cpu_id)); |
587 | 597 | ||
588 | cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); | 598 | cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); |
589 | BUG_ON(!cct); | 599 | BUG_ON(!cct); |
590 | 600 | ||
591 | if (cct->cq_jobs > 0) { | 601 | spin_lock_irqsave(&cct->task_lock, flags); |
602 | cq_jobs = cct->cq_jobs; | ||
603 | spin_unlock_irqrestore(&cct->task_lock, flags); | ||
604 | if (cq_jobs > 0) { | ||
592 | cpu_id = find_next_online_cpu(pool); | 605 | cpu_id = find_next_online_cpu(pool); |
593 | cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); | 606 | cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); |
594 | BUG_ON(!cct); | 607 | BUG_ON(!cct); |
@@ -608,11 +621,17 @@ static void run_comp_task(struct ehca_cpu_comp_task* cct) | |||
608 | cq = list_entry(cct->cq_list.next, struct ehca_cq, entry); | 621 | cq = list_entry(cct->cq_list.next, struct ehca_cq, entry); |
609 | spin_unlock_irqrestore(&cct->task_lock, flags); | 622 | spin_unlock_irqrestore(&cct->task_lock, flags); |
610 | comp_event_callback(cq); | 623 | comp_event_callback(cq); |
611 | spin_lock_irqsave(&cct->task_lock, flags); | ||
612 | 624 | ||
625 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
626 | cq->nr_events--; | ||
627 | if (!cq->nr_events) | ||
628 | wake_up(&cq->wait_completion); | ||
629 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
630 | |||
631 | spin_lock_irqsave(&cct->task_lock, flags); | ||
613 | spin_lock(&cq->task_lock); | 632 | spin_lock(&cq->task_lock); |
614 | cq->nr_callbacks--; | 633 | cq->nr_callbacks--; |
615 | if (cq->nr_callbacks == 0) { | 634 | if (!cq->nr_callbacks) { |
616 | list_del_init(cct->cq_list.next); | 635 | list_del_init(cct->cq_list.next); |
617 | cct->cq_jobs--; | 636 | cct->cq_jobs--; |
618 | } | 637 | } |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index c1835121a822..059da9628bb5 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -52,7 +52,7 @@ | |||
52 | MODULE_LICENSE("Dual BSD/GPL"); | 52 | MODULE_LICENSE("Dual BSD/GPL"); |
53 | MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); | 53 | MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); |
54 | MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver"); | 54 | MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver"); |
55 | MODULE_VERSION("SVNEHCA_0021"); | 55 | MODULE_VERSION("SVNEHCA_0022"); |
56 | 56 | ||
57 | int ehca_open_aqp1 = 0; | 57 | int ehca_open_aqp1 = 0; |
58 | int ehca_debug_level = 0; | 58 | int ehca_debug_level = 0; |
@@ -810,7 +810,7 @@ int __init ehca_module_init(void) | |||
810 | int ret; | 810 | int ret; |
811 | 811 | ||
812 | printk(KERN_INFO "eHCA Infiniband Device Driver " | 812 | printk(KERN_INFO "eHCA Infiniband Device Driver " |
813 | "(Rel.: SVNEHCA_0021)\n"); | 813 | "(Rel.: SVNEHCA_0022)\n"); |
814 | idr_init(&ehca_qp_idr); | 814 | idr_init(&ehca_qp_idr); |
815 | idr_init(&ehca_cq_idr); | 815 | idr_init(&ehca_cq_idr); |
816 | spin_lock_init(&ehca_qp_idr_lock); | 816 | spin_lock_init(&ehca_qp_idr_lock); |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 71dc84bd4254..1c6b63aca268 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -1088,21 +1088,21 @@ static void mthca_unmap_memfree(struct mthca_dev *dev, | |||
1088 | static int mthca_alloc_memfree(struct mthca_dev *dev, | 1088 | static int mthca_alloc_memfree(struct mthca_dev *dev, |
1089 | struct mthca_qp *qp) | 1089 | struct mthca_qp *qp) |
1090 | { | 1090 | { |
1091 | int ret = 0; | ||
1092 | |||
1093 | if (mthca_is_memfree(dev)) { | 1091 | if (mthca_is_memfree(dev)) { |
1094 | qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, | 1092 | qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, |
1095 | qp->qpn, &qp->rq.db); | 1093 | qp->qpn, &qp->rq.db); |
1096 | if (qp->rq.db_index < 0) | 1094 | if (qp->rq.db_index < 0) |
1097 | return ret; | 1095 | return -ENOMEM; |
1098 | 1096 | ||
1099 | qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, | 1097 | qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, |
1100 | qp->qpn, &qp->sq.db); | 1098 | qp->qpn, &qp->sq.db); |
1101 | if (qp->sq.db_index < 0) | 1099 | if (qp->sq.db_index < 0) { |
1102 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); | 1100 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); |
1101 | return -ENOMEM; | ||
1102 | } | ||
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | return ret; | 1105 | return 0; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static void mthca_free_memfree(struct mthca_dev *dev, | 1108 | static void mthca_free_memfree(struct mthca_dev *dev, |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index bb2e3d5eee20..56c87a81bb67 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -407,6 +407,10 @@ static int ipoib_mcast_join_complete(int status, | |||
407 | queue_delayed_work(ipoib_workqueue, | 407 | queue_delayed_work(ipoib_workqueue, |
408 | &priv->mcast_task, 0); | 408 | &priv->mcast_task, 0); |
409 | mutex_unlock(&mcast_mutex); | 409 | mutex_unlock(&mcast_mutex); |
410 | |||
411 | if (mcast == priv->broadcast) | ||
412 | netif_carrier_on(dev); | ||
413 | |||
410 | return 0; | 414 | return 0; |
411 | } | 415 | } |
412 | 416 | ||
@@ -594,7 +598,6 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
594 | ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); | 598 | ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); |
595 | 599 | ||
596 | clear_bit(IPOIB_MCAST_RUN, &priv->flags); | 600 | clear_bit(IPOIB_MCAST_RUN, &priv->flags); |
597 | netif_carrier_on(dev); | ||
598 | } | 601 | } |
599 | 602 | ||
600 | int ipoib_mcast_start_thread(struct net_device *dev) | 603 | int ipoib_mcast_start_thread(struct net_device *dev) |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index 3cb551b88756..7f3ec205e35f 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | |||
@@ -259,12 +259,13 @@ void ipoib_event(struct ib_event_handler *handler, | |||
259 | struct ipoib_dev_priv *priv = | 259 | struct ipoib_dev_priv *priv = |
260 | container_of(handler, struct ipoib_dev_priv, event_handler); | 260 | container_of(handler, struct ipoib_dev_priv, event_handler); |
261 | 261 | ||
262 | if (record->event == IB_EVENT_PORT_ERR || | 262 | if ((record->event == IB_EVENT_PORT_ERR || |
263 | record->event == IB_EVENT_PKEY_CHANGE || | 263 | record->event == IB_EVENT_PKEY_CHANGE || |
264 | record->event == IB_EVENT_PORT_ACTIVE || | 264 | record->event == IB_EVENT_PORT_ACTIVE || |
265 | record->event == IB_EVENT_LID_CHANGE || | 265 | record->event == IB_EVENT_LID_CHANGE || |
266 | record->event == IB_EVENT_SM_CHANGE || | 266 | record->event == IB_EVENT_SM_CHANGE || |
267 | record->event == IB_EVENT_CLIENT_REREGISTER) { | 267 | record->event == IB_EVENT_CLIENT_REREGISTER) && |
268 | record->element.port_num == priv->port) { | ||
268 | ipoib_dbg(priv, "Port state change event\n"); | 269 | ipoib_dbg(priv, "Port state change event\n"); |
269 | queue_work(ipoib_workqueue, &priv->flush_task); | 270 | queue_work(ipoib_workqueue, &priv->flush_task); |
270 | } | 271 | } |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index ec195a36e8f6..db9cca3b65e0 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -553,7 +553,8 @@ static int __devinit i8042_check_aux(void) | |||
553 | */ | 553 | */ |
554 | 554 | ||
555 | param = 0x5a; | 555 | param = 0x5a; |
556 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0x5a) { | 556 | retval = i8042_command(¶m, I8042_CMD_AUX_LOOP); |
557 | if (retval || param != 0x5a) { | ||
557 | 558 | ||
558 | /* | 559 | /* |
559 | * External connection test - filters out AT-soldered PS/2 i8042's | 560 | * External connection test - filters out AT-soldered PS/2 i8042's |
@@ -567,7 +568,12 @@ static int __devinit i8042_check_aux(void) | |||
567 | (param && param != 0xfa && param != 0xff)) | 568 | (param && param != 0xfa && param != 0xff)) |
568 | return -1; | 569 | return -1; |
569 | 570 | ||
570 | aux_loop_broken = 1; | 571 | /* |
572 | * If AUX_LOOP completed without error but returned unexpected data | ||
573 | * mark it as broken | ||
574 | */ | ||
575 | if (!retval) | ||
576 | aux_loop_broken = 1; | ||
571 | } | 577 | } |
572 | 578 | ||
573 | /* | 579 | /* |
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 295e931c0dfb..4b232124a1ab 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -211,7 +211,7 @@ static struct workqueue_struct *led_workqueue; | |||
211 | enum led_brightness value); \ | 211 | enum led_brightness value); \ |
212 | static void object##_led_update(struct work_struct *ignored); \ | 212 | static void object##_led_update(struct work_struct *ignored); \ |
213 | static int object##_led_wk; \ | 213 | static int object##_led_wk; \ |
214 | DECLARE_WORK(object##_led_work, object##_led_update); \ | 214 | static DECLARE_WORK(object##_led_work, object##_led_update); \ |
215 | static struct led_classdev object##_led = { \ | 215 | static struct led_classdev object##_led = { \ |
216 | .name = "asus:" ledname, \ | 216 | .name = "asus:" ledname, \ |
217 | .brightness_set = object##_led_set, \ | 217 | .brightness_set = object##_led_set, \ |
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 2ebe240dd537..ac708bc2f9f3 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -453,7 +453,7 @@ static int sony_acpi_resume(struct acpi_device *device) | |||
453 | static int sony_acpi_add(struct acpi_device *device) | 453 | static int sony_acpi_add(struct acpi_device *device) |
454 | { | 454 | { |
455 | acpi_status status; | 455 | acpi_status status; |
456 | int result; | 456 | int result = 0; |
457 | acpi_handle handle; | 457 | acpi_handle handle; |
458 | 458 | ||
459 | sony_acpi_acpi_device = device; | 459 | sony_acpi_acpi_device = device; |
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index e3acd398fb37..1f6445840461 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -359,6 +359,8 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) | |||
359 | cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp; | 359 | cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp; |
360 | cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; | 360 | cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; |
361 | cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; | 361 | cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; |
362 | cfi->chips[i].ref_point_counter = 0; | ||
363 | init_waitqueue_head(&(cfi->chips[i].wq)); | ||
362 | } | 364 | } |
363 | 365 | ||
364 | map->fldrv = &cfi_amdstd_chipdrv; | 366 | map->fldrv = &cfi_amdstd_chipdrv; |
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c index 69d49e0250a9..b344ff858b2d 100644 --- a/drivers/mtd/chips/cfi_cmdset_0020.c +++ b/drivers/mtd/chips/cfi_cmdset_0020.c | |||
@@ -158,6 +158,8 @@ struct mtd_info *cfi_cmdset_0020(struct map_info *map, int primary) | |||
158 | cfi->chips[i].word_write_time = 128; | 158 | cfi->chips[i].word_write_time = 128; |
159 | cfi->chips[i].buffer_write_time = 128; | 159 | cfi->chips[i].buffer_write_time = 128; |
160 | cfi->chips[i].erase_time = 1024; | 160 | cfi->chips[i].erase_time = 1024; |
161 | cfi->chips[i].ref_point_counter = 0; | ||
162 | init_waitqueue_head(&(cfi->chips[i].wq)); | ||
161 | } | 163 | } |
162 | 164 | ||
163 | return cfi_staa_setup(map); | 165 | return cfi_staa_setup(map); |
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c index b1104fe1f207..1c3b34ad7325 100644 --- a/drivers/mtd/maps/dilnetpc.c +++ b/drivers/mtd/maps/dilnetpc.c | |||
@@ -402,8 +402,8 @@ static int __init init_dnpc(void) | |||
402 | ++higlvl_partition_info[i].name; | 402 | ++higlvl_partition_info[i].name; |
403 | } | 403 | } |
404 | 404 | ||
405 | printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n", | 405 | printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%llx\n", |
406 | is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys); | 406 | is_dnp ? "DNPC" : "ADNP", dnpc_map.size, (unsigned long long)dnpc_map.phys); |
407 | 407 | ||
408 | dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size); | 408 | dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size); |
409 | 409 | ||
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c index 0bc013fd66a3..aa64a4752781 100644 --- a/drivers/mtd/maps/esb2rom.c +++ b/drivers/mtd/maps/esb2rom.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | #define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */ | 31 | #define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */ |
32 | 32 | ||
33 | #define BIOS_CNTL 0xDC | 33 | #define BIOS_CNTL 0xDC |
34 | #define BIOS_LOCK_ENABLE 0x02 | 34 | #define BIOS_LOCK_ENABLE 0x02 |
35 | #define BIOS_WRITE_ENABLE 0x01 | 35 | #define BIOS_WRITE_ENABLE 0x01 |
36 | 36 | ||
@@ -145,7 +145,7 @@ static void esb2rom_cleanup(struct esb2rom_window *window) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | static int __devinit esb2rom_init_one(struct pci_dev *pdev, | 147 | static int __devinit esb2rom_init_one(struct pci_dev *pdev, |
148 | const struct pci_device_id *ent) | 148 | const struct pci_device_id *ent) |
149 | { | 149 | { |
150 | static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; | 150 | static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; |
151 | struct esb2rom_window *window = &esb2rom_window; | 151 | struct esb2rom_window *window = &esb2rom_window; |
@@ -185,7 +185,7 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev, | |||
185 | /* Find a region continuous to the end of the ROM window */ | 185 | /* Find a region continuous to the end of the ROM window */ |
186 | window->phys = 0; | 186 | window->phys = 0; |
187 | pci_read_config_word(pdev, FWH_DEC_EN1, &word); | 187 | pci_read_config_word(pdev, FWH_DEC_EN1, &word); |
188 | printk(KERN_DEBUG "pci_read_config_byte : %x\n", word); | 188 | printk(KERN_DEBUG "pci_read_config_word : %x\n", word); |
189 | 189 | ||
190 | if ((word & FWH_8MiB) == FWH_8MiB) | 190 | if ((word & FWH_8MiB) == FWH_8MiB) |
191 | window->phys = 0xff400000; | 191 | window->phys = 0xff400000; |
@@ -212,6 +212,11 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev, | |||
212 | else if ((word & FWH_0_5MiB) == FWH_0_5MiB) | 212 | else if ((word & FWH_0_5MiB) == FWH_0_5MiB) |
213 | window->phys = 0xfff80000; | 213 | window->phys = 0xfff80000; |
214 | 214 | ||
215 | if (window->phys == 0) { | ||
216 | printk(KERN_ERR MOD_NAME ": Rom window is closed\n"); | ||
217 | goto out; | ||
218 | } | ||
219 | |||
215 | /* reserved 0x0020 and 0x0010 */ | 220 | /* reserved 0x0020 and 0x0010 */ |
216 | window->phys -= 0x400000UL; | 221 | window->phys -= 0x400000UL; |
217 | window->size = (0xffffffffUL - window->phys) + 1UL; | 222 | window->size = (0xffffffffUL - window->phys) + 1UL; |
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 880580c44e01..41844ea02462 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -727,6 +727,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
727 | concat->mtd.erasesize = subdev[0]->erasesize; | 727 | concat->mtd.erasesize = subdev[0]->erasesize; |
728 | concat->mtd.writesize = subdev[0]->writesize; | 728 | concat->mtd.writesize = subdev[0]->writesize; |
729 | concat->mtd.oobsize = subdev[0]->oobsize; | 729 | concat->mtd.oobsize = subdev[0]->oobsize; |
730 | concat->mtd.oobavail = subdev[0]->oobavail; | ||
730 | if (subdev[0]->writev) | 731 | if (subdev[0]->writev) |
731 | concat->mtd.writev = concat_writev; | 732 | concat->mtd.writev = concat_writev; |
732 | if (subdev[0]->read_oob) | 733 | if (subdev[0]->read_oob) |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 633def3fb087..1af989023c66 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -200,6 +200,11 @@ static int part_erase (struct mtd_info *mtd, struct erase_info *instr) | |||
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | instr->addr += part->offset; | 201 | instr->addr += part->offset; |
202 | ret = part->master->erase(part->master, instr); | 202 | ret = part->master->erase(part->master, instr); |
203 | if (ret) { | ||
204 | if (instr->fail_addr != 0xffffffff) | ||
205 | instr->fail_addr -= part->offset; | ||
206 | instr->addr -= part->offset; | ||
207 | } | ||
203 | return ret; | 208 | return ret; |
204 | } | 209 | } |
205 | 210 | ||
@@ -338,6 +343,7 @@ int add_mtd_partitions(struct mtd_info *master, | |||
338 | slave->mtd.size = parts[i].size; | 343 | slave->mtd.size = parts[i].size; |
339 | slave->mtd.writesize = master->writesize; | 344 | slave->mtd.writesize = master->writesize; |
340 | slave->mtd.oobsize = master->oobsize; | 345 | slave->mtd.oobsize = master->oobsize; |
346 | slave->mtd.oobavail = master->oobavail; | ||
341 | slave->mtd.subpage_sft = master->subpage_sft; | 347 | slave->mtd.subpage_sft = master->subpage_sft; |
342 | 348 | ||
343 | slave->mtd.name = parts[i].name; | 349 | slave->mtd.name = parts[i].name; |
@@ -559,4 +565,3 @@ EXPORT_SYMBOL_GPL(deregister_mtd_parser); | |||
559 | MODULE_LICENSE("GPL"); | 565 | MODULE_LICENSE("GPL"); |
560 | MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>"); | 566 | MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>"); |
561 | MODULE_DESCRIPTION("Generic support for partitioning of MTD devices"); | 567 | MODULE_DESCRIPTION("Generic support for partitioning of MTD devices"); |
562 | |||
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c index 12608c13cce5..595208f965a5 100644 --- a/drivers/mtd/nand/diskonchip.c +++ b/drivers/mtd/nand/diskonchip.c | |||
@@ -114,7 +114,7 @@ module_param(no_autopart, int, 0); | |||
114 | static int show_firmware_partition = 0; | 114 | static int show_firmware_partition = 0; |
115 | module_param(show_firmware_partition, int, 0); | 115 | module_param(show_firmware_partition, int, 0); |
116 | 116 | ||
117 | #ifdef MTD_NAND_DISKONCHIP_BBTWRITE | 117 | #ifdef CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE |
118 | static int inftl_bbt_write = 1; | 118 | static int inftl_bbt_write = 1; |
119 | #else | 119 | #else |
120 | static int inftl_bbt_write = 0; | 120 | static int inftl_bbt_write = 0; |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index acaf97bc80d1..6af37b8cff65 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2524,6 +2524,7 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
2524 | for (i = 0; chip->ecc.layout->oobfree[i].length; i++) | 2524 | for (i = 0; chip->ecc.layout->oobfree[i].length; i++) |
2525 | chip->ecc.layout->oobavail += | 2525 | chip->ecc.layout->oobavail += |
2526 | chip->ecc.layout->oobfree[i].length; | 2526 | chip->ecc.layout->oobfree[i].length; |
2527 | mtd->oobavail = chip->ecc.layout->oobavail; | ||
2527 | 2528 | ||
2528 | /* | 2529 | /* |
2529 | * Set the number of read / write steps for one page depending on ECC | 2530 | * Set the number of read / write steps for one page depending on ECC |
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 7f1cb6e5dccb..9e14a26ca4e8 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c | |||
@@ -4,6 +4,11 @@ | |||
4 | * Copyright (C) 2005-2007 Samsung Electronics | 4 | * Copyright (C) 2005-2007 Samsung Electronics |
5 | * Kyungmin Park <kyungmin.park@samsung.com> | 5 | * Kyungmin Park <kyungmin.park@samsung.com> |
6 | * | 6 | * |
7 | * Credits: | ||
8 | * Adrian Hunter <ext-adrian.hunter@nokia.com>: | ||
9 | * auto-placement support, read-while load support, various fixes | ||
10 | * Copyright (C) Nokia Corporation, 2007 | ||
11 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 13 | * it under the terms of the GNU General Public License version 2 as |
9 | * published by the Free Software Foundation. | 14 | * published by the Free Software Foundation. |
@@ -831,7 +836,7 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col | |||
831 | int readcol = column; | 836 | int readcol = column; |
832 | int readend = column + thislen; | 837 | int readend = column + thislen; |
833 | int lastgap = 0; | 838 | int lastgap = 0; |
834 | uint8_t *oob_buf = this->page_buf + mtd->writesize; | 839 | uint8_t *oob_buf = this->oob_buf; |
835 | 840 | ||
836 | for (free = this->ecclayout->oobfree; free->length; ++free) { | 841 | for (free = this->ecclayout->oobfree; free->length; ++free) { |
837 | if (readcol >= lastgap) | 842 | if (readcol >= lastgap) |
@@ -849,7 +854,8 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col | |||
849 | int n = ed - st; | 854 | int n = ed - st; |
850 | memcpy(buf, oob_buf + st, n); | 855 | memcpy(buf, oob_buf + st, n); |
851 | buf += n; | 856 | buf += n; |
852 | } | 857 | } else |
858 | break; | ||
853 | } | 859 | } |
854 | return 0; | 860 | return 0; |
855 | } | 861 | } |
@@ -947,9 +953,9 @@ static int onenand_do_read_oob(struct mtd_info *mtd, loff_t from, size_t len, | |||
947 | 953 | ||
948 | /** | 954 | /** |
949 | * onenand_read_oob - [MTD Interface] NAND write data and/or out-of-band | 955 | * onenand_read_oob - [MTD Interface] NAND write data and/or out-of-band |
950 | * @mtd: MTD device structure | 956 | * @param mtd: MTD device structure |
951 | * @from: offset to read from | 957 | * @param from: offset to read from |
952 | * @ops: oob operation description structure | 958 | * @param ops: oob operation description structure |
953 | */ | 959 | */ |
954 | static int onenand_read_oob(struct mtd_info *mtd, loff_t from, | 960 | static int onenand_read_oob(struct mtd_info *mtd, loff_t from, |
955 | struct mtd_oob_ops *ops) | 961 | struct mtd_oob_ops *ops) |
@@ -1017,7 +1023,7 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state) | |||
1017 | * onenand_bbt_read_oob - [MTD Interface] OneNAND read out-of-band for bbt scan | 1023 | * onenand_bbt_read_oob - [MTD Interface] OneNAND read out-of-band for bbt scan |
1018 | * @param mtd MTD device structure | 1024 | * @param mtd MTD device structure |
1019 | * @param from offset to read from | 1025 | * @param from offset to read from |
1020 | * @param @ops oob operation description structure | 1026 | * @param ops oob operation description structure |
1021 | * | 1027 | * |
1022 | * OneNAND read out-of-band data from the spare area for bbt scan | 1028 | * OneNAND read out-of-band data from the spare area for bbt scan |
1023 | */ | 1029 | */ |
@@ -1093,7 +1099,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from, | |||
1093 | static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to) | 1099 | static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to) |
1094 | { | 1100 | { |
1095 | struct onenand_chip *this = mtd->priv; | 1101 | struct onenand_chip *this = mtd->priv; |
1096 | char *readp = this->page_buf + mtd->writesize; | 1102 | char oobbuf[64]; |
1097 | int status, i; | 1103 | int status, i; |
1098 | 1104 | ||
1099 | this->command(mtd, ONENAND_CMD_READOOB, to, mtd->oobsize); | 1105 | this->command(mtd, ONENAND_CMD_READOOB, to, mtd->oobsize); |
@@ -1102,9 +1108,9 @@ static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to | |||
1102 | if (status) | 1108 | if (status) |
1103 | return status; | 1109 | return status; |
1104 | 1110 | ||
1105 | this->read_bufferram(mtd, ONENAND_SPARERAM, readp, 0, mtd->oobsize); | 1111 | this->read_bufferram(mtd, ONENAND_SPARERAM, oobbuf, 0, mtd->oobsize); |
1106 | for(i = 0; i < mtd->oobsize; i++) | 1112 | for (i = 0; i < mtd->oobsize; i++) |
1107 | if (buf[i] != 0xFF && buf[i] != readp[i]) | 1113 | if (buf[i] != 0xFF && buf[i] != oobbuf[i]) |
1108 | return -EBADMSG; | 1114 | return -EBADMSG; |
1109 | 1115 | ||
1110 | return 0; | 1116 | return 0; |
@@ -1290,7 +1296,8 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf, | |||
1290 | int n = ed - st; | 1296 | int n = ed - st; |
1291 | memcpy(oob_buf + st, buf, n); | 1297 | memcpy(oob_buf + st, buf, n); |
1292 | buf += n; | 1298 | buf += n; |
1293 | } | 1299 | } else |
1300 | break; | ||
1294 | } | 1301 | } |
1295 | return 0; | 1302 | return 0; |
1296 | } | 1303 | } |
@@ -1312,6 +1319,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1312 | struct onenand_chip *this = mtd->priv; | 1319 | struct onenand_chip *this = mtd->priv; |
1313 | int column, ret = 0, oobsize; | 1320 | int column, ret = 0, oobsize; |
1314 | int written = 0; | 1321 | int written = 0; |
1322 | u_char *oobbuf; | ||
1315 | 1323 | ||
1316 | DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len); | 1324 | DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len); |
1317 | 1325 | ||
@@ -1331,7 +1339,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1331 | } | 1339 | } |
1332 | 1340 | ||
1333 | /* For compatibility with NAND: Do not allow write past end of page */ | 1341 | /* For compatibility with NAND: Do not allow write past end of page */ |
1334 | if (column + len > oobsize) { | 1342 | if (unlikely(column + len > oobsize)) { |
1335 | printk(KERN_ERR "onenand_write_oob: " | 1343 | printk(KERN_ERR "onenand_write_oob: " |
1336 | "Attempt to write past end of page\n"); | 1344 | "Attempt to write past end of page\n"); |
1337 | return -EINVAL; | 1345 | return -EINVAL; |
@@ -1348,6 +1356,8 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1348 | /* Grab the lock and see if the device is available */ | 1356 | /* Grab the lock and see if the device is available */ |
1349 | onenand_get_device(mtd, FL_WRITING); | 1357 | onenand_get_device(mtd, FL_WRITING); |
1350 | 1358 | ||
1359 | oobbuf = this->oob_buf; | ||
1360 | |||
1351 | /* Loop until all data write */ | 1361 | /* Loop until all data write */ |
1352 | while (written < len) { | 1362 | while (written < len) { |
1353 | int thislen = min_t(int, oobsize, len - written); | 1363 | int thislen = min_t(int, oobsize, len - written); |
@@ -1358,12 +1368,12 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1358 | 1368 | ||
1359 | /* We send data to spare ram with oobsize | 1369 | /* We send data to spare ram with oobsize |
1360 | * to prevent byte access */ | 1370 | * to prevent byte access */ |
1361 | memset(this->page_buf, 0xff, mtd->oobsize); | 1371 | memset(oobbuf, 0xff, mtd->oobsize); |
1362 | if (mode == MTD_OOB_AUTO) | 1372 | if (mode == MTD_OOB_AUTO) |
1363 | onenand_fill_auto_oob(mtd, this->page_buf, buf, column, thislen); | 1373 | onenand_fill_auto_oob(mtd, oobbuf, buf, column, thislen); |
1364 | else | 1374 | else |
1365 | memcpy(this->page_buf + column, buf, thislen); | 1375 | memcpy(oobbuf + column, buf, thislen); |
1366 | this->write_bufferram(mtd, ONENAND_SPARERAM, this->page_buf, 0, mtd->oobsize); | 1376 | this->write_bufferram(mtd, ONENAND_SPARERAM, oobbuf, 0, mtd->oobsize); |
1367 | 1377 | ||
1368 | this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize); | 1378 | this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize); |
1369 | 1379 | ||
@@ -1375,7 +1385,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1375 | break; | 1385 | break; |
1376 | } | 1386 | } |
1377 | 1387 | ||
1378 | ret = onenand_verify_oob(mtd, this->page_buf, to); | 1388 | ret = onenand_verify_oob(mtd, oobbuf, to); |
1379 | if (ret) { | 1389 | if (ret) { |
1380 | printk(KERN_ERR "onenand_write_oob: verify failed %d\n", ret); | 1390 | printk(KERN_ERR "onenand_write_oob: verify failed %d\n", ret); |
1381 | break; | 1391 | break; |
@@ -1400,9 +1410,9 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1400 | 1410 | ||
1401 | /** | 1411 | /** |
1402 | * onenand_write_oob - [MTD Interface] NAND write data and/or out-of-band | 1412 | * onenand_write_oob - [MTD Interface] NAND write data and/or out-of-band |
1403 | * @mtd: MTD device structure | 1413 | * @param mtd: MTD device structure |
1404 | * @from: offset to read from | 1414 | * @param to: offset to write |
1405 | * @ops: oob operation description structure | 1415 | * @param ops: oob operation description structure |
1406 | */ | 1416 | */ |
1407 | static int onenand_write_oob(struct mtd_info *mtd, loff_t to, | 1417 | static int onenand_write_oob(struct mtd_info *mtd, loff_t to, |
1408 | struct mtd_oob_ops *ops) | 1418 | struct mtd_oob_ops *ops) |
@@ -1616,6 +1626,7 @@ static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
1616 | * @param mtd MTD device structure | 1626 | * @param mtd MTD device structure |
1617 | * @param ofs offset relative to mtd start | 1627 | * @param ofs offset relative to mtd start |
1618 | * @param len number of bytes to lock or unlock | 1628 | * @param len number of bytes to lock or unlock |
1629 | * @param cmd lock or unlock command | ||
1619 | * | 1630 | * |
1620 | * Lock or unlock one or more blocks | 1631 | * Lock or unlock one or more blocks |
1621 | */ | 1632 | */ |
@@ -2117,10 +2128,11 @@ static void onenand_check_features(struct mtd_info *mtd) | |||
2117 | } | 2128 | } |
2118 | 2129 | ||
2119 | /** | 2130 | /** |
2120 | * onenand_print_device_info - Print device ID | 2131 | * onenand_print_device_info - Print device & version ID |
2121 | * @param device device ID | 2132 | * @param device device ID |
2133 | * @param version version ID | ||
2122 | * | 2134 | * |
2123 | * Print device ID | 2135 | * Print device & version ID |
2124 | */ | 2136 | */ |
2125 | static void onenand_print_device_info(int device, int version) | 2137 | static void onenand_print_device_info(int device, int version) |
2126 | { | 2138 | { |
@@ -2320,15 +2332,25 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) | |||
2320 | 2332 | ||
2321 | /* Allocate buffers, if necessary */ | 2333 | /* Allocate buffers, if necessary */ |
2322 | if (!this->page_buf) { | 2334 | if (!this->page_buf) { |
2323 | size_t len; | 2335 | this->page_buf = kzalloc(mtd->writesize, GFP_KERNEL); |
2324 | len = mtd->writesize + mtd->oobsize; | ||
2325 | this->page_buf = kmalloc(len, GFP_KERNEL); | ||
2326 | if (!this->page_buf) { | 2336 | if (!this->page_buf) { |
2327 | printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); | 2337 | printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); |
2328 | return -ENOMEM; | 2338 | return -ENOMEM; |
2329 | } | 2339 | } |
2330 | this->options |= ONENAND_PAGEBUF_ALLOC; | 2340 | this->options |= ONENAND_PAGEBUF_ALLOC; |
2331 | } | 2341 | } |
2342 | if (!this->oob_buf) { | ||
2343 | this->oob_buf = kzalloc(mtd->oobsize, GFP_KERNEL); | ||
2344 | if (!this->oob_buf) { | ||
2345 | printk(KERN_ERR "onenand_scan(): Can't allocate oob_buf\n"); | ||
2346 | if (this->options & ONENAND_PAGEBUF_ALLOC) { | ||
2347 | this->options &= ~ONENAND_PAGEBUF_ALLOC; | ||
2348 | kfree(this->page_buf); | ||
2349 | } | ||
2350 | return -ENOMEM; | ||
2351 | } | ||
2352 | this->options |= ONENAND_OOBBUF_ALLOC; | ||
2353 | } | ||
2332 | 2354 | ||
2333 | this->state = FL_READY; | 2355 | this->state = FL_READY; |
2334 | init_waitqueue_head(&this->wq); | 2356 | init_waitqueue_head(&this->wq); |
@@ -2367,6 +2389,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) | |||
2367 | for (i = 0; this->ecclayout->oobfree[i].length; i++) | 2389 | for (i = 0; this->ecclayout->oobfree[i].length; i++) |
2368 | this->ecclayout->oobavail += | 2390 | this->ecclayout->oobavail += |
2369 | this->ecclayout->oobfree[i].length; | 2391 | this->ecclayout->oobfree[i].length; |
2392 | mtd->oobavail = this->ecclayout->oobavail; | ||
2370 | 2393 | ||
2371 | mtd->ecclayout = this->ecclayout; | 2394 | mtd->ecclayout = this->ecclayout; |
2372 | 2395 | ||
@@ -2424,9 +2447,11 @@ void onenand_release(struct mtd_info *mtd) | |||
2424 | kfree(bbm->bbt); | 2447 | kfree(bbm->bbt); |
2425 | kfree(this->bbm); | 2448 | kfree(this->bbm); |
2426 | } | 2449 | } |
2427 | /* Buffer allocated by onenand_scan */ | 2450 | /* Buffers allocated by onenand_scan */ |
2428 | if (this->options & ONENAND_PAGEBUF_ALLOC) | 2451 | if (this->options & ONENAND_PAGEBUF_ALLOC) |
2429 | kfree(this->page_buf); | 2452 | kfree(this->page_buf); |
2453 | if (this->options & ONENAND_OOBBUF_ALLOC) | ||
2454 | kfree(this->oob_buf); | ||
2430 | } | 2455 | } |
2431 | 2456 | ||
2432 | EXPORT_SYMBOL_GPL(onenand_scan); | 2457 | EXPORT_SYMBOL_GPL(onenand_scan); |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 72995777f809..b406ecfa7268 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -858,19 +858,7 @@ static struct eisa_device_id vortex_eisa_ids[] = { | |||
858 | }; | 858 | }; |
859 | MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); | 859 | MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); |
860 | 860 | ||
861 | static int vortex_eisa_probe(struct device *device); | 861 | static int __init vortex_eisa_probe(struct device *device) |
862 | static int vortex_eisa_remove(struct device *device); | ||
863 | |||
864 | static struct eisa_driver vortex_eisa_driver = { | ||
865 | .id_table = vortex_eisa_ids, | ||
866 | .driver = { | ||
867 | .name = "3c59x", | ||
868 | .probe = vortex_eisa_probe, | ||
869 | .remove = vortex_eisa_remove | ||
870 | } | ||
871 | }; | ||
872 | |||
873 | static int vortex_eisa_probe(struct device *device) | ||
874 | { | 862 | { |
875 | void __iomem *ioaddr; | 863 | void __iomem *ioaddr; |
876 | struct eisa_device *edev; | 864 | struct eisa_device *edev; |
@@ -893,7 +881,7 @@ static int vortex_eisa_probe(struct device *device) | |||
893 | return 0; | 881 | return 0; |
894 | } | 882 | } |
895 | 883 | ||
896 | static int vortex_eisa_remove(struct device *device) | 884 | static int __devexit vortex_eisa_remove(struct device *device) |
897 | { | 885 | { |
898 | struct eisa_device *edev; | 886 | struct eisa_device *edev; |
899 | struct net_device *dev; | 887 | struct net_device *dev; |
@@ -918,7 +906,17 @@ static int vortex_eisa_remove(struct device *device) | |||
918 | free_netdev(dev); | 906 | free_netdev(dev); |
919 | return 0; | 907 | return 0; |
920 | } | 908 | } |
921 | #endif | 909 | |
910 | static struct eisa_driver vortex_eisa_driver = { | ||
911 | .id_table = vortex_eisa_ids, | ||
912 | .driver = { | ||
913 | .name = "3c59x", | ||
914 | .probe = vortex_eisa_probe, | ||
915 | .remove = __devexit_p(vortex_eisa_remove) | ||
916 | } | ||
917 | }; | ||
918 | |||
919 | #endif /* CONFIG_EISA */ | ||
922 | 920 | ||
923 | /* returns count found (>= 0), or negative on error */ | 921 | /* returns count found (>= 0), or negative on error */ |
924 | static int __init vortex_eisa_init(void) | 922 | static int __init vortex_eisa_init(void) |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 9ba21e0f27c5..1ee27c360a4b 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -787,6 +787,12 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
787 | unsigned int size; | 787 | unsigned int size; |
788 | int err; | 788 | int err; |
789 | 789 | ||
790 | /* Clear any pending ethernet port interrupts */ | ||
791 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0); | ||
792 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0); | ||
793 | /* wait for previous write to complete */ | ||
794 | mv_read (MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num)); | ||
795 | |||
790 | err = request_irq(dev->irq, mv643xx_eth_int_handler, | 796 | err = request_irq(dev->irq, mv643xx_eth_int_handler, |
791 | IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); | 797 | IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); |
792 | if (err) { | 798 | if (err) { |
@@ -875,10 +881,6 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
875 | 881 | ||
876 | mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */ | 882 | mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */ |
877 | 883 | ||
878 | /* Clear any pending ethernet port interrupts */ | ||
879 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0); | ||
880 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0); | ||
881 | |||
882 | eth_port_start(dev); | 884 | eth_port_start(dev); |
883 | 885 | ||
884 | /* Interrupt Coalescing */ | 886 | /* Interrupt Coalescing */ |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index b05dc6ed7fb7..ac02b3b60f92 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -181,6 +181,7 @@ struct myri10ge_priv { | |||
181 | int intr_coal_delay; | 181 | int intr_coal_delay; |
182 | __be32 __iomem *intr_coal_delay_ptr; | 182 | __be32 __iomem *intr_coal_delay_ptr; |
183 | int mtrr; | 183 | int mtrr; |
184 | int wc_enabled; | ||
184 | int wake_queue; | 185 | int wake_queue; |
185 | int stop_queue; | 186 | int stop_queue; |
186 | int down_cnt; | 187 | int down_cnt; |
@@ -717,6 +718,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
717 | int status; | 718 | int status; |
718 | size_t bytes; | 719 | size_t bytes; |
719 | u32 len; | 720 | u32 len; |
721 | struct page *dmatest_page; | ||
722 | dma_addr_t dmatest_bus; | ||
720 | 723 | ||
721 | /* try to send a reset command to the card to see if it | 724 | /* try to send a reset command to the card to see if it |
722 | * is alive */ | 725 | * is alive */ |
@@ -726,6 +729,11 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
726 | dev_err(&mgp->pdev->dev, "failed reset\n"); | 729 | dev_err(&mgp->pdev->dev, "failed reset\n"); |
727 | return -ENXIO; | 730 | return -ENXIO; |
728 | } | 731 | } |
732 | dmatest_page = alloc_page(GFP_KERNEL); | ||
733 | if (!dmatest_page) | ||
734 | return -ENOMEM; | ||
735 | dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE, | ||
736 | DMA_BIDIRECTIONAL); | ||
729 | 737 | ||
730 | /* Now exchange information about interrupts */ | 738 | /* Now exchange information about interrupts */ |
731 | 739 | ||
@@ -764,8 +772,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
764 | 772 | ||
765 | len = mgp->tx.boundary; | 773 | len = mgp->tx.boundary; |
766 | 774 | ||
767 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); | 775 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); |
768 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); | 776 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); |
769 | cmd.data2 = len * 0x10000; | 777 | cmd.data2 = len * 0x10000; |
770 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | 778 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); |
771 | if (status == 0) | 779 | if (status == 0) |
@@ -774,8 +782,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
774 | else | 782 | else |
775 | dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n", | 783 | dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n", |
776 | status); | 784 | status); |
777 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); | 785 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); |
778 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); | 786 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); |
779 | cmd.data2 = len * 0x1; | 787 | cmd.data2 = len * 0x1; |
780 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | 788 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); |
781 | if (status == 0) | 789 | if (status == 0) |
@@ -785,8 +793,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
785 | dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n", | 793 | dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n", |
786 | status); | 794 | status); |
787 | 795 | ||
788 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); | 796 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); |
789 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); | 797 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); |
790 | cmd.data2 = len * 0x10001; | 798 | cmd.data2 = len * 0x10001; |
791 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | 799 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); |
792 | if (status == 0) | 800 | if (status == 0) |
@@ -796,6 +804,9 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
796 | dev_warn(&mgp->pdev->dev, | 804 | dev_warn(&mgp->pdev->dev, |
797 | "DMA read/write benchmark failed: %d\n", status); | 805 | "DMA read/write benchmark failed: %d\n", status); |
798 | 806 | ||
807 | pci_unmap_page(mgp->pdev, dmatest_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
808 | put_page(dmatest_page); | ||
809 | |||
799 | memset(mgp->rx_done.entry, 0, bytes); | 810 | memset(mgp->rx_done.entry, 0, bytes); |
800 | 811 | ||
801 | /* reset mcp/driver shared state back to 0 */ | 812 | /* reset mcp/driver shared state back to 0 */ |
@@ -1375,7 +1386,7 @@ myri10ge_get_ethtool_stats(struct net_device *netdev, | |||
1375 | data[i] = ((unsigned long *)&mgp->stats)[i]; | 1386 | data[i] = ((unsigned long *)&mgp->stats)[i]; |
1376 | 1387 | ||
1377 | data[i++] = (unsigned int)mgp->tx.boundary; | 1388 | data[i++] = (unsigned int)mgp->tx.boundary; |
1378 | data[i++] = (unsigned int)(mgp->mtrr >= 0); | 1389 | data[i++] = (unsigned int)mgp->wc_enabled; |
1379 | data[i++] = (unsigned int)mgp->pdev->irq; | 1390 | data[i++] = (unsigned int)mgp->pdev->irq; |
1380 | data[i++] = (unsigned int)mgp->msi_enabled; | 1391 | data[i++] = (unsigned int)mgp->msi_enabled; |
1381 | data[i++] = (unsigned int)mgp->read_dma; | 1392 | data[i++] = (unsigned int)mgp->read_dma; |
@@ -1456,6 +1467,8 @@ static int myri10ge_allocate_rings(struct net_device *dev) | |||
1456 | status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0); | 1467 | status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0); |
1457 | tx_ring_size = cmd.data0; | 1468 | tx_ring_size = cmd.data0; |
1458 | status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); | 1469 | status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); |
1470 | if (status != 0) | ||
1471 | return status; | ||
1459 | rx_ring_size = cmd.data0; | 1472 | rx_ring_size = cmd.data0; |
1460 | 1473 | ||
1461 | tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send); | 1474 | tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send); |
@@ -1463,6 +1476,8 @@ static int myri10ge_allocate_rings(struct net_device *dev) | |||
1463 | mgp->tx.mask = tx_ring_entries - 1; | 1476 | mgp->tx.mask = tx_ring_entries - 1; |
1464 | mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1; | 1477 | mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1; |
1465 | 1478 | ||
1479 | status = -ENOMEM; | ||
1480 | |||
1466 | /* allocate the host shadow rings */ | 1481 | /* allocate the host shadow rings */ |
1467 | 1482 | ||
1468 | bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4) | 1483 | bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4) |
@@ -1735,7 +1750,7 @@ static int myri10ge_open(struct net_device *dev) | |||
1735 | goto abort_with_irq; | 1750 | goto abort_with_irq; |
1736 | } | 1751 | } |
1737 | 1752 | ||
1738 | if (myri10ge_wcfifo && mgp->mtrr >= 0) { | 1753 | if (myri10ge_wcfifo && mgp->wc_enabled) { |
1739 | mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4; | 1754 | mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4; |
1740 | mgp->rx_small.wc_fifo = | 1755 | mgp->rx_small.wc_fifo = |
1741 | (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL; | 1756 | (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL; |
@@ -2510,6 +2525,12 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | |||
2510 | bridge->vendor, bridge->device); | 2525 | bridge->vendor, bridge->device); |
2511 | mgp->tx.boundary = 4096; | 2526 | mgp->tx.boundary = 4096; |
2512 | mgp->fw_name = myri10ge_fw_aligned; | 2527 | mgp->fw_name = myri10ge_fw_aligned; |
2528 | } else if (bridge && | ||
2529 | bridge->vendor == PCI_VENDOR_ID_SGI && | ||
2530 | bridge->device == 0x4002 /* TIOCE pcie-port */ ) { | ||
2531 | /* this pcie bridge does not support 4K rdma request */ | ||
2532 | mgp->tx.boundary = 2048; | ||
2533 | mgp->fw_name = myri10ge_fw_aligned; | ||
2513 | } | 2534 | } |
2514 | } else { | 2535 | } else { |
2515 | if (myri10ge_force_firmware == 1) { | 2536 | if (myri10ge_force_firmware == 1) { |
@@ -2830,9 +2851,12 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2830 | mgp->board_span = pci_resource_len(pdev, 0); | 2851 | mgp->board_span = pci_resource_len(pdev, 0); |
2831 | mgp->iomem_base = pci_resource_start(pdev, 0); | 2852 | mgp->iomem_base = pci_resource_start(pdev, 0); |
2832 | mgp->mtrr = -1; | 2853 | mgp->mtrr = -1; |
2854 | mgp->wc_enabled = 0; | ||
2833 | #ifdef CONFIG_MTRR | 2855 | #ifdef CONFIG_MTRR |
2834 | mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span, | 2856 | mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span, |
2835 | MTRR_TYPE_WRCOMB, 1); | 2857 | MTRR_TYPE_WRCOMB, 1); |
2858 | if (mgp->mtrr >= 0) | ||
2859 | mgp->wc_enabled = 1; | ||
2836 | #endif | 2860 | #endif |
2837 | /* Hack. need to get rid of these magic numbers */ | 2861 | /* Hack. need to get rid of these magic numbers */ |
2838 | mgp->sram_size = | 2862 | mgp->sram_size = |
@@ -2927,7 +2951,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2927 | dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", | 2951 | dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", |
2928 | (mgp->msi_enabled ? "MSI" : "xPIC"), | 2952 | (mgp->msi_enabled ? "MSI" : "xPIC"), |
2929 | netdev->irq, mgp->tx.boundary, mgp->fw_name, | 2953 | netdev->irq, mgp->tx.boundary, mgp->fw_name, |
2930 | (mgp->mtrr >= 0 ? "Enabled" : "Disabled")); | 2954 | (mgp->wc_enabled ? "Enabled" : "Disabled")); |
2931 | 2955 | ||
2932 | return 0; | 2956 | return 0; |
2933 | 2957 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index a2877f33fa85..1be55702557d 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -228,7 +228,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
228 | &adapter->ctx_desc_pdev); | 228 | &adapter->ctx_desc_pdev); |
229 | 229 | ||
230 | printk("ctx_desc_phys_addr: 0x%llx\n", | 230 | printk("ctx_desc_phys_addr: 0x%llx\n", |
231 | (u64) adapter->ctx_desc_phys_addr); | 231 | (unsigned long long) adapter->ctx_desc_phys_addr); |
232 | if (addr == NULL) { | 232 | if (addr == NULL) { |
233 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); | 233 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); |
234 | err = -ENOMEM; | 234 | err = -ENOMEM; |
@@ -247,7 +247,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
247 | adapter->max_tx_desc_count, | 247 | adapter->max_tx_desc_count, |
248 | (dma_addr_t *) & hw->cmd_desc_phys_addr, | 248 | (dma_addr_t *) & hw->cmd_desc_phys_addr, |
249 | &adapter->ahw.cmd_desc_pdev); | 249 | &adapter->ahw.cmd_desc_pdev); |
250 | printk("cmd_desc_phys_addr: 0x%llx\n", (u64) hw->cmd_desc_phys_addr); | 250 | printk("cmd_desc_phys_addr: 0x%llx\n", |
251 | (unsigned long long) hw->cmd_desc_phys_addr); | ||
251 | 252 | ||
252 | if (addr == NULL) { | 253 | if (addr == NULL) { |
253 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); | 254 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 15d954e50cae..521b5f0618a4 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -572,8 +572,8 @@ static void rtl8169_xmii_reset_enable(void __iomem *ioaddr) | |||
572 | { | 572 | { |
573 | unsigned int val; | 573 | unsigned int val; |
574 | 574 | ||
575 | mdio_write(ioaddr, MII_BMCR, BMCR_RESET); | 575 | val = mdio_read(ioaddr, MII_BMCR) | BMCR_RESET; |
576 | val = mdio_read(ioaddr, MII_BMCR); | 576 | mdio_write(ioaddr, MII_BMCR, val & 0xffff); |
577 | } | 577 | } |
578 | 578 | ||
579 | static void rtl8169_check_link_status(struct net_device *dev, | 579 | static void rtl8169_check_link_status(struct net_device *dev, |
@@ -1368,11 +1368,7 @@ static inline void rtl8169_request_timer(struct net_device *dev) | |||
1368 | (tp->phy_version >= RTL_GIGA_PHY_VER_H)) | 1368 | (tp->phy_version >= RTL_GIGA_PHY_VER_H)) |
1369 | return; | 1369 | return; |
1370 | 1370 | ||
1371 | init_timer(timer); | 1371 | mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT); |
1372 | timer->expires = jiffies + RTL8169_PHY_TIMEOUT; | ||
1373 | timer->data = (unsigned long)(dev); | ||
1374 | timer->function = rtl8169_phy_timer; | ||
1375 | add_timer(timer); | ||
1376 | } | 1372 | } |
1377 | 1373 | ||
1378 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1374 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -1685,6 +1681,10 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1685 | tp->mmio_addr = ioaddr; | 1681 | tp->mmio_addr = ioaddr; |
1686 | tp->align = rtl_cfg_info[ent->driver_data].align; | 1682 | tp->align = rtl_cfg_info[ent->driver_data].align; |
1687 | 1683 | ||
1684 | init_timer(&tp->timer); | ||
1685 | tp->timer.data = (unsigned long) dev; | ||
1686 | tp->timer.function = rtl8169_phy_timer; | ||
1687 | |||
1688 | spin_lock_init(&tp->lock); | 1688 | spin_lock_init(&tp->lock); |
1689 | 1689 | ||
1690 | rc = register_netdev(dev); | 1690 | rc = register_netdev(dev); |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 53839979cfb8..ab0ab92583fe 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -2165,9 +2165,27 @@ force_update: | |||
2165 | /* fall through */ | 2165 | /* fall through */ |
2166 | #endif | 2166 | #endif |
2167 | case OP_RXCHKS: | 2167 | case OP_RXCHKS: |
2168 | skb = sky2->rx_ring[sky2->rx_next].skb; | 2168 | if (!sky2->rx_csum) |
2169 | skb->ip_summed = CHECKSUM_COMPLETE; | 2169 | break; |
2170 | skb->csum = status & 0xffff; | 2170 | |
2171 | /* Both checksum counters are programmed to start at | ||
2172 | * the same offset, so unless there is a problem they | ||
2173 | * should match. This failure is an early indication that | ||
2174 | * hardware receive checksumming won't work. | ||
2175 | */ | ||
2176 | if (likely(status >> 16 == (status & 0xffff))) { | ||
2177 | skb = sky2->rx_ring[sky2->rx_next].skb; | ||
2178 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
2179 | skb->csum = status & 0xffff; | ||
2180 | } else { | ||
2181 | printk(KERN_NOTICE PFX "%s: hardware receive " | ||
2182 | "checksum problem (status = %#x)\n", | ||
2183 | dev->name, status); | ||
2184 | sky2->rx_csum = 0; | ||
2185 | sky2_write32(sky2->hw, | ||
2186 | Q_ADDR(rxqaddr[le->link], Q_CSR), | ||
2187 | BMU_DIS_RX_CHKSUM); | ||
2188 | } | ||
2171 | break; | 2189 | break; |
2172 | 2190 | ||
2173 | case OP_TXINDEXLE: | 2191 | case OP_TXINDEXLE: |
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c index 0d97e10ccac5..36202e94ee91 100644 --- a/drivers/net/tokenring/ibmtr.c +++ b/drivers/net/tokenring/ibmtr.c | |||
@@ -186,7 +186,6 @@ static char __devinit *adapter_def(char type) | |||
186 | #define TRC_INITV 0x02 /* verbose init trace points */ | 186 | #define TRC_INITV 0x02 /* verbose init trace points */ |
187 | static unsigned char ibmtr_debug_trace = 0; | 187 | static unsigned char ibmtr_debug_trace = 0; |
188 | 188 | ||
189 | static int ibmtr_probe(struct net_device *dev); | ||
190 | static int ibmtr_probe1(struct net_device *dev, int ioaddr); | 189 | static int ibmtr_probe1(struct net_device *dev, int ioaddr); |
191 | static unsigned char get_sram_size(struct tok_info *adapt_info); | 190 | static unsigned char get_sram_size(struct tok_info *adapt_info); |
192 | static int trdev_init(struct net_device *dev); | 191 | static int trdev_init(struct net_device *dev); |
@@ -335,17 +334,6 @@ static void ibmtr_cleanup_card(struct net_device *dev) | |||
335 | #endif | 334 | #endif |
336 | } | 335 | } |
337 | 336 | ||
338 | int ibmtr_probe_card(struct net_device *dev) | ||
339 | { | ||
340 | int err = ibmtr_probe(dev); | ||
341 | if (!err) { | ||
342 | err = register_netdev(dev); | ||
343 | if (err) | ||
344 | ibmtr_cleanup_card(dev); | ||
345 | } | ||
346 | return err; | ||
347 | } | ||
348 | |||
349 | /**************************************************************************** | 337 | /**************************************************************************** |
350 | * ibmtr_probe(): Routine specified in the network device structure | 338 | * ibmtr_probe(): Routine specified in the network device structure |
351 | * to probe for an IBM Token Ring Adapter. Routine outline: | 339 | * to probe for an IBM Token Ring Adapter. Routine outline: |
@@ -358,7 +346,7 @@ int ibmtr_probe_card(struct net_device *dev) | |||
358 | * which references it. | 346 | * which references it. |
359 | ****************************************************************************/ | 347 | ****************************************************************************/ |
360 | 348 | ||
361 | static int ibmtr_probe(struct net_device *dev) | 349 | static int __init ibmtr_probe(struct net_device *dev) |
362 | { | 350 | { |
363 | int i; | 351 | int i; |
364 | int base_addr = dev->base_addr; | 352 | int base_addr = dev->base_addr; |
@@ -378,6 +366,17 @@ static int ibmtr_probe(struct net_device *dev) | |||
378 | return -ENODEV; | 366 | return -ENODEV; |
379 | } | 367 | } |
380 | 368 | ||
369 | int __init ibmtr_probe_card(struct net_device *dev) | ||
370 | { | ||
371 | int err = ibmtr_probe(dev); | ||
372 | if (!err) { | ||
373 | err = register_netdev(dev); | ||
374 | if (err) | ||
375 | ibmtr_cleanup_card(dev); | ||
376 | } | ||
377 | return err; | ||
378 | } | ||
379 | |||
381 | /*****************************************************************************/ | 380 | /*****************************************************************************/ |
382 | 381 | ||
383 | static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) | 382 | static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index ebbda1d8f542..f3a972e74e9a 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -30,8 +30,8 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define DRV_NAME "via-rhine" | 32 | #define DRV_NAME "via-rhine" |
33 | #define DRV_VERSION "1.4.2" | 33 | #define DRV_VERSION "1.4.3" |
34 | #define DRV_RELDATE "Sept-11-2006" | 34 | #define DRV_RELDATE "2007-03-06" |
35 | 35 | ||
36 | 36 | ||
37 | /* A few user-configurable values. | 37 | /* A few user-configurable values. |
@@ -105,6 +105,7 @@ static const int multicast_filter_limit = 32; | |||
105 | #include <asm/io.h> | 105 | #include <asm/io.h> |
106 | #include <asm/irq.h> | 106 | #include <asm/irq.h> |
107 | #include <asm/uaccess.h> | 107 | #include <asm/uaccess.h> |
108 | #include <linux/dmi.h> | ||
108 | 109 | ||
109 | /* These identify the driver base version and may not be removed. */ | 110 | /* These identify the driver base version and may not be removed. */ |
110 | static char version[] __devinitdata = | 111 | static char version[] __devinitdata = |
@@ -1995,6 +1996,23 @@ static struct pci_driver rhine_driver = { | |||
1995 | .shutdown = rhine_shutdown, | 1996 | .shutdown = rhine_shutdown, |
1996 | }; | 1997 | }; |
1997 | 1998 | ||
1999 | static struct dmi_system_id __initdata rhine_dmi_table[] = { | ||
2000 | { | ||
2001 | .ident = "EPIA-M", | ||
2002 | .matches = { | ||
2003 | DMI_MATCH(DMI_BIOS_VENDOR, "Award Software International, Inc."), | ||
2004 | DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"), | ||
2005 | }, | ||
2006 | }, | ||
2007 | { | ||
2008 | .ident = "KV7", | ||
2009 | .matches = { | ||
2010 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"), | ||
2011 | DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"), | ||
2012 | }, | ||
2013 | }, | ||
2014 | { NULL } | ||
2015 | }; | ||
1998 | 2016 | ||
1999 | static int __init rhine_init(void) | 2017 | static int __init rhine_init(void) |
2000 | { | 2018 | { |
@@ -2002,6 +2020,16 @@ static int __init rhine_init(void) | |||
2002 | #ifdef MODULE | 2020 | #ifdef MODULE |
2003 | printk(version); | 2021 | printk(version); |
2004 | #endif | 2022 | #endif |
2023 | if (dmi_check_system(rhine_dmi_table)) { | ||
2024 | /* these BIOSes fail at PXE boot if chip is in D3 */ | ||
2025 | avoid_D3 = 1; | ||
2026 | printk(KERN_WARNING "%s: Broken BIOS detected, avoid_D3 " | ||
2027 | "enabled.\n", | ||
2028 | DRV_NAME); | ||
2029 | } | ||
2030 | else if (avoid_D3) | ||
2031 | printk(KERN_INFO "%s: avoid_D3 set.\n", DRV_NAME); | ||
2032 | |||
2005 | return pci_register_driver(&rhine_driver); | 2033 | return pci_register_driver(&rhine_driver); |
2006 | } | 2034 | } |
2007 | 2035 | ||
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c index 8dbcf83bb5f3..8b4540bfc1b0 100644 --- a/drivers/net/wan/z85230.c +++ b/drivers/net/wan/z85230.c | |||
@@ -407,7 +407,7 @@ static void z8530_tx(struct z8530_channel *c) | |||
407 | while(c->txcount) { | 407 | while(c->txcount) { |
408 | /* FIFO full ? */ | 408 | /* FIFO full ? */ |
409 | if(!(read_zsreg(c, R0)&4)) | 409 | if(!(read_zsreg(c, R0)&4)) |
410 | break; | 410 | return; |
411 | c->txcount--; | 411 | c->txcount--; |
412 | /* | 412 | /* |
413 | * Shovel out the byte | 413 | * Shovel out the byte |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index e594af46ff05..80cb88eb98c6 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -1858,9 +1858,6 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id) | |||
1858 | 1858 | ||
1859 | spin_lock(&bcm->irq_lock); | 1859 | spin_lock(&bcm->irq_lock); |
1860 | 1860 | ||
1861 | assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); | ||
1862 | assert(bcm->current_core->id == BCM43xx_COREID_80211); | ||
1863 | |||
1864 | reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); | 1861 | reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); |
1865 | if (reason == 0xffffffff) { | 1862 | if (reason == 0xffffffff) { |
1866 | /* irq not for us (shared irq) */ | 1863 | /* irq not for us (shared irq) */ |
@@ -1871,6 +1868,9 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id) | |||
1871 | if (!reason) | 1868 | if (!reason) |
1872 | goto out; | 1869 | goto out; |
1873 | 1870 | ||
1871 | assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); | ||
1872 | assert(bcm->current_core->id == BCM43xx_COREID_80211); | ||
1873 | |||
1874 | bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON) | 1874 | bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON) |
1875 | & 0x0001DC00; | 1875 | & 0x0001DC00; |
1876 | bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON) | 1876 | bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON) |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index 3a5c9c2b2150..cae89258a640 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -859,6 +859,11 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
859 | bcm43xx_radio_write16(bcm, 0x005D, 0x0088); | 859 | bcm43xx_radio_write16(bcm, 0x005D, 0x0088); |
860 | bcm43xx_radio_write16(bcm, 0x005E, 0x0088); | 860 | bcm43xx_radio_write16(bcm, 0x005E, 0x0088); |
861 | bcm43xx_radio_write16(bcm, 0x007D, 0x0088); | 861 | bcm43xx_radio_write16(bcm, 0x007D, 0x0088); |
862 | bcm43xx_shm_write32(bcm, BCM43xx_SHM_SHARED, | ||
863 | BCM43xx_UCODEFLAGS_OFFSET, | ||
864 | (bcm43xx_shm_read32(bcm, BCM43xx_SHM_SHARED, | ||
865 | BCM43xx_UCODEFLAGS_OFFSET) | ||
866 | | 0x00000200)); | ||
862 | } | 867 | } |
863 | if (radio->revision == 8) { | 868 | if (radio->revision == 8) { |
864 | bcm43xx_radio_write16(bcm, 0x0051, 0x0000); | 869 | bcm43xx_radio_write16(bcm, 0x0051, 0x0000); |
@@ -941,7 +946,8 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
941 | bcm43xx_phy_write(bcm, 0x0038, 0x0668); | 946 | bcm43xx_phy_write(bcm, 0x0038, 0x0668); |
942 | bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF); | 947 | bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF); |
943 | if (radio->revision <= 5) | 948 | if (radio->revision <= 5) |
944 | bcm43xx_phy_write(bcm, 0x005D, bcm43xx_phy_read(bcm, 0x005D) | 0x0003); | 949 | bcm43xx_phy_write(bcm, 0x005D, (bcm43xx_phy_read(bcm, 0x005D) |
950 | & 0xFF80) | 0x0003); | ||
945 | if (radio->revision <= 2) | 951 | if (radio->revision <= 2) |
946 | bcm43xx_radio_write16(bcm, 0x005D, 0x000D); | 952 | bcm43xx_radio_write16(bcm, 0x005D, 0x000D); |
947 | 953 | ||
@@ -958,7 +964,7 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
958 | bcm43xx_phy_write(bcm, 0x0016, 0x0410); | 964 | bcm43xx_phy_write(bcm, 0x0016, 0x0410); |
959 | bcm43xx_phy_write(bcm, 0x0017, 0x0820); | 965 | bcm43xx_phy_write(bcm, 0x0017, 0x0820); |
960 | bcm43xx_phy_write(bcm, 0x0062, 0x0007); | 966 | bcm43xx_phy_write(bcm, 0x0062, 0x0007); |
961 | (void) bcm43xx_radio_calibrationvalue(bcm); | 967 | bcm43xx_radio_init2050(bcm); |
962 | bcm43xx_phy_lo_g_measure(bcm); | 968 | bcm43xx_phy_lo_g_measure(bcm); |
963 | if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) { | 969 | if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) { |
964 | bcm43xx_calc_nrssi_slope(bcm); | 970 | bcm43xx_calc_nrssi_slope(bcm); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 7b665e2386a8..d6d9413d7f23 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c | |||
@@ -105,18 +105,24 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev, | |||
105 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 105 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
106 | unsigned long flags; | 106 | unsigned long flags; |
107 | u8 channel; | 107 | u8 channel; |
108 | s8 expon; | ||
108 | int freq; | 109 | int freq; |
109 | int err = -EINVAL; | 110 | int err = -EINVAL; |
110 | 111 | ||
111 | mutex_lock(&bcm->mutex); | 112 | mutex_lock(&bcm->mutex); |
112 | spin_lock_irqsave(&bcm->irq_lock, flags); | 113 | spin_lock_irqsave(&bcm->irq_lock, flags); |
113 | 114 | ||
114 | if ((data->freq.m >= 0) && (data->freq.m <= 1000)) { | 115 | if ((data->freq.e == 0) && |
116 | (data->freq.m >= 0) && (data->freq.m <= 1000)) { | ||
115 | channel = data->freq.m; | 117 | channel = data->freq.m; |
116 | freq = bcm43xx_channel_to_freq(bcm, channel); | 118 | freq = bcm43xx_channel_to_freq(bcm, channel); |
117 | } else { | 119 | } else { |
118 | channel = bcm43xx_freq_to_channel(bcm, data->freq.m); | ||
119 | freq = data->freq.m; | 120 | freq = data->freq.m; |
121 | expon = 6 - data->freq.e; | ||
122 | while (--expon >= 0) /* scale down the frequency to MHz */ | ||
123 | freq /= 10; | ||
124 | assert(freq > 1000); | ||
125 | channel = bcm43xx_freq_to_channel(bcm, freq); | ||
120 | } | 126 | } |
121 | if (!ieee80211_is_valid_channel(bcm->ieee, channel)) | 127 | if (!ieee80211_is_valid_channel(bcm->ieee, channel)) |
122 | goto out_unlock; | 128 | goto out_unlock; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index df495300ce3d..a32db0628157 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -757,7 +757,8 @@ int pci_enable_device(struct pci_dev *dev) | |||
757 | * when a device is enabled using managed PCI device enable interface. | 757 | * when a device is enabled using managed PCI device enable interface. |
758 | */ | 758 | */ |
759 | struct pci_devres { | 759 | struct pci_devres { |
760 | unsigned int disable:1; | 760 | unsigned int enabled:1; |
761 | unsigned int pinned:1; | ||
761 | unsigned int orig_intx:1; | 762 | unsigned int orig_intx:1; |
762 | unsigned int restore_intx:1; | 763 | unsigned int restore_intx:1; |
763 | u32 region_mask; | 764 | u32 region_mask; |
@@ -781,7 +782,7 @@ static void pcim_release(struct device *gendev, void *res) | |||
781 | if (this->restore_intx) | 782 | if (this->restore_intx) |
782 | pci_intx(dev, this->orig_intx); | 783 | pci_intx(dev, this->orig_intx); |
783 | 784 | ||
784 | if (this->disable) | 785 | if (this->enabled && !this->pinned) |
785 | pci_disable_device(dev); | 786 | pci_disable_device(dev); |
786 | } | 787 | } |
787 | 788 | ||
@@ -820,12 +821,12 @@ int pcim_enable_device(struct pci_dev *pdev) | |||
820 | dr = get_pci_dr(pdev); | 821 | dr = get_pci_dr(pdev); |
821 | if (unlikely(!dr)) | 822 | if (unlikely(!dr)) |
822 | return -ENOMEM; | 823 | return -ENOMEM; |
823 | WARN_ON(!!dr->disable); | 824 | WARN_ON(!!dr->enabled); |
824 | 825 | ||
825 | rc = pci_enable_device(pdev); | 826 | rc = pci_enable_device(pdev); |
826 | if (!rc) { | 827 | if (!rc) { |
827 | pdev->is_managed = 1; | 828 | pdev->is_managed = 1; |
828 | dr->disable = 1; | 829 | dr->enabled = 1; |
829 | } | 830 | } |
830 | return rc; | 831 | return rc; |
831 | } | 832 | } |
@@ -843,9 +844,9 @@ void pcim_pin_device(struct pci_dev *pdev) | |||
843 | struct pci_devres *dr; | 844 | struct pci_devres *dr; |
844 | 845 | ||
845 | dr = find_pci_dr(pdev); | 846 | dr = find_pci_dr(pdev); |
846 | WARN_ON(!dr || !dr->disable); | 847 | WARN_ON(!dr || !dr->enabled); |
847 | if (dr) | 848 | if (dr) |
848 | dr->disable = 0; | 849 | dr->pinned = 1; |
849 | } | 850 | } |
850 | 851 | ||
851 | /** | 852 | /** |
@@ -876,7 +877,7 @@ pci_disable_device(struct pci_dev *dev) | |||
876 | 877 | ||
877 | dr = find_pci_dr(dev); | 878 | dr = find_pci_dr(dev); |
878 | if (dr) | 879 | if (dr) |
879 | dr->disable = 0; | 880 | dr->enabled = 0; |
880 | 881 | ||
881 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) | 882 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) |
882 | return; | 883 | return; |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index b164de050d4f..db6ad8e763ac 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -66,7 +66,7 @@ static struct pci_error_handlers aer_error_handlers = { | |||
66 | .resume = aer_error_resume, | 66 | .resume = aer_error_resume, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static struct pcie_port_service_driver aerdrv = { | 69 | static struct pcie_port_service_driver aerdriver = { |
70 | .name = "aer", | 70 | .name = "aer", |
71 | .id_table = &aer_id[0], | 71 | .id_table = &aer_id[0], |
72 | 72 | ||
@@ -328,7 +328,7 @@ static void aer_error_resume(struct pci_dev *dev) | |||
328 | **/ | 328 | **/ |
329 | static int __init aer_service_init(void) | 329 | static int __init aer_service_init(void) |
330 | { | 330 | { |
331 | return pcie_port_service_register(&aerdrv); | 331 | return pcie_port_service_register(&aerdriver); |
332 | } | 332 | } |
333 | 333 | ||
334 | /** | 334 | /** |
@@ -338,7 +338,7 @@ static int __init aer_service_init(void) | |||
338 | **/ | 338 | **/ |
339 | static void __exit aer_service_exit(void) | 339 | static void __exit aer_service_exit(void) |
340 | { | 340 | { |
341 | pcie_port_service_unregister(&aerdrv); | 341 | pcie_port_service_unregister(&aerdriver); |
342 | } | 342 | } |
343 | 343 | ||
344 | module_init(aer_service_init); | 344 | module_init(aer_service_init); |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index f17e7ed2b2a5..0be5a0b30725 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -276,7 +276,7 @@ static struct pci_error_handlers pcie_portdrv_err_handler = { | |||
276 | .resume = pcie_portdrv_err_resume, | 276 | .resume = pcie_portdrv_err_resume, |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static struct pci_driver pcie_portdrv = { | 279 | static struct pci_driver pcie_portdriver = { |
280 | .name = (char *)device_name, | 280 | .name = (char *)device_name, |
281 | .id_table = &port_pci_ids[0], | 281 | .id_table = &port_pci_ids[0], |
282 | 282 | ||
@@ -298,7 +298,7 @@ static int __init pcie_portdrv_init(void) | |||
298 | printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval); | 298 | printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval); |
299 | goto out; | 299 | goto out; |
300 | } | 300 | } |
301 | retval = pci_register_driver(&pcie_portdrv); | 301 | retval = pci_register_driver(&pcie_portdriver); |
302 | if (retval) | 302 | if (retval) |
303 | pcie_port_bus_unregister(); | 303 | pcie_port_bus_unregister(); |
304 | out: | 304 | out: |
@@ -307,7 +307,7 @@ static int __init pcie_portdrv_init(void) | |||
307 | 307 | ||
308 | static void __exit pcie_portdrv_exit(void) | 308 | static void __exit pcie_portdrv_exit(void) |
309 | { | 309 | { |
310 | pci_unregister_driver(&pcie_portdrv); | 310 | pci_unregister_driver(&pcie_portdriver); |
311 | pcie_port_bus_unregister(); | 311 | pcie_port_bus_unregister(); |
312 | } | 312 | } |
313 | 313 | ||
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index ff98eaddaa73..2dd8681d6b31 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | DECLARE_RWSEM(pci_bus_sem); | 16 | DECLARE_RWSEM(pci_bus_sem); |
17 | 17 | ||
18 | static struct pci_bus * __devinit | 18 | static struct pci_bus * |
19 | pci_do_find_bus(struct pci_bus* bus, unsigned char busnr) | 19 | pci_do_find_bus(struct pci_bus* bus, unsigned char busnr) |
20 | { | 20 | { |
21 | struct pci_bus* child; | 21 | struct pci_bus* child; |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 7a535542fe92..118ac9779b3c 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -89,6 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, | |||
89 | return; | 89 | return; |
90 | 90 | ||
91 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 91 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
92 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); | ||
92 | irq = acpi_register_gsi(gsi, triggering, polarity); | 93 | irq = acpi_register_gsi(gsi, triggering, polarity); |
93 | if (irq < 0) { | 94 | if (irq < 0) { |
94 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; | 95 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; |
@@ -103,8 +104,52 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, | |||
103 | pcibios_penalize_isa_irq(irq, 1); | 104 | pcibios_penalize_isa_irq(irq, 1); |
104 | } | 105 | } |
105 | 106 | ||
107 | static int dma_flags(int type, int bus_master, int transfer) | ||
108 | { | ||
109 | int flags = 0; | ||
110 | |||
111 | if (bus_master) | ||
112 | flags |= IORESOURCE_DMA_MASTER; | ||
113 | switch (type) { | ||
114 | case ACPI_COMPATIBILITY: | ||
115 | flags |= IORESOURCE_DMA_COMPATIBLE; | ||
116 | break; | ||
117 | case ACPI_TYPE_A: | ||
118 | flags |= IORESOURCE_DMA_TYPEA; | ||
119 | break; | ||
120 | case ACPI_TYPE_B: | ||
121 | flags |= IORESOURCE_DMA_TYPEB; | ||
122 | break; | ||
123 | case ACPI_TYPE_F: | ||
124 | flags |= IORESOURCE_DMA_TYPEF; | ||
125 | break; | ||
126 | default: | ||
127 | /* Set a default value ? */ | ||
128 | flags |= IORESOURCE_DMA_COMPATIBLE; | ||
129 | pnp_err("Invalid DMA type"); | ||
130 | } | ||
131 | switch (transfer) { | ||
132 | case ACPI_TRANSFER_8: | ||
133 | flags |= IORESOURCE_DMA_8BIT; | ||
134 | break; | ||
135 | case ACPI_TRANSFER_8_16: | ||
136 | flags |= IORESOURCE_DMA_8AND16BIT; | ||
137 | break; | ||
138 | case ACPI_TRANSFER_16: | ||
139 | flags |= IORESOURCE_DMA_16BIT; | ||
140 | break; | ||
141 | default: | ||
142 | /* Set a default value ? */ | ||
143 | flags |= IORESOURCE_DMA_8AND16BIT; | ||
144 | pnp_err("Invalid DMA transfer type"); | ||
145 | } | ||
146 | |||
147 | return flags; | ||
148 | } | ||
149 | |||
106 | static void | 150 | static void |
107 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) | 151 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma, |
152 | int type, int bus_master, int transfer) | ||
108 | { | 153 | { |
109 | int i = 0; | 154 | int i = 0; |
110 | while (i < PNP_MAX_DMA && | 155 | while (i < PNP_MAX_DMA && |
@@ -112,6 +157,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) | |||
112 | i++; | 157 | i++; |
113 | if (i < PNP_MAX_DMA) { | 158 | if (i < PNP_MAX_DMA) { |
114 | res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag | 159 | res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag |
160 | res->dma_resource[i].flags |= dma_flags(type, bus_master, transfer); | ||
115 | if (dma == -1) { | 161 | if (dma == -1) { |
116 | res->dma_resource[i].flags |= IORESOURCE_DISABLED; | 162 | res->dma_resource[i].flags |= IORESOURCE_DISABLED; |
117 | return; | 163 | return; |
@@ -123,7 +169,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) | |||
123 | 169 | ||
124 | static void | 170 | static void |
125 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | 171 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, |
126 | u64 io, u64 len) | 172 | u64 io, u64 len, int io_decode) |
127 | { | 173 | { |
128 | int i = 0; | 174 | int i = 0; |
129 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && | 175 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && |
@@ -131,6 +177,8 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
131 | i++; | 177 | i++; |
132 | if (i < PNP_MAX_PORT) { | 178 | if (i < PNP_MAX_PORT) { |
133 | res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag | 179 | res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag |
180 | if (io_decode == ACPI_DECODE_16) | ||
181 | res->port_resource[i].flags |= PNP_PORT_FLAG_16BITADDR; | ||
134 | if (len <= 0 || (io + len -1) >= 0x10003) { | 182 | if (len <= 0 || (io + len -1) >= 0x10003) { |
135 | res->port_resource[i].flags |= IORESOURCE_DISABLED; | 183 | res->port_resource[i].flags |= IORESOURCE_DISABLED; |
136 | return; | 184 | return; |
@@ -142,7 +190,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
142 | 190 | ||
143 | static void | 191 | static void |
144 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | 192 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, |
145 | u64 mem, u64 len) | 193 | u64 mem, u64 len, int write_protect) |
146 | { | 194 | { |
147 | int i = 0; | 195 | int i = 0; |
148 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && | 196 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && |
@@ -154,6 +202,9 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | |||
154 | res->mem_resource[i].flags |= IORESOURCE_DISABLED; | 202 | res->mem_resource[i].flags |= IORESOURCE_DISABLED; |
155 | return; | 203 | return; |
156 | } | 204 | } |
205 | if(write_protect == ACPI_READ_WRITE_MEMORY) | ||
206 | res->mem_resource[i].flags |= IORESOURCE_MEM_WRITEABLE; | ||
207 | |||
157 | res->mem_resource[i].start = mem; | 208 | res->mem_resource[i].start = mem; |
158 | res->mem_resource[i].end = mem + len - 1; | 209 | res->mem_resource[i].end = mem + len - 1; |
159 | } | 210 | } |
@@ -178,10 +229,11 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | |||
178 | 229 | ||
179 | if (p->resource_type == ACPI_MEMORY_RANGE) | 230 | if (p->resource_type == ACPI_MEMORY_RANGE) |
180 | pnpacpi_parse_allocated_memresource(res_table, | 231 | pnpacpi_parse_allocated_memresource(res_table, |
181 | p->minimum, p->address_length); | 232 | p->minimum, p->address_length, p->info.mem.write_protect); |
182 | else if (p->resource_type == ACPI_IO_RANGE) | 233 | else if (p->resource_type == ACPI_IO_RANGE) |
183 | pnpacpi_parse_allocated_ioresource(res_table, | 234 | pnpacpi_parse_allocated_ioresource(res_table, |
184 | p->minimum, p->address_length); | 235 | p->minimum, p->address_length, |
236 | p->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16); | ||
185 | } | 237 | } |
186 | 238 | ||
187 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 239 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
@@ -208,13 +260,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
208 | case ACPI_RESOURCE_TYPE_DMA: | 260 | case ACPI_RESOURCE_TYPE_DMA: |
209 | if (res->data.dma.channel_count > 0) | 261 | if (res->data.dma.channel_count > 0) |
210 | pnpacpi_parse_allocated_dmaresource(res_table, | 262 | pnpacpi_parse_allocated_dmaresource(res_table, |
211 | res->data.dma.channels[0]); | 263 | res->data.dma.channels[0], |
264 | res->data.dma.type, | ||
265 | res->data.dma.bus_master, | ||
266 | res->data.dma.transfer); | ||
212 | break; | 267 | break; |
213 | 268 | ||
214 | case ACPI_RESOURCE_TYPE_IO: | 269 | case ACPI_RESOURCE_TYPE_IO: |
215 | pnpacpi_parse_allocated_ioresource(res_table, | 270 | pnpacpi_parse_allocated_ioresource(res_table, |
216 | res->data.io.minimum, | 271 | res->data.io.minimum, |
217 | res->data.io.address_length); | 272 | res->data.io.address_length, |
273 | res->data.io.io_decode); | ||
218 | break; | 274 | break; |
219 | 275 | ||
220 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 276 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
@@ -224,7 +280,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
224 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 280 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
225 | pnpacpi_parse_allocated_ioresource(res_table, | 281 | pnpacpi_parse_allocated_ioresource(res_table, |
226 | res->data.fixed_io.address, | 282 | res->data.fixed_io.address, |
227 | res->data.fixed_io.address_length); | 283 | res->data.fixed_io.address_length, |
284 | ACPI_DECODE_10); | ||
228 | break; | 285 | break; |
229 | 286 | ||
230 | case ACPI_RESOURCE_TYPE_VENDOR: | 287 | case ACPI_RESOURCE_TYPE_VENDOR: |
@@ -236,17 +293,20 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
236 | case ACPI_RESOURCE_TYPE_MEMORY24: | 293 | case ACPI_RESOURCE_TYPE_MEMORY24: |
237 | pnpacpi_parse_allocated_memresource(res_table, | 294 | pnpacpi_parse_allocated_memresource(res_table, |
238 | res->data.memory24.minimum, | 295 | res->data.memory24.minimum, |
239 | res->data.memory24.address_length); | 296 | res->data.memory24.address_length, |
297 | res->data.memory24.write_protect); | ||
240 | break; | 298 | break; |
241 | case ACPI_RESOURCE_TYPE_MEMORY32: | 299 | case ACPI_RESOURCE_TYPE_MEMORY32: |
242 | pnpacpi_parse_allocated_memresource(res_table, | 300 | pnpacpi_parse_allocated_memresource(res_table, |
243 | res->data.memory32.minimum, | 301 | res->data.memory32.minimum, |
244 | res->data.memory32.address_length); | 302 | res->data.memory32.address_length, |
303 | res->data.memory32.write_protect); | ||
245 | break; | 304 | break; |
246 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 305 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
247 | pnpacpi_parse_allocated_memresource(res_table, | 306 | pnpacpi_parse_allocated_memresource(res_table, |
248 | res->data.fixed_memory32.address, | 307 | res->data.fixed_memory32.address, |
249 | res->data.fixed_memory32.address_length); | 308 | res->data.fixed_memory32.address_length, |
309 | res->data.fixed_memory32.write_protect); | ||
250 | break; | 310 | break; |
251 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 311 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
252 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 312 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
@@ -304,42 +364,8 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
304 | 364 | ||
305 | for(i = 0; i < p->channel_count; i++) | 365 | for(i = 0; i < p->channel_count; i++) |
306 | dma->map |= 1 << p->channels[i]; | 366 | dma->map |= 1 << p->channels[i]; |
307 | dma->flags = 0; | 367 | |
308 | if (p->bus_master) | 368 | dma->flags = dma_flags(p->type, p->bus_master, p->transfer); |
309 | dma->flags |= IORESOURCE_DMA_MASTER; | ||
310 | switch (p->type) { | ||
311 | case ACPI_COMPATIBILITY: | ||
312 | dma->flags |= IORESOURCE_DMA_COMPATIBLE; | ||
313 | break; | ||
314 | case ACPI_TYPE_A: | ||
315 | dma->flags |= IORESOURCE_DMA_TYPEA; | ||
316 | break; | ||
317 | case ACPI_TYPE_B: | ||
318 | dma->flags |= IORESOURCE_DMA_TYPEB; | ||
319 | break; | ||
320 | case ACPI_TYPE_F: | ||
321 | dma->flags |= IORESOURCE_DMA_TYPEF; | ||
322 | break; | ||
323 | default: | ||
324 | /* Set a default value ? */ | ||
325 | dma->flags |= IORESOURCE_DMA_COMPATIBLE; | ||
326 | pnp_err("Invalid DMA type"); | ||
327 | } | ||
328 | switch (p->transfer) { | ||
329 | case ACPI_TRANSFER_8: | ||
330 | dma->flags |= IORESOURCE_DMA_8BIT; | ||
331 | break; | ||
332 | case ACPI_TRANSFER_8_16: | ||
333 | dma->flags |= IORESOURCE_DMA_8AND16BIT; | ||
334 | break; | ||
335 | case ACPI_TRANSFER_16: | ||
336 | dma->flags |= IORESOURCE_DMA_16BIT; | ||
337 | break; | ||
338 | default: | ||
339 | /* Set a default value ? */ | ||
340 | dma->flags |= IORESOURCE_DMA_8AND16BIT; | ||
341 | pnp_err("Invalid DMA transfer type"); | ||
342 | } | ||
343 | 369 | ||
344 | pnp_register_dma_resource(option, dma); | 370 | pnp_register_dma_resource(option, dma); |
345 | return; | 371 | return; |
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c index 253ceb895ca7..a27e9e92cb5e 100644 --- a/drivers/serial/sn_console.c +++ b/drivers/serial/sn_console.c | |||
@@ -636,25 +636,6 @@ static irqreturn_t sn_sal_interrupt(int irq, void *dev_id) | |||
636 | } | 636 | } |
637 | 637 | ||
638 | /** | 638 | /** |
639 | * sn_sal_connect_interrupt - Request interrupt, handled by sn_sal_interrupt | ||
640 | * @port: Our sn_cons_port (which contains the uart port) | ||
641 | * | ||
642 | * returns the console irq if interrupt is successfully registered, else 0 | ||
643 | * | ||
644 | */ | ||
645 | static int sn_sal_connect_interrupt(struct sn_cons_port *port) | ||
646 | { | ||
647 | if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt, | ||
648 | IRQF_DISABLED | IRQF_SHARED, | ||
649 | "SAL console driver", port) >= 0) { | ||
650 | return SGI_UART_VECTOR; | ||
651 | } | ||
652 | |||
653 | printk(KERN_INFO "sn_console: console proceeding in polled mode\n"); | ||
654 | return 0; | ||
655 | } | ||
656 | |||
657 | /** | ||
658 | * sn_sal_timer_poll - this function handles polled console mode | 639 | * sn_sal_timer_poll - this function handles polled console mode |
659 | * @data: A pointer to our sn_cons_port (which contains the uart port) | 640 | * @data: A pointer to our sn_cons_port (which contains the uart port) |
660 | * | 641 | * |
@@ -746,30 +727,31 @@ static void __init sn_sal_switch_to_asynch(struct sn_cons_port *port) | |||
746 | * mode. We were previously in asynch/polling mode (using init_timer). | 727 | * mode. We were previously in asynch/polling mode (using init_timer). |
747 | * | 728 | * |
748 | * We attempt to switch to interrupt mode here by calling | 729 | * We attempt to switch to interrupt mode here by calling |
749 | * sn_sal_connect_interrupt. If that works out, we enable receive interrupts. | 730 | * request_irq. If that works out, we enable receive interrupts. |
750 | */ | 731 | */ |
751 | static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port) | 732 | static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port) |
752 | { | 733 | { |
753 | int irq; | ||
754 | unsigned long flags; | 734 | unsigned long flags; |
755 | 735 | ||
756 | if (!port) | 736 | if (port) { |
757 | return; | 737 | DPRINTF("sn_console: switching to interrupt driven console\n"); |
758 | |||
759 | DPRINTF("sn_console: switching to interrupt driven console\n"); | ||
760 | |||
761 | spin_lock_irqsave(&port->sc_port.lock, flags); | ||
762 | 738 | ||
763 | irq = sn_sal_connect_interrupt(port); | 739 | if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt, |
740 | IRQF_DISABLED | IRQF_SHARED, | ||
741 | "SAL console driver", port) >= 0) { | ||
742 | spin_lock_irqsave(&port->sc_port.lock, flags); | ||
743 | port->sc_port.irq = SGI_UART_VECTOR; | ||
744 | port->sc_ops = &intr_ops; | ||
764 | 745 | ||
765 | if (irq) { | 746 | /* turn on receive interrupts */ |
766 | port->sc_port.irq = irq; | 747 | ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV); |
767 | port->sc_ops = &intr_ops; | 748 | spin_unlock_irqrestore(&port->sc_port.lock, flags); |
768 | 749 | } | |
769 | /* turn on receive interrupts */ | 750 | else { |
770 | ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV); | 751 | printk(KERN_INFO |
752 | "sn_console: console proceeding in polled mode\n"); | ||
753 | } | ||
771 | } | 754 | } |
772 | spin_unlock_irqrestore(&port->sc_port.lock, flags); | ||
773 | } | 755 | } |
774 | 756 | ||
775 | /* | 757 | /* |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index d38a25f36ea5..31ae661e586a 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -332,9 +332,9 @@ static void acm_rx_tasklet(unsigned long _acm) | |||
332 | if (!ACM_READY(acm)) | 332 | if (!ACM_READY(acm)) |
333 | return; | 333 | return; |
334 | 334 | ||
335 | spin_lock(&acm->throttle_lock); | 335 | spin_lock_irqsave(&acm->throttle_lock, flags); |
336 | throttled = acm->throttle; | 336 | throttled = acm->throttle; |
337 | spin_unlock(&acm->throttle_lock); | 337 | spin_unlock_irqrestore(&acm->throttle_lock, flags); |
338 | if (throttled) | 338 | if (throttled) |
339 | return; | 339 | return; |
340 | 340 | ||
@@ -352,9 +352,9 @@ next_buffer: | |||
352 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); | 352 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); |
353 | 353 | ||
354 | tty_buffer_request_room(tty, buf->size); | 354 | tty_buffer_request_room(tty, buf->size); |
355 | spin_lock(&acm->throttle_lock); | 355 | spin_lock_irqsave(&acm->throttle_lock, flags); |
356 | throttled = acm->throttle; | 356 | throttled = acm->throttle; |
357 | spin_unlock(&acm->throttle_lock); | 357 | spin_unlock_irqrestore(&acm->throttle_lock, flags); |
358 | if (!throttled) | 358 | if (!throttled) |
359 | tty_insert_flip_string(tty, buf->base, buf->size); | 359 | tty_insert_flip_string(tty, buf->base, buf->size); |
360 | tty_flip_buffer_push(tty); | 360 | tty_flip_buffer_push(tty); |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 274f14f1633e..36e7a843bf91 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -912,7 +912,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
912 | struct async *as; | 912 | struct async *as; |
913 | struct usb_ctrlrequest *dr = NULL; | 913 | struct usb_ctrlrequest *dr = NULL; |
914 | unsigned int u, totlen, isofrmlen; | 914 | unsigned int u, totlen, isofrmlen; |
915 | int ret, interval = 0, ifnum = -1; | 915 | int ret, ifnum = -1; |
916 | 916 | ||
917 | if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK| | 917 | if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK| |
918 | URB_NO_FSBR|URB_ZERO_PACKET)) | 918 | URB_NO_FSBR|URB_ZERO_PACKET)) |
@@ -992,7 +992,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
992 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 992 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
993 | != USB_ENDPOINT_XFER_ISOC) | 993 | != USB_ENDPOINT_XFER_ISOC) |
994 | return -EINVAL; | 994 | return -EINVAL; |
995 | interval = 1 << min (15, ep->desc.bInterval - 1); | ||
996 | isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets; | 995 | isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets; |
997 | if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) | 996 | if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) |
998 | return -ENOMEM; | 997 | return -ENOMEM; |
@@ -1021,10 +1020,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1021 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 1020 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
1022 | != USB_ENDPOINT_XFER_INT) | 1021 | != USB_ENDPOINT_XFER_INT) |
1023 | return -EINVAL; | 1022 | return -EINVAL; |
1024 | if (ps->dev->speed == USB_SPEED_HIGH) | ||
1025 | interval = 1 << min (15, ep->desc.bInterval - 1); | ||
1026 | else | ||
1027 | interval = ep->desc.bInterval; | ||
1028 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) | 1023 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) |
1029 | return -EINVAL; | 1024 | return -EINVAL; |
1030 | if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length)) | 1025 | if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length)) |
@@ -1053,7 +1048,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1053 | as->urb->setup_packet = (unsigned char*)dr; | 1048 | as->urb->setup_packet = (unsigned char*)dr; |
1054 | as->urb->start_frame = uurb->start_frame; | 1049 | as->urb->start_frame = uurb->start_frame; |
1055 | as->urb->number_of_packets = uurb->number_of_packets; | 1050 | as->urb->number_of_packets = uurb->number_of_packets; |
1056 | as->urb->interval = interval; | 1051 | if (uurb->type == USBDEVFS_URB_TYPE_ISO || |
1052 | ps->dev->speed == USB_SPEED_HIGH) | ||
1053 | as->urb->interval = 1 << min(15, ep->desc.bInterval - 1); | ||
1054 | else | ||
1055 | as->urb->interval = ep->desc.bInterval; | ||
1057 | as->urb->context = as; | 1056 | as->urb->context = as; |
1058 | as->urb->complete = async_completed; | 1057 | as->urb->complete = async_completed; |
1059 | for (totlen = u = 0; u < uurb->number_of_packets; u++) { | 1058 | for (totlen = u = 0; u < uurb->number_of_packets; u++) { |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 41400743ce2c..b89a98e61323 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1281,12 +1281,6 @@ int usb_new_device(struct usb_device *udev) | |||
1281 | { | 1281 | { |
1282 | int err; | 1282 | int err; |
1283 | 1283 | ||
1284 | /* Lock ourself into memory in order to keep a probe sequence | ||
1285 | * sleeping in a new thread from allowing us to be unloaded. | ||
1286 | */ | ||
1287 | if (!try_module_get(THIS_MODULE)) | ||
1288 | return -EINVAL; | ||
1289 | |||
1290 | /* Determine quirks */ | 1284 | /* Determine quirks */ |
1291 | usb_detect_quirks(udev); | 1285 | usb_detect_quirks(udev); |
1292 | 1286 | ||
@@ -1390,7 +1384,6 @@ int usb_new_device(struct usb_device *udev) | |||
1390 | usb_autoresume_device(udev->parent); | 1384 | usb_autoresume_device(udev->parent); |
1391 | 1385 | ||
1392 | exit: | 1386 | exit: |
1393 | module_put(THIS_MODULE); | ||
1394 | return err; | 1387 | return err; |
1395 | 1388 | ||
1396 | fail: | 1389 | fail: |
@@ -2443,7 +2436,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
2443 | 2436 | ||
2444 | if (portchange & USB_PORT_STAT_C_CONNECTION) { | 2437 | if (portchange & USB_PORT_STAT_C_CONNECTION) { |
2445 | status = hub_port_debounce(hub, port1); | 2438 | status = hub_port_debounce(hub, port1); |
2446 | if (status < 0) { | 2439 | if (status < 0 && printk_ratelimit()) { |
2447 | dev_err (hub_dev, | 2440 | dev_err (hub_dev, |
2448 | "connect-debounce failed, port %d disabled\n", | 2441 | "connect-debounce failed, port %d disabled\n", |
2449 | port1); | 2442 | port1); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 2f17468b5c1e..217a3d6d0a06 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -221,10 +221,15 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, | |||
221 | 221 | ||
222 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 222 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
223 | USB_ENDPOINT_XFER_INT) { | 223 | USB_ENDPOINT_XFER_INT) { |
224 | int interval; | ||
225 | |||
226 | if (usb_dev->speed == USB_SPEED_HIGH) | ||
227 | interval = 1 << min(15, ep->desc.bInterval - 1); | ||
228 | else | ||
229 | interval = ep->desc.bInterval; | ||
224 | pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30); | 230 | pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30); |
225 | usb_fill_int_urb(urb, usb_dev, pipe, data, len, | 231 | usb_fill_int_urb(urb, usb_dev, pipe, data, len, |
226 | usb_api_blocking_completion, NULL, | 232 | usb_api_blocking_completion, NULL, interval); |
227 | ep->desc.bInterval); | ||
228 | } else | 233 | } else |
229 | usb_fill_bulk_urb(urb, usb_dev, pipe, data, len, | 234 | usb_fill_bulk_urb(urb, usb_dev, pipe, data, len, |
230 | usb_api_blocking_completion, NULL); | 235 | usb_api_blocking_completion, NULL); |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index a4677802fb20..2a6e3163d944 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1835,7 +1835,7 @@ static int at91udc_resume(struct platform_device *pdev) | |||
1835 | #define at91udc_resume NULL | 1835 | #define at91udc_resume NULL |
1836 | #endif | 1836 | #endif |
1837 | 1837 | ||
1838 | static struct platform_driver at91_udc = { | 1838 | static struct platform_driver at91_udc_driver = { |
1839 | .remove = __exit_p(at91udc_remove), | 1839 | .remove = __exit_p(at91udc_remove), |
1840 | .shutdown = at91udc_shutdown, | 1840 | .shutdown = at91udc_shutdown, |
1841 | .suspend = at91udc_suspend, | 1841 | .suspend = at91udc_suspend, |
@@ -1848,13 +1848,13 @@ static struct platform_driver at91_udc = { | |||
1848 | 1848 | ||
1849 | static int __init udc_init_module(void) | 1849 | static int __init udc_init_module(void) |
1850 | { | 1850 | { |
1851 | return platform_driver_probe(&at91_udc, at91udc_probe); | 1851 | return platform_driver_probe(&at91_udc_driver, at91udc_probe); |
1852 | } | 1852 | } |
1853 | module_init(udc_init_module); | 1853 | module_init(udc_init_module); |
1854 | 1854 | ||
1855 | static void __exit udc_exit_module(void) | 1855 | static void __exit udc_exit_module(void) |
1856 | { | 1856 | { |
1857 | platform_driver_unregister(&at91_udc); | 1857 | platform_driver_unregister(&at91_udc_driver); |
1858 | } | 1858 | } |
1859 | module_exit(udc_exit_module); | 1859 | module_exit(udc_exit_module); |
1860 | 1860 | ||
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index 7b3a326b57ab..65c91d3735de 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -297,27 +297,6 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
297 | 297 | ||
298 | /*-------------------------------------------------------------------------*/ | 298 | /*-------------------------------------------------------------------------*/ |
299 | 299 | ||
300 | #undef USE_KMALLOC | ||
301 | |||
302 | /* many common platforms have dma-coherent caches, which means that it's | ||
303 | * safe to use kmalloc() memory for all i/o buffers without using any | ||
304 | * cache flushing calls. (unless you're trying to share cache lines | ||
305 | * between dma and non-dma activities, which is a slow idea in any case.) | ||
306 | * | ||
307 | * other platforms need more care, with 2.6 having a moderately general | ||
308 | * solution except for the common "buffer is smaller than a page" case. | ||
309 | */ | ||
310 | #if defined(CONFIG_X86) | ||
311 | #define USE_KMALLOC | ||
312 | |||
313 | #elif defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT) | ||
314 | #define USE_KMALLOC | ||
315 | |||
316 | #elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) | ||
317 | #define USE_KMALLOC | ||
318 | |||
319 | #endif | ||
320 | |||
321 | /* allocating buffers this way eliminates dma mapping overhead, which | 300 | /* allocating buffers this way eliminates dma mapping overhead, which |
322 | * on some platforms will mean eliminating a per-io buffer copy. with | 301 | * on some platforms will mean eliminating a per-io buffer copy. with |
323 | * some kinds of system caches, further tweaks may still be needed. | 302 | * some kinds of system caches, further tweaks may still be needed. |
@@ -334,11 +313,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | |||
334 | return NULL; | 313 | return NULL; |
335 | *dma = DMA_ADDR_INVALID; | 314 | *dma = DMA_ADDR_INVALID; |
336 | 315 | ||
337 | #if defined(USE_KMALLOC) | ||
338 | retval = kmalloc(bytes, gfp_flags); | ||
339 | if (retval) | ||
340 | *dma = virt_to_phys(retval); | ||
341 | #else | ||
342 | if (ep->dma) { | 316 | if (ep->dma) { |
343 | /* the main problem with this call is that it wastes memory | 317 | /* the main problem with this call is that it wastes memory |
344 | * on typical 1/N page allocations: it allocates 1-N pages. | 318 | * on typical 1/N page allocations: it allocates 1-N pages. |
@@ -348,7 +322,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | |||
348 | bytes, dma, gfp_flags); | 322 | bytes, dma, gfp_flags); |
349 | } else | 323 | } else |
350 | retval = kmalloc(bytes, gfp_flags); | 324 | retval = kmalloc(bytes, gfp_flags); |
351 | #endif | ||
352 | return retval; | 325 | return retval; |
353 | } | 326 | } |
354 | 327 | ||
@@ -356,7 +329,6 @@ static void | |||
356 | goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) | 329 | goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) |
357 | { | 330 | { |
358 | /* free memory into the right allocator */ | 331 | /* free memory into the right allocator */ |
359 | #ifndef USE_KMALLOC | ||
360 | if (dma != DMA_ADDR_INVALID) { | 332 | if (dma != DMA_ADDR_INVALID) { |
361 | struct goku_ep *ep; | 333 | struct goku_ep *ep; |
362 | 334 | ||
@@ -365,7 +337,6 @@ goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) | |||
365 | return; | 337 | return; |
366 | dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); | 338 | dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); |
367 | } else | 339 | } else |
368 | #endif | ||
369 | kfree (buf); | 340 | kfree (buf); |
370 | } | 341 | } |
371 | 342 | ||
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 9af529d22b3e..1813b7cac294 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -653,8 +653,7 @@ static int ehci_hub_control ( | |||
653 | if (status & ~0xffff) /* only if wPortChange is interesting */ | 653 | if (status & ~0xffff) /* only if wPortChange is interesting */ |
654 | #endif | 654 | #endif |
655 | dbg_port (ehci, "GetStatus", wIndex + 1, temp); | 655 | dbg_port (ehci, "GetStatus", wIndex + 1, temp); |
656 | // we "know" this alignment is good, caller used kmalloc()... | 656 | put_unaligned(cpu_to_le32 (status), (__le32 *) buf); |
657 | *((__le32 *) buf) = cpu_to_le32 (status); | ||
658 | break; | 657 | break; |
659 | case SetHubFeature: | 658 | case SetHubFeature: |
660 | switch (wValue) { | 659 | switch (wValue) { |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index bacc25c53ba3..8e4427aebb14 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -33,6 +33,9 @@ static __u8 root_hub_hub_des[] = | |||
33 | /* status change bits: nonzero writes will clear */ | 33 | /* status change bits: nonzero writes will clear */ |
34 | #define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC) | 34 | #define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC) |
35 | 35 | ||
36 | /* suspend/resume bits: port suspended or port resuming */ | ||
37 | #define SUSPEND_BITS (USBPORTSC_SUSP | USBPORTSC_RD) | ||
38 | |||
36 | /* A port that either is connected or has a changed-bit set will prevent | 39 | /* A port that either is connected or has a changed-bit set will prevent |
37 | * us from AUTO_STOPPING. | 40 | * us from AUTO_STOPPING. |
38 | */ | 41 | */ |
@@ -96,8 +99,8 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, | |||
96 | int status; | 99 | int status; |
97 | int i; | 100 | int i; |
98 | 101 | ||
99 | if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) { | 102 | if (inw(port_addr) & SUSPEND_BITS) { |
100 | CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD); | 103 | CLR_RH_PORTSTAT(SUSPEND_BITS); |
101 | if (test_bit(port, &uhci->resuming_ports)) | 104 | if (test_bit(port, &uhci->resuming_ports)) |
102 | set_bit(port, &uhci->port_c_suspend); | 105 | set_bit(port, &uhci->port_c_suspend); |
103 | 106 | ||
@@ -107,7 +110,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, | |||
107 | * Experiments show that some controllers take longer, so | 110 | * Experiments show that some controllers take longer, so |
108 | * we'll poll for completion. */ | 111 | * we'll poll for completion. */ |
109 | for (i = 0; i < 10; ++i) { | 112 | for (i = 0; i < 10; ++i) { |
110 | if (!(inw(port_addr) & USBPORTSC_RD)) | 113 | if (!(inw(port_addr) & SUSPEND_BITS)) |
111 | break; | 114 | break; |
112 | udelay(1); | 115 | udelay(1); |
113 | } | 116 | } |
@@ -289,7 +292,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
289 | wPortStatus |= USB_PORT_STAT_CONNECTION; | 292 | wPortStatus |= USB_PORT_STAT_CONNECTION; |
290 | if (status & USBPORTSC_PE) { | 293 | if (status & USBPORTSC_PE) { |
291 | wPortStatus |= USB_PORT_STAT_ENABLE; | 294 | wPortStatus |= USB_PORT_STAT_ENABLE; |
292 | if (status & (USBPORTSC_SUSP | USBPORTSC_RD)) | 295 | if (status & SUSPEND_BITS) |
293 | wPortStatus |= USB_PORT_STAT_SUSPEND; | 296 | wPortStatus |= USB_PORT_STAT_SUSPEND; |
294 | } | 297 | } |
295 | if (status & USBPORTSC_OC) | 298 | if (status & USBPORTSC_OC) |
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 0c1d66ddb812..bc3327e3dd78 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -2905,17 +2905,31 @@ static int __init ftdi_elan_init(void) | |||
2905 | { | 2905 | { |
2906 | int result; | 2906 | int result; |
2907 | printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, | 2907 | printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, |
2908 | __TIME__, __DATE__); | 2908 | __TIME__, __DATE__); |
2909 | init_MUTEX(&ftdi_module_lock); | 2909 | init_MUTEX(&ftdi_module_lock); |
2910 | INIT_LIST_HEAD(&ftdi_static_list); | 2910 | INIT_LIST_HEAD(&ftdi_static_list); |
2911 | status_queue = create_singlethread_workqueue("ftdi-status-control"); | 2911 | status_queue = create_singlethread_workqueue("ftdi-status-control"); |
2912 | if (!status_queue) | ||
2913 | goto err1; | ||
2912 | command_queue = create_singlethread_workqueue("ftdi-command-engine"); | 2914 | command_queue = create_singlethread_workqueue("ftdi-command-engine"); |
2915 | if (!command_queue) | ||
2916 | goto err2; | ||
2913 | respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); | 2917 | respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); |
2918 | if (!respond_queue) | ||
2919 | goto err3; | ||
2914 | result = usb_register(&ftdi_elan_driver); | 2920 | result = usb_register(&ftdi_elan_driver); |
2915 | if (result) | 2921 | if (result) |
2916 | printk(KERN_ERR "usb_register failed. Error number %d\n", | 2922 | printk(KERN_ERR "usb_register failed. Error number %d\n", |
2917 | result); | 2923 | result); |
2918 | return result; | 2924 | return result; |
2925 | |||
2926 | err3: | ||
2927 | destroy_workqueue(command_queue); | ||
2928 | err2: | ||
2929 | destroy_workqueue(status_queue); | ||
2930 | err1: | ||
2931 | printk(KERN_ERR "%s couldn't create workqueue\n", ftdi_elan_driver.name); | ||
2932 | return -ENOMEM; | ||
2919 | } | 2933 | } |
2920 | 2934 | ||
2921 | static void __exit ftdi_elan_exit(void) | 2935 | static void __exit ftdi_elan_exit(void) |
diff --git a/drivers/usb/net/dm9601.c b/drivers/usb/net/dm9601.c index 4a932e1cd93b..c0bc52be5e10 100644 --- a/drivers/usb/net/dm9601.c +++ b/drivers/usb/net/dm9601.c | |||
@@ -571,6 +571,10 @@ static const struct driver_info dm9601_info = { | |||
571 | 571 | ||
572 | static const struct usb_device_id products[] = { | 572 | static const struct usb_device_id products[] = { |
573 | { | 573 | { |
574 | USB_DEVICE(0x07aa, 0x9601), /* Corega FEther USB-TXC */ | ||
575 | .driver_info = (unsigned long)&dm9601_info, | ||
576 | }, | ||
577 | { | ||
574 | USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */ | 578 | USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */ |
575 | .driver_info = (unsigned long)&dm9601_info, | 579 | .driver_info = (unsigned long)&dm9601_info, |
576 | }, | 580 | }, |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index 18816bf96a4d..310a8b5f5906 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -44,8 +44,43 @@ struct airprime_private { | |||
44 | int outstanding_urbs; | 44 | int outstanding_urbs; |
45 | int throttled; | 45 | int throttled; |
46 | struct urb *read_urbp[NUM_READ_URBS]; | 46 | struct urb *read_urbp[NUM_READ_URBS]; |
47 | |||
48 | /* Settings for the port */ | ||
49 | int rts_state; /* Handshaking pins (outputs) */ | ||
50 | int dtr_state; | ||
51 | int cts_state; /* Handshaking pins (inputs) */ | ||
52 | int dsr_state; | ||
53 | int dcd_state; | ||
54 | int ri_state; | ||
47 | }; | 55 | }; |
48 | 56 | ||
57 | static int airprime_send_setup(struct usb_serial_port *port) | ||
58 | { | ||
59 | struct usb_serial *serial = port->serial; | ||
60 | struct airprime_private *priv; | ||
61 | |||
62 | dbg("%s", __FUNCTION__); | ||
63 | |||
64 | if (port->number != 0) | ||
65 | return 0; | ||
66 | |||
67 | priv = usb_get_serial_port_data(port); | ||
68 | |||
69 | if (port->tty) { | ||
70 | int val = 0; | ||
71 | if (priv->dtr_state) | ||
72 | val |= 0x01; | ||
73 | if (priv->rts_state) | ||
74 | val |= 0x02; | ||
75 | |||
76 | return usb_control_msg(serial->dev, | ||
77 | usb_rcvctrlpipe(serial->dev, 0), | ||
78 | 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT); | ||
79 | } | ||
80 | |||
81 | return 0; | ||
82 | } | ||
83 | |||
49 | static void airprime_read_bulk_callback(struct urb *urb) | 84 | static void airprime_read_bulk_callback(struct urb *urb) |
50 | { | 85 | { |
51 | struct usb_serial_port *port = urb->context; | 86 | struct usb_serial_port *port = urb->context; |
@@ -118,6 +153,10 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) | |||
118 | usb_set_serial_port_data(port, priv); | 153 | usb_set_serial_port_data(port, priv); |
119 | } | 154 | } |
120 | 155 | ||
156 | /* Set some sane defaults */ | ||
157 | priv->rts_state = 1; | ||
158 | priv->dtr_state = 1; | ||
159 | |||
121 | for (i = 0; i < NUM_READ_URBS; ++i) { | 160 | for (i = 0; i < NUM_READ_URBS; ++i) { |
122 | buffer = kmalloc(buffer_size, GFP_KERNEL); | 161 | buffer = kmalloc(buffer_size, GFP_KERNEL); |
123 | if (!buffer) { | 162 | if (!buffer) { |
@@ -151,6 +190,9 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) | |||
151 | /* remember this urb so we can kill it when the port is closed */ | 190 | /* remember this urb so we can kill it when the port is closed */ |
152 | priv->read_urbp[i] = urb; | 191 | priv->read_urbp[i] = urb; |
153 | } | 192 | } |
193 | |||
194 | airprime_send_setup(port); | ||
195 | |||
154 | goto out; | 196 | goto out; |
155 | 197 | ||
156 | errout: | 198 | errout: |
@@ -176,6 +218,11 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp) | |||
176 | 218 | ||
177 | dbg("%s - port %d", __FUNCTION__, port->number); | 219 | dbg("%s - port %d", __FUNCTION__, port->number); |
178 | 220 | ||
221 | priv->rts_state = 0; | ||
222 | priv->dtr_state = 0; | ||
223 | |||
224 | airprime_send_setup(port); | ||
225 | |||
179 | for (i = 0; i < NUM_READ_URBS; ++i) { | 226 | for (i = 0; i < NUM_READ_URBS; ++i) { |
180 | usb_kill_urb (priv->read_urbp[i]); | 227 | usb_kill_urb (priv->read_urbp[i]); |
181 | kfree (priv->read_urbp[i]->transfer_buffer); | 228 | kfree (priv->read_urbp[i]->transfer_buffer); |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index db623e754899..d7d0ba986a80 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -63,6 +63,8 @@ static struct usb_device_id id_table [] = { | |||
63 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ | 63 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ |
64 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ | 64 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ |
65 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ | 65 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ |
66 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | ||
67 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | ||
66 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ | 68 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ |
67 | { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ | 69 | { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ |
68 | { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ | 70 | { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index c525b42dadde..1633a0fd48e8 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -315,6 +315,7 @@ static struct usb_device_id id_table_combined [] = { | |||
315 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, | 315 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, |
316 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, | 316 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, |
317 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, | 317 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, |
318 | { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) }, | ||
318 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, | 319 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, |
319 | { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, | 320 | { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, |
320 | { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, | 321 | { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, |
@@ -420,6 +421,14 @@ static struct usb_device_id id_table_combined [] = { | |||
420 | { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) }, | 421 | { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) }, |
421 | { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) }, | 422 | { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) }, |
422 | { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) }, | 423 | { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) }, |
424 | { USB_DEVICE(FTDI_VID, FTDI_IBS_US485_PID) }, | ||
425 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PICPRO_PID) }, | ||
426 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PCMCIA_PID) }, | ||
427 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PK1_PID) }, | ||
428 | { USB_DEVICE(FTDI_VID, FTDI_IBS_RS232MON_PID) }, | ||
429 | { USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) }, | ||
430 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) }, | ||
431 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) }, | ||
423 | /* | 432 | /* |
424 | * These will probably use user-space drivers. Uncomment them if | 433 | * These will probably use user-space drivers. Uncomment them if |
425 | * you need them or use the user-specified vendor/product module | 434 | * you need them or use the user-specified vendor/product module |
@@ -459,6 +468,7 @@ static struct usb_device_id id_table_combined [] = { | |||
459 | { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, | 468 | { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, |
460 | { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, | 469 | { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, |
461 | { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, | 470 | { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, |
471 | { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, | ||
462 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, | 472 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, |
463 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, | 473 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, |
464 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, | 474 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, |
@@ -533,6 +543,7 @@ static const char *ftdi_chip_name[] = { | |||
533 | [FT8U232AM] = "FT8U232AM", | 543 | [FT8U232AM] = "FT8U232AM", |
534 | [FT232BM] = "FT232BM", | 544 | [FT232BM] = "FT232BM", |
535 | [FT2232C] = "FT2232C", | 545 | [FT2232C] = "FT2232C", |
546 | [FT232RL] = "FT232RL", | ||
536 | }; | 547 | }; |
537 | 548 | ||
538 | 549 | ||
@@ -588,6 +599,8 @@ struct ftdi_private { | |||
588 | static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); | 599 | static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); |
589 | static int ftdi_sio_attach (struct usb_serial *serial); | 600 | static int ftdi_sio_attach (struct usb_serial *serial); |
590 | static void ftdi_shutdown (struct usb_serial *serial); | 601 | static void ftdi_shutdown (struct usb_serial *serial); |
602 | static int ftdi_sio_port_probe (struct usb_serial_port *port); | ||
603 | static int ftdi_sio_port_remove (struct usb_serial_port *port); | ||
591 | static int ftdi_open (struct usb_serial_port *port, struct file *filp); | 604 | static int ftdi_open (struct usb_serial_port *port, struct file *filp); |
592 | static void ftdi_close (struct usb_serial_port *port, struct file *filp); | 605 | static void ftdi_close (struct usb_serial_port *port, struct file *filp); |
593 | static int ftdi_write (struct usb_serial_port *port, const unsigned char *buf, int count); | 606 | static int ftdi_write (struct usb_serial_port *port, const unsigned char *buf, int count); |
@@ -622,6 +635,8 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
622 | .num_bulk_out = 1, | 635 | .num_bulk_out = 1, |
623 | .num_ports = 1, | 636 | .num_ports = 1, |
624 | .probe = ftdi_sio_probe, | 637 | .probe = ftdi_sio_probe, |
638 | .port_probe = ftdi_sio_port_probe, | ||
639 | .port_remove = ftdi_sio_port_remove, | ||
625 | .open = ftdi_open, | 640 | .open = ftdi_open, |
626 | .close = ftdi_close, | 641 | .close = ftdi_close, |
627 | .throttle = ftdi_throttle, | 642 | .throttle = ftdi_throttle, |
@@ -1024,11 +1039,10 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a | |||
1024 | { | 1039 | { |
1025 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1040 | struct usb_serial_port *port = to_usb_serial_port(dev); |
1026 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1041 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1027 | struct usb_device *udev; | 1042 | struct usb_device *udev = port->serial->dev; |
1028 | unsigned short latency = 0; | 1043 | unsigned short latency = 0; |
1029 | int rv = 0; | 1044 | int rv = 0; |
1030 | 1045 | ||
1031 | udev = to_usb_device(dev); | ||
1032 | 1046 | ||
1033 | dbg("%s",__FUNCTION__); | 1047 | dbg("%s",__FUNCTION__); |
1034 | 1048 | ||
@@ -1052,13 +1066,11 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute * | |||
1052 | { | 1066 | { |
1053 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1067 | struct usb_serial_port *port = to_usb_serial_port(dev); |
1054 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1068 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1055 | struct usb_device *udev; | 1069 | struct usb_device *udev = port->serial->dev; |
1056 | char buf[1]; | 1070 | char buf[1]; |
1057 | int v = simple_strtoul(valbuf, NULL, 10); | 1071 | int v = simple_strtoul(valbuf, NULL, 10); |
1058 | int rv = 0; | 1072 | int rv = 0; |
1059 | 1073 | ||
1060 | udev = to_usb_device(dev); | ||
1061 | |||
1062 | dbg("%s: setting latency timer = %i", __FUNCTION__, v); | 1074 | dbg("%s: setting latency timer = %i", __FUNCTION__, v); |
1063 | 1075 | ||
1064 | rv = usb_control_msg(udev, | 1076 | rv = usb_control_msg(udev, |
@@ -1083,13 +1095,11 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att | |||
1083 | { | 1095 | { |
1084 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1096 | struct usb_serial_port *port = to_usb_serial_port(dev); |
1085 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1097 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1086 | struct usb_device *udev; | 1098 | struct usb_device *udev = port->serial->dev; |
1087 | char buf[1]; | 1099 | char buf[1]; |
1088 | int v = simple_strtoul(valbuf, NULL, 10); | 1100 | int v = simple_strtoul(valbuf, NULL, 10); |
1089 | int rv = 0; | 1101 | int rv = 0; |
1090 | 1102 | ||
1091 | udev = to_usb_device(dev); | ||
1092 | |||
1093 | dbg("%s: setting event char = %i", __FUNCTION__, v); | 1103 | dbg("%s: setting event char = %i", __FUNCTION__, v); |
1094 | 1104 | ||
1095 | rv = usb_control_msg(udev, | 1105 | rv = usb_control_msg(udev, |
@@ -1110,46 +1120,38 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att | |||
1110 | static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer); | 1120 | static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer); |
1111 | static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); | 1121 | static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); |
1112 | 1122 | ||
1113 | static int create_sysfs_attrs(struct usb_serial *serial) | 1123 | static int create_sysfs_attrs(struct usb_serial_port *port) |
1114 | { | 1124 | { |
1115 | struct ftdi_private *priv; | 1125 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1116 | struct usb_device *udev; | ||
1117 | int retval = 0; | 1126 | int retval = 0; |
1118 | 1127 | ||
1119 | dbg("%s",__FUNCTION__); | 1128 | dbg("%s",__FUNCTION__); |
1120 | 1129 | ||
1121 | priv = usb_get_serial_port_data(serial->port[0]); | ||
1122 | udev = serial->dev; | ||
1123 | |||
1124 | /* XXX I've no idea if the original SIO supports the event_char | 1130 | /* XXX I've no idea if the original SIO supports the event_char |
1125 | * sysfs parameter, so I'm playing it safe. */ | 1131 | * sysfs parameter, so I'm playing it safe. */ |
1126 | if (priv->chip_type != SIO) { | 1132 | if (priv->chip_type != SIO) { |
1127 | dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]); | 1133 | dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]); |
1128 | retval = device_create_file(&udev->dev, &dev_attr_event_char); | 1134 | retval = device_create_file(&port->dev, &dev_attr_event_char); |
1129 | if ((!retval) && | 1135 | if ((!retval) && |
1130 | (priv->chip_type == FT232BM || priv->chip_type == FT2232C)) { | 1136 | (priv->chip_type == FT232BM || priv->chip_type == FT2232C)) { |
1131 | retval = device_create_file(&udev->dev, | 1137 | retval = device_create_file(&port->dev, |
1132 | &dev_attr_latency_timer); | 1138 | &dev_attr_latency_timer); |
1133 | } | 1139 | } |
1134 | } | 1140 | } |
1135 | return retval; | 1141 | return retval; |
1136 | } | 1142 | } |
1137 | 1143 | ||
1138 | static void remove_sysfs_attrs(struct usb_serial *serial) | 1144 | static void remove_sysfs_attrs(struct usb_serial_port *port) |
1139 | { | 1145 | { |
1140 | struct ftdi_private *priv; | 1146 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1141 | struct usb_device *udev; | ||
1142 | 1147 | ||
1143 | dbg("%s",__FUNCTION__); | 1148 | dbg("%s",__FUNCTION__); |
1144 | 1149 | ||
1145 | priv = usb_get_serial_port_data(serial->port[0]); | ||
1146 | udev = serial->dev; | ||
1147 | |||
1148 | /* XXX see create_sysfs_attrs */ | 1150 | /* XXX see create_sysfs_attrs */ |
1149 | if (priv->chip_type != SIO) { | 1151 | if (priv->chip_type != SIO) { |
1150 | device_remove_file(&udev->dev, &dev_attr_event_char); | 1152 | device_remove_file(&port->dev, &dev_attr_event_char); |
1151 | if (priv->chip_type == FT232BM || priv->chip_type == FT2232C) { | 1153 | if (priv->chip_type == FT232BM || priv->chip_type == FT2232C) { |
1152 | device_remove_file(&udev->dev, &dev_attr_latency_timer); | 1154 | device_remove_file(&port->dev, &dev_attr_latency_timer); |
1153 | } | 1155 | } |
1154 | } | 1156 | } |
1155 | 1157 | ||
@@ -1169,13 +1171,9 @@ static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id | |||
1169 | return (0); | 1171 | return (0); |
1170 | } | 1172 | } |
1171 | 1173 | ||
1172 | /* attach subroutine */ | 1174 | static int ftdi_sio_port_probe(struct usb_serial_port *port) |
1173 | static int ftdi_sio_attach (struct usb_serial *serial) | ||
1174 | { | 1175 | { |
1175 | struct usb_serial_port *port = serial->port[0]; | ||
1176 | struct ftdi_private *priv; | 1176 | struct ftdi_private *priv; |
1177 | struct ftdi_sio_quirk *quirk; | ||
1178 | int retval; | ||
1179 | 1177 | ||
1180 | dbg("%s",__FUNCTION__); | 1178 | dbg("%s",__FUNCTION__); |
1181 | 1179 | ||
@@ -1215,19 +1213,21 @@ static int ftdi_sio_attach (struct usb_serial *serial) | |||
1215 | kfree(port->bulk_out_buffer); | 1213 | kfree(port->bulk_out_buffer); |
1216 | port->bulk_out_buffer = NULL; | 1214 | port->bulk_out_buffer = NULL; |
1217 | 1215 | ||
1218 | usb_set_serial_port_data(serial->port[0], priv); | 1216 | usb_set_serial_port_data(port, priv); |
1219 | 1217 | ||
1220 | ftdi_determine_type (serial->port[0]); | 1218 | ftdi_determine_type (port); |
1221 | retval = create_sysfs_attrs(serial); | 1219 | create_sysfs_attrs(port); |
1222 | if (retval) | 1220 | return 0; |
1223 | dev_err(&serial->dev->dev, "Error creating sysfs files, " | 1221 | } |
1224 | "continuing\n"); | ||
1225 | 1222 | ||
1223 | /* attach subroutine */ | ||
1224 | static int ftdi_sio_attach (struct usb_serial *serial) | ||
1225 | { | ||
1226 | /* Check for device requiring special set up. */ | 1226 | /* Check for device requiring special set up. */ |
1227 | quirk = (struct ftdi_sio_quirk *)usb_get_serial_data(serial); | 1227 | struct ftdi_sio_quirk *quirk = usb_get_serial_data(serial); |
1228 | if (quirk && quirk->setup) { | 1228 | |
1229 | if (quirk && quirk->setup) | ||
1229 | quirk->setup(serial); | 1230 | quirk->setup(serial); |
1230 | } | ||
1231 | 1231 | ||
1232 | return 0; | 1232 | return 0; |
1233 | } /* ftdi_sio_attach */ | 1233 | } /* ftdi_sio_attach */ |
@@ -1271,17 +1271,18 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial) | |||
1271 | * calls __serial_close for each open of the port | 1271 | * calls __serial_close for each open of the port |
1272 | * shutdown is called then (ie ftdi_shutdown) | 1272 | * shutdown is called then (ie ftdi_shutdown) |
1273 | */ | 1273 | */ |
1274 | |||
1275 | |||
1276 | static void ftdi_shutdown (struct usb_serial *serial) | 1274 | static void ftdi_shutdown (struct usb_serial *serial) |
1277 | { /* ftdi_shutdown */ | 1275 | { |
1276 | dbg("%s", __FUNCTION__); | ||
1277 | } | ||
1278 | 1278 | ||
1279 | struct usb_serial_port *port = serial->port[0]; | 1279 | static int ftdi_sio_port_remove(struct usb_serial_port *port) |
1280 | { | ||
1280 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1281 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1281 | 1282 | ||
1282 | dbg("%s", __FUNCTION__); | 1283 | dbg("%s", __FUNCTION__); |
1283 | 1284 | ||
1284 | remove_sysfs_attrs(serial); | 1285 | remove_sysfs_attrs(port); |
1285 | 1286 | ||
1286 | /* all open ports are closed at this point | 1287 | /* all open ports are closed at this point |
1287 | * (by usbserial.c:__serial_close, which calls ftdi_close) | 1288 | * (by usbserial.c:__serial_close, which calls ftdi_close) |
@@ -1291,8 +1292,9 @@ static void ftdi_shutdown (struct usb_serial *serial) | |||
1291 | usb_set_serial_port_data(port, NULL); | 1292 | usb_set_serial_port_data(port, NULL); |
1292 | kfree(priv); | 1293 | kfree(priv); |
1293 | } | 1294 | } |
1294 | } /* ftdi_shutdown */ | ||
1295 | 1295 | ||
1296 | return 0; | ||
1297 | } | ||
1296 | 1298 | ||
1297 | static int ftdi_open (struct usb_serial_port *port, struct file *filp) | 1299 | static int ftdi_open (struct usb_serial_port *port, struct file *filp) |
1298 | { /* ftdi_open */ | 1300 | { /* ftdi_open */ |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 1bdda935f7d9..513cfe1b768b 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */ | 27 | #define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */ |
28 | #define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */ | 28 | #define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */ |
29 | #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ | 29 | #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ |
30 | #define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */ | ||
30 | #define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */ | 31 | #define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */ |
31 | #define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ | 32 | #define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ |
32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ | 33 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ |
@@ -339,6 +340,12 @@ | |||
339 | #define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */ | 340 | #define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */ |
340 | 341 | ||
341 | /* | 342 | /* |
343 | * TTi (Thurlby Thandar Instruments) | ||
344 | */ | ||
345 | #define TTI_VID 0x103E /* Vendor Id */ | ||
346 | #define TTI_QL355P_PID 0x03E8 /* TTi QL355P power supply */ | ||
347 | |||
348 | /* | ||
342 | * Definitions for B&B Electronics products. | 349 | * Definitions for B&B Electronics products. |
343 | */ | 350 | */ |
344 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ | 351 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ |
@@ -497,6 +504,19 @@ | |||
497 | #define TELLDUS_VID 0x1781 /* Vendor ID */ | 504 | #define TELLDUS_VID 0x1781 /* Vendor ID */ |
498 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ | 505 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ |
499 | 506 | ||
507 | /* | ||
508 | * IBS elektronik product ids | ||
509 | * Submitted by Thomas Schleusener | ||
510 | */ | ||
511 | #define FTDI_IBS_US485_PID 0xff38 /* IBS US485 (USB<-->RS422/485 interface) */ | ||
512 | #define FTDI_IBS_PICPRO_PID 0xff39 /* IBS PIC-Programmer */ | ||
513 | #define FTDI_IBS_PCMCIA_PID 0xff3a /* IBS Card reader for PCMCIA SRAM-cards */ | ||
514 | #define FTDI_IBS_PK1_PID 0xff3b /* IBS PK1 - Particel counter */ | ||
515 | #define FTDI_IBS_RS232MON_PID 0xff3c /* IBS RS232 - Monitor */ | ||
516 | #define FTDI_IBS_APP70_PID 0xff3d /* APP 70 (dust monitoring system) */ | ||
517 | #define FTDI_IBS_PEDO_PID 0xff3e /* IBS PEDO-Modem (RF modem 868.35 MHz) */ | ||
518 | #define FTDI_IBS_PROD_PID 0xff3f /* future device */ | ||
519 | |||
500 | /* Commands */ | 520 | /* Commands */ |
501 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 521 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
502 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 522 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
@@ -620,6 +640,7 @@ typedef enum { | |||
620 | FT8U232AM = 2, | 640 | FT8U232AM = 2, |
621 | FT232BM = 3, | 641 | FT232BM = 3, |
622 | FT2232C = 4, | 642 | FT2232C = 4, |
643 | FT232RL = 5, | ||
623 | } ftdi_chip_type_t; | 644 | } ftdi_chip_type_t; |
624 | 645 | ||
625 | typedef enum { | 646 | typedef enum { |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index a408184334ea..d16e2e1764ad 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -247,6 +247,8 @@ static struct usb_device_id ipaq_id_table [] = { | |||
247 | { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */ | 247 | { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */ |
248 | { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */ | 248 | { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */ |
249 | { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */ | 249 | { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */ |
250 | { USB_DEVICE(0x04AD, 0x0306) }, /* GPS Pocket PC USB Sync */ | ||
251 | { USB_DEVICE(0x04B7, 0x0531) }, /* MyGuide 7000 XL USB Sync */ | ||
250 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ | 252 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ |
251 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ | 253 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ |
252 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ | 254 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6bf22a28adb8..8511352251f3 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -99,9 +99,12 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po | |||
99 | continue; | 99 | continue; |
100 | 100 | ||
101 | *minor = i; | 101 | *minor = i; |
102 | j = 0; | ||
102 | dbg("%s - minor base = %d", __FUNCTION__, *minor); | 103 | dbg("%s - minor base = %d", __FUNCTION__, *minor); |
103 | for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) | 104 | for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) { |
104 | serial_table[i] = serial; | 105 | serial_table[i] = serial; |
106 | serial->port[j++]->number = i; | ||
107 | } | ||
105 | spin_unlock(&table_lock); | 108 | spin_unlock(&table_lock); |
106 | return serial; | 109 | return serial; |
107 | } | 110 | } |
@@ -135,11 +138,6 @@ static void destroy_serial(struct kref *kref) | |||
135 | 138 | ||
136 | dbg("%s - %s", __FUNCTION__, serial->type->description); | 139 | dbg("%s - %s", __FUNCTION__, serial->type->description); |
137 | 140 | ||
138 | serial->type->shutdown(serial); | ||
139 | |||
140 | /* return the minor range that this device had */ | ||
141 | return_serial(serial); | ||
142 | |||
143 | for (i = 0; i < serial->num_ports; ++i) | 141 | for (i = 0; i < serial->num_ports; ++i) |
144 | serial->port[i]->open_count = 0; | 142 | serial->port[i]->open_count = 0; |
145 | 143 | ||
@@ -150,6 +148,12 @@ static void destroy_serial(struct kref *kref) | |||
150 | serial->port[i] = NULL; | 148 | serial->port[i] = NULL; |
151 | } | 149 | } |
152 | 150 | ||
151 | if (serial->type->shutdown) | ||
152 | serial->type->shutdown(serial); | ||
153 | |||
154 | /* return the minor range that this device had */ | ||
155 | return_serial(serial); | ||
156 | |||
153 | /* If this is a "fake" port, we have to clean it up here, as it will | 157 | /* If this is a "fake" port, we have to clean it up here, as it will |
154 | * not get cleaned up in port_release() as it was never registered with | 158 | * not get cleaned up in port_release() as it was never registered with |
155 | * the driver core */ | 159 | * the driver core */ |
@@ -826,7 +830,6 @@ int usb_serial_probe(struct usb_interface *interface, | |||
826 | num_ports = type->num_ports; | 830 | num_ports = type->num_ports; |
827 | } | 831 | } |
828 | 832 | ||
829 | serial->minor = minor; | ||
830 | serial->num_ports = num_ports; | 833 | serial->num_ports = num_ports; |
831 | serial->num_bulk_in = num_bulk_in; | 834 | serial->num_bulk_in = num_bulk_in; |
832 | serial->num_bulk_out = num_bulk_out; | 835 | serial->num_bulk_out = num_bulk_out; |
@@ -847,7 +850,6 @@ int usb_serial_probe(struct usb_interface *interface, | |||
847 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); | 850 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); |
848 | if (!port) | 851 | if (!port) |
849 | goto probe_error; | 852 | goto probe_error; |
850 | port->number = i + serial->minor; | ||
851 | port->serial = serial; | 853 | port->serial = serial; |
852 | spin_lock_init(&port->lock); | 854 | spin_lock_init(&port->lock); |
853 | mutex_init(&port->mutex); | 855 | mutex_init(&port->mutex); |
@@ -980,6 +982,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
980 | dev_err(&interface->dev, "No more free serial devices\n"); | 982 | dev_err(&interface->dev, "No more free serial devices\n"); |
981 | goto probe_error; | 983 | goto probe_error; |
982 | } | 984 | } |
985 | serial->minor = minor; | ||
983 | 986 | ||
984 | /* register all of the individual ports with the driver core */ | 987 | /* register all of the individual ports with the driver core */ |
985 | for (i = 0; i < num_ports; ++i) { | 988 | for (i = 0; i < num_ports; ++i) { |
@@ -1034,9 +1037,6 @@ probe_error: | |||
1034 | kfree(port->interrupt_out_buffer); | 1037 | kfree(port->interrupt_out_buffer); |
1035 | } | 1038 | } |
1036 | 1039 | ||
1037 | /* return the minor range that this device had */ | ||
1038 | return_serial (serial); | ||
1039 | |||
1040 | /* free up any memory that we allocated */ | 1040 | /* free up any memory that we allocated */ |
1041 | for (i = 0; i < serial->num_port_pointers; ++i) | 1041 | for (i = 0; i < serial->num_port_pointers; ++i) |
1042 | kfree(serial->port[i]); | 1042 | kfree(serial->port[i]); |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 9644a8ea4aa7..2dd31e3f5107 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -146,6 +146,13 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100, | |||
146 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 146 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
147 | US_FL_IGNORE_RESIDUE ), | 147 | US_FL_IGNORE_RESIDUE ), |
148 | 148 | ||
149 | /* Reported by Andrew Nayenko <relan@bk.ru> */ | ||
150 | UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592, | ||
151 | "Nokia", | ||
152 | "Nokia 6288", | ||
153 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
154 | US_FL_MAX_SECTORS_64 ), | ||
155 | |||
149 | /* Reported by Mario Rettig <mariorettig@web.de> */ | 156 | /* Reported by Mario Rettig <mariorettig@web.de> */ |
150 | UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, | 157 | UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, |
151 | "Nokia", | 158 | "Nokia", |
@@ -1395,16 +1402,6 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, | |||
1395 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1402 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1396 | US_FL_IGNORE_RESIDUE ), | 1403 | US_FL_IGNORE_RESIDUE ), |
1397 | 1404 | ||
1398 | /* Reported by Thomas Baechler <thomas@archlinux.org> | ||
1399 | * Fixes I/O errors with Teac HD-35PU devices | ||
1400 | */ | ||
1401 | |||
1402 | UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, | ||
1403 | "Super Top", | ||
1404 | "USB 2.0 IDE DEVICE", | ||
1405 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1406 | US_FL_IGNORE_RESIDUE), | ||
1407 | |||
1408 | /* patch submitted by Davide Perini <perini.davide@dpsoftware.org> | 1405 | /* patch submitted by Davide Perini <perini.davide@dpsoftware.org> |
1409 | * and Renato Perini <rperini@email.it> | 1406 | * and Renato Perini <rperini@email.it> |
1410 | */ | 1407 | */ |