diff options
Diffstat (limited to 'drivers')
38 files changed, 549 insertions, 340 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 97991ac6f5fc..7e52295f1ecc 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -208,7 +208,7 @@ static int power_saving_thread(void *data) | |||
208 | * the mechanism only works when all CPUs have RT task running, | 208 | * the mechanism only works when all CPUs have RT task running, |
209 | * as if one CPU hasn't RT task, RT task from other CPUs will | 209 | * as if one CPU hasn't RT task, RT task from other CPUs will |
210 | * borrow CPU time from this CPU and cause RT task use > 95% | 210 | * borrow CPU time from this CPU and cause RT task use > 95% |
211 | * CPU time. To make 'avoid staration' work, takes a nap here. | 211 | * CPU time. To make 'avoid starvation' work, takes a nap here. |
212 | */ | 212 | */ |
213 | if (do_sleep) | 213 | if (do_sleep) |
214 | schedule_timeout_killable(HZ * idle_pct / 100); | 214 | schedule_timeout_killable(HZ * idle_pct / 100); |
@@ -222,14 +222,18 @@ static struct task_struct *ps_tsks[NR_CPUS]; | |||
222 | static unsigned int ps_tsk_num; | 222 | static unsigned int ps_tsk_num; |
223 | static int create_power_saving_task(void) | 223 | static int create_power_saving_task(void) |
224 | { | 224 | { |
225 | int rc = -ENOMEM; | ||
226 | |||
225 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, | 227 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, |
226 | (void *)(unsigned long)ps_tsk_num, | 228 | (void *)(unsigned long)ps_tsk_num, |
227 | "power_saving/%d", ps_tsk_num); | 229 | "power_saving/%d", ps_tsk_num); |
228 | if (ps_tsks[ps_tsk_num]) { | 230 | rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; |
231 | if (!rc) | ||
229 | ps_tsk_num++; | 232 | ps_tsk_num++; |
230 | return 0; | 233 | else |
231 | } | 234 | ps_tsks[ps_tsk_num] = NULL; |
232 | return -EINVAL; | 235 | |
236 | return rc; | ||
233 | } | 237 | } |
234 | 238 | ||
235 | static void destroy_power_saving_task(void) | 239 | static void destroy_power_saving_task(void) |
@@ -237,6 +241,7 @@ static void destroy_power_saving_task(void) | |||
237 | if (ps_tsk_num > 0) { | 241 | if (ps_tsk_num > 0) { |
238 | ps_tsk_num--; | 242 | ps_tsk_num--; |
239 | kthread_stop(ps_tsks[ps_tsk_num]); | 243 | kthread_stop(ps_tsks[ps_tsk_num]); |
244 | ps_tsks[ps_tsk_num] = NULL; | ||
240 | } | 245 | } |
241 | } | 246 | } |
242 | 247 | ||
@@ -253,7 +258,7 @@ static void set_power_saving_task_num(unsigned int num) | |||
253 | } | 258 | } |
254 | } | 259 | } |
255 | 260 | ||
256 | static int acpi_pad_idle_cpus(unsigned int num_cpus) | 261 | static void acpi_pad_idle_cpus(unsigned int num_cpus) |
257 | { | 262 | { |
258 | get_online_cpus(); | 263 | get_online_cpus(); |
259 | 264 | ||
@@ -261,7 +266,6 @@ static int acpi_pad_idle_cpus(unsigned int num_cpus) | |||
261 | set_power_saving_task_num(num_cpus); | 266 | set_power_saving_task_num(num_cpus); |
262 | 267 | ||
263 | put_online_cpus(); | 268 | put_online_cpus(); |
264 | return 0; | ||
265 | } | 269 | } |
266 | 270 | ||
267 | static uint32_t acpi_pad_idle_cpus_num(void) | 271 | static uint32_t acpi_pad_idle_cpus_num(void) |
@@ -369,19 +373,21 @@ static void acpi_pad_remove_sysfs(struct acpi_device *device) | |||
369 | static int acpi_pad_pur(acpi_handle handle, int *num_cpus) | 373 | static int acpi_pad_pur(acpi_handle handle, int *num_cpus) |
370 | { | 374 | { |
371 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 375 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
372 | acpi_status status; | ||
373 | union acpi_object *package; | 376 | union acpi_object *package; |
374 | int rev, num, ret = -EINVAL; | 377 | int rev, num, ret = -EINVAL; |
375 | 378 | ||
376 | status = acpi_evaluate_object(handle, "_PUR", NULL, &buffer); | 379 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) |
377 | if (ACPI_FAILURE(status)) | 380 | return -EINVAL; |
381 | |||
382 | if (!buffer.length || !buffer.pointer) | ||
378 | return -EINVAL; | 383 | return -EINVAL; |
384 | |||
379 | package = buffer.pointer; | 385 | package = buffer.pointer; |
380 | if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) | 386 | if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) |
381 | goto out; | 387 | goto out; |
382 | rev = package->package.elements[0].integer.value; | 388 | rev = package->package.elements[0].integer.value; |
383 | num = package->package.elements[1].integer.value; | 389 | num = package->package.elements[1].integer.value; |
384 | if (rev != 1) | 390 | if (rev != 1 || num < 0) |
385 | goto out; | 391 | goto out; |
386 | *num_cpus = num; | 392 | *num_cpus = num; |
387 | ret = 0; | 393 | ret = 0; |
@@ -410,7 +416,7 @@ static void acpi_pad_ost(acpi_handle handle, int stat, | |||
410 | 416 | ||
411 | static void acpi_pad_handle_notify(acpi_handle handle) | 417 | static void acpi_pad_handle_notify(acpi_handle handle) |
412 | { | 418 | { |
413 | int num_cpus, ret; | 419 | int num_cpus; |
414 | uint32_t idle_cpus; | 420 | uint32_t idle_cpus; |
415 | 421 | ||
416 | mutex_lock(&isolated_cpus_lock); | 422 | mutex_lock(&isolated_cpus_lock); |
@@ -418,12 +424,9 @@ static void acpi_pad_handle_notify(acpi_handle handle) | |||
418 | mutex_unlock(&isolated_cpus_lock); | 424 | mutex_unlock(&isolated_cpus_lock); |
419 | return; | 425 | return; |
420 | } | 426 | } |
421 | ret = acpi_pad_idle_cpus(num_cpus); | 427 | acpi_pad_idle_cpus(num_cpus); |
422 | idle_cpus = acpi_pad_idle_cpus_num(); | 428 | idle_cpus = acpi_pad_idle_cpus_num(); |
423 | if (!ret) | 429 | acpi_pad_ost(handle, 0, idle_cpus); |
424 | acpi_pad_ost(handle, 0, idle_cpus); | ||
425 | else | ||
426 | acpi_pad_ost(handle, 1, 0); | ||
427 | mutex_unlock(&isolated_cpus_lock); | 430 | mutex_unlock(&isolated_cpus_lock); |
428 | } | 431 | } |
429 | 432 | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index cf761b904e4a..a52126e46307 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -490,9 +490,14 @@ static void acpi_bus_osc_support(void) | |||
490 | 490 | ||
491 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | 491 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; |
492 | capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ | 492 | capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ |
493 | #ifdef CONFIG_ACPI_PROCESSOR_AGGREGATOR | 493 | #if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ |
494 | defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) | ||
494 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; | 495 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; |
495 | #endif | 496 | #endif |
497 | |||
498 | #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) | ||
499 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT; | ||
500 | #endif | ||
496 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) | 501 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) |
497 | return; | 502 | return; |
498 | if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) | 503 | if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index fd1801bdee66..d6471bb6852f 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -201,14 +201,13 @@ unlock: | |||
201 | spin_unlock_irqrestore(&ec->curr_lock, flags); | 201 | spin_unlock_irqrestore(&ec->curr_lock, flags); |
202 | } | 202 | } |
203 | 203 | ||
204 | static void acpi_ec_gpe_query(void *ec_cxt); | 204 | static int acpi_ec_sync_query(struct acpi_ec *ec); |
205 | 205 | ||
206 | static int ec_check_sci(struct acpi_ec *ec, u8 state) | 206 | static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) |
207 | { | 207 | { |
208 | if (state & ACPI_EC_FLAG_SCI) { | 208 | if (state & ACPI_EC_FLAG_SCI) { |
209 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) | 209 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
210 | return acpi_os_execute(OSL_EC_BURST_HANDLER, | 210 | return acpi_ec_sync_query(ec); |
211 | acpi_ec_gpe_query, ec); | ||
212 | } | 211 | } |
213 | return 0; | 212 | return 0; |
214 | } | 213 | } |
@@ -249,11 +248,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
249 | { | 248 | { |
250 | unsigned long tmp; | 249 | unsigned long tmp; |
251 | int ret = 0; | 250 | int ret = 0; |
252 | pr_debug(PREFIX "transaction start\n"); | ||
253 | /* disable GPE during transaction if storm is detected */ | ||
254 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
255 | acpi_disable_gpe(NULL, ec->gpe); | ||
256 | } | ||
257 | if (EC_FLAGS_MSI) | 251 | if (EC_FLAGS_MSI) |
258 | udelay(ACPI_EC_MSI_UDELAY); | 252 | udelay(ACPI_EC_MSI_UDELAY); |
259 | /* start transaction */ | 253 | /* start transaction */ |
@@ -265,20 +259,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
265 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 259 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
266 | spin_unlock_irqrestore(&ec->curr_lock, tmp); | 260 | spin_unlock_irqrestore(&ec->curr_lock, tmp); |
267 | ret = ec_poll(ec); | 261 | ret = ec_poll(ec); |
268 | pr_debug(PREFIX "transaction end\n"); | ||
269 | spin_lock_irqsave(&ec->curr_lock, tmp); | 262 | spin_lock_irqsave(&ec->curr_lock, tmp); |
270 | ec->curr = NULL; | 263 | ec->curr = NULL; |
271 | spin_unlock_irqrestore(&ec->curr_lock, tmp); | 264 | spin_unlock_irqrestore(&ec->curr_lock, tmp); |
272 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
273 | /* check if we received SCI during transaction */ | ||
274 | ec_check_sci(ec, acpi_ec_read_status(ec)); | ||
275 | /* it is safe to enable GPE outside of transaction */ | ||
276 | acpi_enable_gpe(NULL, ec->gpe); | ||
277 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | ||
278 | pr_info(PREFIX "GPE storm detected, " | ||
279 | "transactions will use polling mode\n"); | ||
280 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | ||
281 | } | ||
282 | return ret; | 265 | return ret; |
283 | } | 266 | } |
284 | 267 | ||
@@ -321,7 +304,26 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
321 | status = -ETIME; | 304 | status = -ETIME; |
322 | goto end; | 305 | goto end; |
323 | } | 306 | } |
307 | pr_debug(PREFIX "transaction start\n"); | ||
308 | /* disable GPE during transaction if storm is detected */ | ||
309 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
310 | acpi_disable_gpe(NULL, ec->gpe); | ||
311 | } | ||
312 | |||
324 | status = acpi_ec_transaction_unlocked(ec, t); | 313 | status = acpi_ec_transaction_unlocked(ec, t); |
314 | |||
315 | /* check if we received SCI during transaction */ | ||
316 | ec_check_sci_sync(ec, acpi_ec_read_status(ec)); | ||
317 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
318 | msleep(1); | ||
319 | /* it is safe to enable GPE outside of transaction */ | ||
320 | acpi_enable_gpe(NULL, ec->gpe); | ||
321 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | ||
322 | pr_info(PREFIX "GPE storm detected, " | ||
323 | "transactions will use polling mode\n"); | ||
324 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | ||
325 | } | ||
326 | pr_debug(PREFIX "transaction end\n"); | ||
325 | end: | 327 | end: |
326 | if (ec->global_lock) | 328 | if (ec->global_lock) |
327 | acpi_release_global_lock(glk); | 329 | acpi_release_global_lock(glk); |
@@ -443,7 +445,7 @@ int ec_transaction(u8 command, | |||
443 | 445 | ||
444 | EXPORT_SYMBOL(ec_transaction); | 446 | EXPORT_SYMBOL(ec_transaction); |
445 | 447 | ||
446 | static int acpi_ec_query(struct acpi_ec *ec, u8 * data) | 448 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) |
447 | { | 449 | { |
448 | int result; | 450 | int result; |
449 | u8 d; | 451 | u8 d; |
@@ -452,20 +454,16 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data) | |||
452 | .wlen = 0, .rlen = 1}; | 454 | .wlen = 0, .rlen = 1}; |
453 | if (!ec || !data) | 455 | if (!ec || !data) |
454 | return -EINVAL; | 456 | return -EINVAL; |
455 | |||
456 | /* | 457 | /* |
457 | * Query the EC to find out which _Qxx method we need to evaluate. | 458 | * Query the EC to find out which _Qxx method we need to evaluate. |
458 | * Note that successful completion of the query causes the ACPI_EC_SCI | 459 | * Note that successful completion of the query causes the ACPI_EC_SCI |
459 | * bit to be cleared (and thus clearing the interrupt source). | 460 | * bit to be cleared (and thus clearing the interrupt source). |
460 | */ | 461 | */ |
461 | 462 | result = acpi_ec_transaction_unlocked(ec, &t); | |
462 | result = acpi_ec_transaction(ec, &t); | ||
463 | if (result) | 463 | if (result) |
464 | return result; | 464 | return result; |
465 | |||
466 | if (!d) | 465 | if (!d) |
467 | return -ENODATA; | 466 | return -ENODATA; |
468 | |||
469 | *data = d; | 467 | *data = d; |
470 | return 0; | 468 | return 0; |
471 | } | 469 | } |
@@ -509,43 +507,79 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) | |||
509 | 507 | ||
510 | EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); | 508 | EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); |
511 | 509 | ||
512 | static void acpi_ec_gpe_query(void *ec_cxt) | 510 | static void acpi_ec_run(void *cxt) |
513 | { | 511 | { |
514 | struct acpi_ec *ec = ec_cxt; | 512 | struct acpi_ec_query_handler *handler = cxt; |
515 | u8 value = 0; | 513 | if (!handler) |
516 | struct acpi_ec_query_handler *handler, copy; | ||
517 | |||
518 | if (!ec || acpi_ec_query(ec, &value)) | ||
519 | return; | 514 | return; |
520 | mutex_lock(&ec->lock); | 515 | pr_debug(PREFIX "start query execution\n"); |
516 | if (handler->func) | ||
517 | handler->func(handler->data); | ||
518 | else if (handler->handle) | ||
519 | acpi_evaluate_object(handler->handle, NULL, NULL, NULL); | ||
520 | pr_debug(PREFIX "stop query execution\n"); | ||
521 | kfree(handler); | ||
522 | } | ||
523 | |||
524 | static int acpi_ec_sync_query(struct acpi_ec *ec) | ||
525 | { | ||
526 | u8 value = 0; | ||
527 | int status; | ||
528 | struct acpi_ec_query_handler *handler, *copy; | ||
529 | if ((status = acpi_ec_query_unlocked(ec, &value))) | ||
530 | return status; | ||
521 | list_for_each_entry(handler, &ec->list, node) { | 531 | list_for_each_entry(handler, &ec->list, node) { |
522 | if (value == handler->query_bit) { | 532 | if (value == handler->query_bit) { |
523 | /* have custom handler for this bit */ | 533 | /* have custom handler for this bit */ |
524 | memcpy(©, handler, sizeof(copy)); | 534 | copy = kmalloc(sizeof(*handler), GFP_KERNEL); |
525 | mutex_unlock(&ec->lock); | 535 | if (!copy) |
526 | if (copy.func) { | 536 | return -ENOMEM; |
527 | copy.func(copy.data); | 537 | memcpy(copy, handler, sizeof(*copy)); |
528 | } else if (copy.handle) { | 538 | pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value); |
529 | acpi_evaluate_object(copy.handle, NULL, NULL, NULL); | 539 | return acpi_os_execute((copy->func) ? |
530 | } | 540 | OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER, |
531 | return; | 541 | acpi_ec_run, copy); |
532 | } | 542 | } |
533 | } | 543 | } |
544 | return 0; | ||
545 | } | ||
546 | |||
547 | static void acpi_ec_gpe_query(void *ec_cxt) | ||
548 | { | ||
549 | struct acpi_ec *ec = ec_cxt; | ||
550 | if (!ec) | ||
551 | return; | ||
552 | mutex_lock(&ec->lock); | ||
553 | acpi_ec_sync_query(ec); | ||
534 | mutex_unlock(&ec->lock); | 554 | mutex_unlock(&ec->lock); |
535 | } | 555 | } |
536 | 556 | ||
557 | static void acpi_ec_gpe_query(void *ec_cxt); | ||
558 | |||
559 | static int ec_check_sci(struct acpi_ec *ec, u8 state) | ||
560 | { | ||
561 | if (state & ACPI_EC_FLAG_SCI) { | ||
562 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { | ||
563 | pr_debug(PREFIX "push gpe query to the queue\n"); | ||
564 | return acpi_os_execute(OSL_NOTIFY_HANDLER, | ||
565 | acpi_ec_gpe_query, ec); | ||
566 | } | ||
567 | } | ||
568 | return 0; | ||
569 | } | ||
570 | |||
537 | static u32 acpi_ec_gpe_handler(void *data) | 571 | static u32 acpi_ec_gpe_handler(void *data) |
538 | { | 572 | { |
539 | struct acpi_ec *ec = data; | 573 | struct acpi_ec *ec = data; |
540 | u8 status; | ||
541 | 574 | ||
542 | pr_debug(PREFIX "~~~> interrupt\n"); | 575 | pr_debug(PREFIX "~~~> interrupt\n"); |
543 | status = acpi_ec_read_status(ec); | ||
544 | 576 | ||
545 | advance_transaction(ec, status); | 577 | advance_transaction(ec, acpi_ec_read_status(ec)); |
546 | if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0) | 578 | if (ec_transaction_done(ec) && |
579 | (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { | ||
547 | wake_up(&ec->wait); | 580 | wake_up(&ec->wait); |
548 | ec_check_sci(ec, status); | 581 | ec_check_sci(ec, acpi_ec_read_status(ec)); |
582 | } | ||
549 | return ACPI_INTERRUPT_HANDLED; | 583 | return ACPI_INTERRUPT_HANDLED; |
550 | } | 584 | } |
551 | 585 | ||
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 394ae89409c2..04b0f007c9b7 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -56,7 +56,7 @@ ACPI_MODULE_NAME("pci_link"); | |||
56 | static int acpi_pci_link_add(struct acpi_device *device); | 56 | static int acpi_pci_link_add(struct acpi_device *device); |
57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); | 57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); |
58 | 58 | ||
59 | static struct acpi_device_id link_device_ids[] = { | 59 | static const struct acpi_device_id link_device_ids[] = { |
60 | {"PNP0C0F", 0}, | 60 | {"PNP0C0F", 0}, |
61 | {"", 0}, | 61 | {"", 0}, |
62 | }; | 62 | }; |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 101cce3681d1..64f55b6db73c 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -46,7 +46,7 @@ static int acpi_pci_root_add(struct acpi_device *device); | |||
46 | static int acpi_pci_root_remove(struct acpi_device *device, int type); | 46 | static int acpi_pci_root_remove(struct acpi_device *device, int type); |
47 | static int acpi_pci_root_start(struct acpi_device *device); | 47 | static int acpi_pci_root_start(struct acpi_device *device); |
48 | 48 | ||
49 | static struct acpi_device_id root_device_ids[] = { | 49 | static const struct acpi_device_id root_device_ids[] = { |
50 | {"PNP0A03", 0}, | 50 | {"PNP0A03", 0}, |
51 | {"", 0}, | 51 | {"", 0}, |
52 | }; | 52 | }; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 22b297916519..0f30c3c1eea4 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -65,7 +65,7 @@ static int acpi_power_remove(struct acpi_device *device, int type); | |||
65 | static int acpi_power_resume(struct acpi_device *device); | 65 | static int acpi_power_resume(struct acpi_device *device); |
66 | static int acpi_power_open_fs(struct inode *inode, struct file *file); | 66 | static int acpi_power_open_fs(struct inode *inode, struct file *file); |
67 | 67 | ||
68 | static struct acpi_device_id power_device_ids[] = { | 68 | static const struct acpi_device_id power_device_ids[] = { |
69 | {ACPI_POWER_HID, 0}, | 69 | {ACPI_POWER_HID, 0}, |
70 | {"", 0}, | 70 | {"", 0}, |
71 | }; | 71 | }; |
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c index 2ef7030a0c28..dc4ffadf8122 100644 --- a/drivers/acpi/power_meter.c +++ b/drivers/acpi/power_meter.c | |||
@@ -64,7 +64,7 @@ static int can_cap_in_hardware(void) | |||
64 | return force_cap_on || cap_in_hardware; | 64 | return force_cap_on || cap_in_hardware; |
65 | } | 65 | } |
66 | 66 | ||
67 | static struct acpi_device_id power_meter_ids[] = { | 67 | static const struct acpi_device_id power_meter_ids[] = { |
68 | {"ACPI000D", 0}, | 68 | {"ACPI000D", 0}, |
69 | {"", 0}, | 69 | {"", 0}, |
70 | }; | 70 | }; |
@@ -534,6 +534,7 @@ static void remove_domain_devices(struct acpi_power_meter_resource *resource) | |||
534 | 534 | ||
535 | kfree(resource->domain_devices); | 535 | kfree(resource->domain_devices); |
536 | kobject_put(resource->holders_dir); | 536 | kobject_put(resource->holders_dir); |
537 | resource->num_domain_devices = 0; | ||
537 | } | 538 | } |
538 | 539 | ||
539 | static int read_domain_devices(struct acpi_power_meter_resource *resource) | 540 | static int read_domain_devices(struct acpi_power_meter_resource *resource) |
@@ -740,7 +741,6 @@ skip_unsafe_cap: | |||
740 | 741 | ||
741 | return res; | 742 | return res; |
742 | error: | 743 | error: |
743 | remove_domain_devices(resource); | ||
744 | remove_attrs(resource); | 744 | remove_attrs(resource); |
745 | return res; | 745 | return res; |
746 | } | 746 | } |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index d1676b1754d9..7c0441f63b39 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -305,6 +305,28 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |||
305 | pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; | 305 | pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; |
306 | pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; | 306 | pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; |
307 | 307 | ||
308 | /* | ||
309 | * FADT specified C2 latency must be less than or equal to | ||
310 | * 100 microseconds. | ||
311 | */ | ||
312 | if (acpi_gbl_FADT.C2latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { | ||
313 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
314 | "C2 latency too large [%d]\n", acpi_gbl_FADT.C2latency)); | ||
315 | /* invalidate C2 */ | ||
316 | pr->power.states[ACPI_STATE_C2].address = 0; | ||
317 | } | ||
318 | |||
319 | /* | ||
320 | * FADT supplied C3 latency must be less than or equal to | ||
321 | * 1000 microseconds. | ||
322 | */ | ||
323 | if (acpi_gbl_FADT.C3latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { | ||
324 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
325 | "C3 latency too large [%d]\n", acpi_gbl_FADT.C3latency)); | ||
326 | /* invalidate C3 */ | ||
327 | pr->power.states[ACPI_STATE_C3].address = 0; | ||
328 | } | ||
329 | |||
308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 330 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
309 | "lvl2[0x%08x] lvl3[0x%08x]\n", | 331 | "lvl2[0x%08x] lvl3[0x%08x]\n", |
310 | pr->power.states[ACPI_STATE_C2].address, | 332 | pr->power.states[ACPI_STATE_C2].address, |
@@ -494,33 +516,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
494 | return status; | 516 | return status; |
495 | } | 517 | } |
496 | 518 | ||
497 | static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | ||
498 | { | ||
499 | |||
500 | if (!cx->address) | ||
501 | return; | ||
502 | |||
503 | /* | ||
504 | * C2 latency must be less than or equal to 100 | ||
505 | * microseconds. | ||
506 | */ | ||
507 | else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { | ||
508 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
509 | "latency too large [%d]\n", cx->latency)); | ||
510 | return; | ||
511 | } | ||
512 | |||
513 | /* | ||
514 | * Otherwise we've met all of our C2 requirements. | ||
515 | * Normalize the C2 latency to expidite policy | ||
516 | */ | ||
517 | cx->valid = 1; | ||
518 | |||
519 | cx->latency_ticks = cx->latency; | ||
520 | |||
521 | return; | ||
522 | } | ||
523 | |||
524 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | 519 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, |
525 | struct acpi_processor_cx *cx) | 520 | struct acpi_processor_cx *cx) |
526 | { | 521 | { |
@@ -532,16 +527,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
532 | return; | 527 | return; |
533 | 528 | ||
534 | /* | 529 | /* |
535 | * C3 latency must be less than or equal to 1000 | ||
536 | * microseconds. | ||
537 | */ | ||
538 | else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { | ||
539 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
540 | "latency too large [%d]\n", cx->latency)); | ||
541 | return; | ||
542 | } | ||
543 | |||
544 | /* | ||
545 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) | 530 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) |
546 | * DMA transfers are used by any ISA device to avoid livelock. | 531 | * DMA transfers are used by any ISA device to avoid livelock. |
547 | * Note that we could disable Type-F DMA (as recommended by | 532 | * Note that we could disable Type-F DMA (as recommended by |
@@ -629,7 +614,10 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
629 | break; | 614 | break; |
630 | 615 | ||
631 | case ACPI_STATE_C2: | 616 | case ACPI_STATE_C2: |
632 | acpi_processor_power_verify_c2(cx); | 617 | if (!cx->address) |
618 | break; | ||
619 | cx->valid = 1; | ||
620 | cx->latency_ticks = cx->latency; /* Normalize latency */ | ||
633 | break; | 621 | break; |
634 | 622 | ||
635 | case ACPI_STATE_C3: | 623 | case ACPI_STATE_C3: |
diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c index 30e4dc0cdf30..7247819dbd80 100644 --- a/drivers/acpi/processor_pdc.c +++ b/drivers/acpi/processor_pdc.c | |||
@@ -144,6 +144,29 @@ void acpi_processor_set_pdc(acpi_handle handle) | |||
144 | } | 144 | } |
145 | EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); | 145 | EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); |
146 | 146 | ||
147 | static int early_pdc_optin; | ||
148 | static int set_early_pdc_optin(const struct dmi_system_id *id) | ||
149 | { | ||
150 | early_pdc_optin = 1; | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static struct dmi_system_id __cpuinitdata early_pdc_optin_table[] = { | ||
155 | { | ||
156 | set_early_pdc_optin, "HP Envy", { | ||
157 | DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), | ||
158 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Envy") }, NULL}, | ||
159 | { | ||
160 | set_early_pdc_optin, "HP Pavilion dv6", { | ||
161 | DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), | ||
162 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv6") }, NULL}, | ||
163 | { | ||
164 | set_early_pdc_optin, "HP Pavilion dv7", { | ||
165 | DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), | ||
166 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv7") }, NULL}, | ||
167 | {}, | ||
168 | }; | ||
169 | |||
147 | static acpi_status | 170 | static acpi_status |
148 | early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) | 171 | early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) |
149 | { | 172 | { |
@@ -151,7 +174,7 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
151 | return AE_OK; | 174 | return AE_OK; |
152 | } | 175 | } |
153 | 176 | ||
154 | void acpi_early_processor_set_pdc(void) | 177 | void __init acpi_early_processor_set_pdc(void) |
155 | { | 178 | { |
156 | /* | 179 | /* |
157 | * Check whether the system is DMI table. If yes, OSPM | 180 | * Check whether the system is DMI table. If yes, OSPM |
@@ -159,6 +182,13 @@ void acpi_early_processor_set_pdc(void) | |||
159 | */ | 182 | */ |
160 | dmi_check_system(processor_idle_dmi_table); | 183 | dmi_check_system(processor_idle_dmi_table); |
161 | 184 | ||
185 | /* | ||
186 | * Allow systems to opt-in to early _PDC evaluation. | ||
187 | */ | ||
188 | dmi_check_system(early_pdc_optin_table); | ||
189 | if (!early_pdc_optin) | ||
190 | return; | ||
191 | |||
162 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, | 192 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
163 | ACPI_UINT32_MAX, | 193 | ACPI_UINT32_MAX, |
164 | early_init_pdc, NULL, NULL, NULL); | 194 | early_init_pdc, NULL, NULL, NULL); |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 140c5c5b423c..6deafb4aa0da 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -443,8 +443,7 @@ struct thermal_cooling_device_ops processor_cooling_ops = { | |||
443 | #ifdef CONFIG_ACPI_PROCFS | 443 | #ifdef CONFIG_ACPI_PROCFS |
444 | static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) | 444 | static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) |
445 | { | 445 | { |
446 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; | 446 | struct acpi_processor *pr = seq->private; |
447 | |||
448 | 447 | ||
449 | if (!pr) | 448 | if (!pr) |
450 | goto end; | 449 | goto end; |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 52b9db8afc20..b16ddbf23a9c 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -822,7 +822,10 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
822 | 822 | ||
823 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 823 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
824 | { | 824 | { |
825 | #if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER) | ||
825 | struct acpi_battery *battery = &sbs->battery[id]; | 826 | struct acpi_battery *battery = &sbs->battery[id]; |
827 | #endif | ||
828 | |||
826 | #ifdef CONFIG_ACPI_SYSFS_POWER | 829 | #ifdef CONFIG_ACPI_SYSFS_POWER |
827 | if (battery->bat.dev) { | 830 | if (battery->bat.dev) { |
828 | if (battery->have_sysfs_alarm) | 831 | if (battery->have_sysfs_alarm) |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index d9339806df45..fd09229282ea 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -242,7 +242,7 @@ static int smbus_alarm(void *context) | |||
242 | case ACPI_SBS_CHARGER: | 242 | case ACPI_SBS_CHARGER: |
243 | case ACPI_SBS_MANAGER: | 243 | case ACPI_SBS_MANAGER: |
244 | case ACPI_SBS_BATTERY: | 244 | case ACPI_SBS_BATTERY: |
245 | acpi_os_execute(OSL_GPE_HANDLER, | 245 | acpi_os_execute(OSL_NOTIFY_HANDLER, |
246 | acpi_smbus_callback, hc); | 246 | acpi_smbus_callback, hc); |
247 | default:; | 247 | default:; |
248 | } | 248 | } |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 72e76b4b6538..b765790b32be 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -78,6 +78,13 @@ MODULE_LICENSE("GPL"); | |||
78 | static int brightness_switch_enabled = 1; | 78 | static int brightness_switch_enabled = 1; |
79 | module_param(brightness_switch_enabled, bool, 0644); | 79 | module_param(brightness_switch_enabled, bool, 0644); |
80 | 80 | ||
81 | /* | ||
82 | * By default, we don't allow duplicate ACPI video bus devices | ||
83 | * under the same VGA controller | ||
84 | */ | ||
85 | static int allow_duplicates; | ||
86 | module_param(allow_duplicates, bool, 0644); | ||
87 | |||
81 | static int register_count = 0; | 88 | static int register_count = 0; |
82 | static int acpi_video_bus_add(struct acpi_device *device); | 89 | static int acpi_video_bus_add(struct acpi_device *device); |
83 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 90 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
@@ -2239,11 +2246,47 @@ static int acpi_video_resume(struct acpi_device *device) | |||
2239 | return AE_OK; | 2246 | return AE_OK; |
2240 | } | 2247 | } |
2241 | 2248 | ||
2249 | static acpi_status | ||
2250 | acpi_video_bus_match(acpi_handle handle, u32 level, void *context, | ||
2251 | void **return_value) | ||
2252 | { | ||
2253 | struct acpi_device *device = context; | ||
2254 | struct acpi_device *sibling; | ||
2255 | int result; | ||
2256 | |||
2257 | if (handle == device->handle) | ||
2258 | return AE_CTRL_TERMINATE; | ||
2259 | |||
2260 | result = acpi_bus_get_device(handle, &sibling); | ||
2261 | if (result) | ||
2262 | return AE_OK; | ||
2263 | |||
2264 | if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME)) | ||
2265 | return AE_ALREADY_EXISTS; | ||
2266 | |||
2267 | return AE_OK; | ||
2268 | } | ||
2269 | |||
2242 | static int acpi_video_bus_add(struct acpi_device *device) | 2270 | static int acpi_video_bus_add(struct acpi_device *device) |
2243 | { | 2271 | { |
2244 | struct acpi_video_bus *video; | 2272 | struct acpi_video_bus *video; |
2245 | struct input_dev *input; | 2273 | struct input_dev *input; |
2246 | int error; | 2274 | int error; |
2275 | acpi_status status; | ||
2276 | |||
2277 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, | ||
2278 | device->parent->handle, 1, | ||
2279 | acpi_video_bus_match, NULL, | ||
2280 | device, NULL); | ||
2281 | if (status == AE_ALREADY_EXISTS) { | ||
2282 | printk(KERN_WARNING FW_BUG | ||
2283 | "Duplicate ACPI video bus devices for the" | ||
2284 | " same VGA controller, please try module " | ||
2285 | "parameter \"video.allow_duplicates=1\"" | ||
2286 | "if the current driver doesn't work.\n"); | ||
2287 | if (!allow_duplicates) | ||
2288 | return -ENODEV; | ||
2289 | } | ||
2247 | 2290 | ||
2248 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); | 2291 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); |
2249 | if (!video) | 2292 | if (!video) |
diff --git a/drivers/block/drbd/Kconfig b/drivers/block/drbd/Kconfig index f4acd04ebeef..df0983787390 100644 --- a/drivers/block/drbd/Kconfig +++ b/drivers/block/drbd/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | comment "DRBD disabled because PROC_FS, INET or CONNECTOR not selected" | 5 | comment "DRBD disabled because PROC_FS, INET or CONNECTOR not selected" |
6 | depends on !PROC_FS || !INET || !CONNECTOR | 6 | depends on PROC_FS='n' || INET='n' || CONNECTOR='n' |
7 | 7 | ||
8 | config BLK_DEV_DRBD | 8 | config BLK_DEV_DRBD |
9 | tristate "DRBD Distributed Replicated Block Device support" | 9 | tristate "DRBD Distributed Replicated Block Device support" |
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index c97558763430..2bf3a6ef3684 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -1275,7 +1275,7 @@ struct bm_extent { | |||
1275 | #if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32 | 1275 | #if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32 |
1276 | #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_BM | 1276 | #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_BM |
1277 | #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_BM | 1277 | #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_BM |
1278 | #elif !defined(CONFIG_LBD) && BITS_PER_LONG == 32 | 1278 | #elif !defined(CONFIG_LBDAF) && BITS_PER_LONG == 32 |
1279 | #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_32 | 1279 | #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_32 |
1280 | #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_32 | 1280 | #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_32 |
1281 | #else | 1281 | #else |
@@ -1371,10 +1371,9 @@ extern int is_valid_ar_handle(struct drbd_request *, sector_t); | |||
1371 | extern void drbd_suspend_io(struct drbd_conf *mdev); | 1371 | extern void drbd_suspend_io(struct drbd_conf *mdev); |
1372 | extern void drbd_resume_io(struct drbd_conf *mdev); | 1372 | extern void drbd_resume_io(struct drbd_conf *mdev); |
1373 | extern char *ppsize(char *buf, unsigned long long size); | 1373 | extern char *ppsize(char *buf, unsigned long long size); |
1374 | extern sector_t drbd_new_dev_size(struct drbd_conf *, | 1374 | extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, int); |
1375 | struct drbd_backing_dev *); | ||
1376 | enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; | 1375 | enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; |
1377 | extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *) __must_hold(local); | 1376 | extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *, int force) __must_hold(local); |
1378 | extern void resync_after_online_grow(struct drbd_conf *); | 1377 | extern void resync_after_online_grow(struct drbd_conf *); |
1379 | extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int) __must_hold(local); | 1378 | extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int) __must_hold(local); |
1380 | extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, | 1379 | extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 9348f33f6242..e898ad9eb1c3 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -1298,6 +1298,7 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
1298 | dev_err(DEV, "Sending state in drbd_io_error() failed\n"); | 1298 | dev_err(DEV, "Sending state in drbd_io_error() failed\n"); |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | wait_event(mdev->misc_wait, !atomic_read(&mdev->local_cnt)); | ||
1301 | lc_destroy(mdev->resync); | 1302 | lc_destroy(mdev->resync); |
1302 | mdev->resync = NULL; | 1303 | mdev->resync = NULL; |
1303 | lc_destroy(mdev->act_log); | 1304 | lc_destroy(mdev->act_log); |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 4e0726aa53b0..1292e0620663 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -510,7 +510,7 @@ void drbd_resume_io(struct drbd_conf *mdev) | |||
510 | * Returns 0 on success, negative return values indicate errors. | 510 | * Returns 0 on success, negative return values indicate errors. |
511 | * You should call drbd_md_sync() after calling this function. | 511 | * You should call drbd_md_sync() after calling this function. |
512 | */ | 512 | */ |
513 | enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev) __must_hold(local) | 513 | enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev, int force) __must_hold(local) |
514 | { | 514 | { |
515 | sector_t prev_first_sect, prev_size; /* previous meta location */ | 515 | sector_t prev_first_sect, prev_size; /* previous meta location */ |
516 | sector_t la_size; | 516 | sector_t la_size; |
@@ -541,7 +541,7 @@ enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev) __must_ho | |||
541 | /* TODO: should only be some assert here, not (re)init... */ | 541 | /* TODO: should only be some assert here, not (re)init... */ |
542 | drbd_md_set_sector_offsets(mdev, mdev->ldev); | 542 | drbd_md_set_sector_offsets(mdev, mdev->ldev); |
543 | 543 | ||
544 | size = drbd_new_dev_size(mdev, mdev->ldev); | 544 | size = drbd_new_dev_size(mdev, mdev->ldev, force); |
545 | 545 | ||
546 | if (drbd_get_capacity(mdev->this_bdev) != size || | 546 | if (drbd_get_capacity(mdev->this_bdev) != size || |
547 | drbd_bm_capacity(mdev) != size) { | 547 | drbd_bm_capacity(mdev) != size) { |
@@ -596,7 +596,7 @@ out: | |||
596 | } | 596 | } |
597 | 597 | ||
598 | sector_t | 598 | sector_t |
599 | drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) | 599 | drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, int assume_peer_has_space) |
600 | { | 600 | { |
601 | sector_t p_size = mdev->p_size; /* partner's disk size. */ | 601 | sector_t p_size = mdev->p_size; /* partner's disk size. */ |
602 | sector_t la_size = bdev->md.la_size_sect; /* last agreed size. */ | 602 | sector_t la_size = bdev->md.la_size_sect; /* last agreed size. */ |
@@ -606,6 +606,11 @@ drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) | |||
606 | 606 | ||
607 | m_size = drbd_get_max_capacity(bdev); | 607 | m_size = drbd_get_max_capacity(bdev); |
608 | 608 | ||
609 | if (mdev->state.conn < C_CONNECTED && assume_peer_has_space) { | ||
610 | dev_warn(DEV, "Resize while not connected was forced by the user!\n"); | ||
611 | p_size = m_size; | ||
612 | } | ||
613 | |||
609 | if (p_size && m_size) { | 614 | if (p_size && m_size) { |
610 | size = min_t(sector_t, p_size, m_size); | 615 | size = min_t(sector_t, p_size, m_size); |
611 | } else { | 616 | } else { |
@@ -965,7 +970,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
965 | 970 | ||
966 | /* Prevent shrinking of consistent devices ! */ | 971 | /* Prevent shrinking of consistent devices ! */ |
967 | if (drbd_md_test_flag(nbc, MDF_CONSISTENT) && | 972 | if (drbd_md_test_flag(nbc, MDF_CONSISTENT) && |
968 | drbd_new_dev_size(mdev, nbc) < nbc->md.la_size_sect) { | 973 | drbd_new_dev_size(mdev, nbc, 0) < nbc->md.la_size_sect) { |
969 | dev_warn(DEV, "refusing to truncate a consistent device\n"); | 974 | dev_warn(DEV, "refusing to truncate a consistent device\n"); |
970 | retcode = ERR_DISK_TO_SMALL; | 975 | retcode = ERR_DISK_TO_SMALL; |
971 | goto force_diskless_dec; | 976 | goto force_diskless_dec; |
@@ -1052,7 +1057,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1052 | !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND)) | 1057 | !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND)) |
1053 | set_bit(USE_DEGR_WFC_T, &mdev->flags); | 1058 | set_bit(USE_DEGR_WFC_T, &mdev->flags); |
1054 | 1059 | ||
1055 | dd = drbd_determin_dev_size(mdev); | 1060 | dd = drbd_determin_dev_size(mdev, 0); |
1056 | if (dd == dev_size_error) { | 1061 | if (dd == dev_size_error) { |
1057 | retcode = ERR_NOMEM_BITMAP; | 1062 | retcode = ERR_NOMEM_BITMAP; |
1058 | goto force_diskless_dec; | 1063 | goto force_diskless_dec; |
@@ -1271,7 +1276,7 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
1271 | goto fail; | 1276 | goto fail; |
1272 | } | 1277 | } |
1273 | 1278 | ||
1274 | if (crypto_tfm_alg_type(crypto_hash_tfm(tfm)) != CRYPTO_ALG_TYPE_SHASH) { | 1279 | if (!drbd_crypto_is_hash(crypto_hash_tfm(tfm))) { |
1275 | retcode = ERR_AUTH_ALG_ND; | 1280 | retcode = ERR_AUTH_ALG_ND; |
1276 | goto fail; | 1281 | goto fail; |
1277 | } | 1282 | } |
@@ -1504,7 +1509,7 @@ static int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
1504 | } | 1509 | } |
1505 | 1510 | ||
1506 | mdev->ldev->dc.disk_size = (sector_t)rs.resize_size; | 1511 | mdev->ldev->dc.disk_size = (sector_t)rs.resize_size; |
1507 | dd = drbd_determin_dev_size(mdev); | 1512 | dd = drbd_determin_dev_size(mdev, rs.resize_force); |
1508 | drbd_md_sync(mdev); | 1513 | drbd_md_sync(mdev); |
1509 | put_ldev(mdev); | 1514 | put_ldev(mdev); |
1510 | if (dd == dev_size_error) { | 1515 | if (dd == dev_size_error) { |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 259c1351b152..f22a5283128a 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -878,9 +878,13 @@ retry: | |||
878 | 878 | ||
879 | if (mdev->cram_hmac_tfm) { | 879 | if (mdev->cram_hmac_tfm) { |
880 | /* drbd_request_state(mdev, NS(conn, WFAuth)); */ | 880 | /* drbd_request_state(mdev, NS(conn, WFAuth)); */ |
881 | if (!drbd_do_auth(mdev)) { | 881 | switch (drbd_do_auth(mdev)) { |
882 | case -1: | ||
882 | dev_err(DEV, "Authentication of peer failed\n"); | 883 | dev_err(DEV, "Authentication of peer failed\n"); |
883 | return -1; | 884 | return -1; |
885 | case 0: | ||
886 | dev_err(DEV, "Authentication of peer failed, trying again.\n"); | ||
887 | return 0; | ||
884 | } | 888 | } |
885 | } | 889 | } |
886 | 890 | ||
@@ -1201,10 +1205,11 @@ static int receive_Barrier(struct drbd_conf *mdev, struct p_header *h) | |||
1201 | 1205 | ||
1202 | case WO_bdev_flush: | 1206 | case WO_bdev_flush: |
1203 | case WO_drain_io: | 1207 | case WO_drain_io: |
1204 | D_ASSERT(rv == FE_STILL_LIVE); | 1208 | if (rv == FE_STILL_LIVE) { |
1205 | set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags); | 1209 | set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags); |
1206 | drbd_wait_ee_list_empty(mdev, &mdev->active_ee); | 1210 | drbd_wait_ee_list_empty(mdev, &mdev->active_ee); |
1207 | rv = drbd_flush_after_epoch(mdev, mdev->current_epoch); | 1211 | rv = drbd_flush_after_epoch(mdev, mdev->current_epoch); |
1212 | } | ||
1208 | if (rv == FE_RECYCLED) | 1213 | if (rv == FE_RECYCLED) |
1209 | return TRUE; | 1214 | return TRUE; |
1210 | 1215 | ||
@@ -2865,7 +2870,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
2865 | 2870 | ||
2866 | /* Never shrink a device with usable data during connect. | 2871 | /* Never shrink a device with usable data during connect. |
2867 | But allow online shrinking if we are connected. */ | 2872 | But allow online shrinking if we are connected. */ |
2868 | if (drbd_new_dev_size(mdev, mdev->ldev) < | 2873 | if (drbd_new_dev_size(mdev, mdev->ldev, 0) < |
2869 | drbd_get_capacity(mdev->this_bdev) && | 2874 | drbd_get_capacity(mdev->this_bdev) && |
2870 | mdev->state.disk >= D_OUTDATED && | 2875 | mdev->state.disk >= D_OUTDATED && |
2871 | mdev->state.conn < C_CONNECTED) { | 2876 | mdev->state.conn < C_CONNECTED) { |
@@ -2880,7 +2885,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
2880 | #undef min_not_zero | 2885 | #undef min_not_zero |
2881 | 2886 | ||
2882 | if (get_ldev(mdev)) { | 2887 | if (get_ldev(mdev)) { |
2883 | dd = drbd_determin_dev_size(mdev); | 2888 | dd = drbd_determin_dev_size(mdev, 0); |
2884 | put_ldev(mdev); | 2889 | put_ldev(mdev); |
2885 | if (dd == dev_size_error) | 2890 | if (dd == dev_size_error) |
2886 | return FALSE; | 2891 | return FALSE; |
@@ -3830,10 +3835,17 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
3830 | { | 3835 | { |
3831 | dev_err(DEV, "This kernel was build without CONFIG_CRYPTO_HMAC.\n"); | 3836 | dev_err(DEV, "This kernel was build without CONFIG_CRYPTO_HMAC.\n"); |
3832 | dev_err(DEV, "You need to disable 'cram-hmac-alg' in drbd.conf.\n"); | 3837 | dev_err(DEV, "You need to disable 'cram-hmac-alg' in drbd.conf.\n"); |
3833 | return 0; | 3838 | return -1; |
3834 | } | 3839 | } |
3835 | #else | 3840 | #else |
3836 | #define CHALLENGE_LEN 64 | 3841 | #define CHALLENGE_LEN 64 |
3842 | |||
3843 | /* Return value: | ||
3844 | 1 - auth succeeded, | ||
3845 | 0 - failed, try again (network error), | ||
3846 | -1 - auth failed, don't try again. | ||
3847 | */ | ||
3848 | |||
3837 | static int drbd_do_auth(struct drbd_conf *mdev) | 3849 | static int drbd_do_auth(struct drbd_conf *mdev) |
3838 | { | 3850 | { |
3839 | char my_challenge[CHALLENGE_LEN]; /* 64 Bytes... */ | 3851 | char my_challenge[CHALLENGE_LEN]; /* 64 Bytes... */ |
@@ -3854,7 +3866,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
3854 | (u8 *)mdev->net_conf->shared_secret, key_len); | 3866 | (u8 *)mdev->net_conf->shared_secret, key_len); |
3855 | if (rv) { | 3867 | if (rv) { |
3856 | dev_err(DEV, "crypto_hash_setkey() failed with %d\n", rv); | 3868 | dev_err(DEV, "crypto_hash_setkey() failed with %d\n", rv); |
3857 | rv = 0; | 3869 | rv = -1; |
3858 | goto fail; | 3870 | goto fail; |
3859 | } | 3871 | } |
3860 | 3872 | ||
@@ -3877,14 +3889,14 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
3877 | 3889 | ||
3878 | if (p.length > CHALLENGE_LEN*2) { | 3890 | if (p.length > CHALLENGE_LEN*2) { |
3879 | dev_err(DEV, "expected AuthChallenge payload too big.\n"); | 3891 | dev_err(DEV, "expected AuthChallenge payload too big.\n"); |
3880 | rv = 0; | 3892 | rv = -1; |
3881 | goto fail; | 3893 | goto fail; |
3882 | } | 3894 | } |
3883 | 3895 | ||
3884 | peers_ch = kmalloc(p.length, GFP_NOIO); | 3896 | peers_ch = kmalloc(p.length, GFP_NOIO); |
3885 | if (peers_ch == NULL) { | 3897 | if (peers_ch == NULL) { |
3886 | dev_err(DEV, "kmalloc of peers_ch failed\n"); | 3898 | dev_err(DEV, "kmalloc of peers_ch failed\n"); |
3887 | rv = 0; | 3899 | rv = -1; |
3888 | goto fail; | 3900 | goto fail; |
3889 | } | 3901 | } |
3890 | 3902 | ||
@@ -3900,7 +3912,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
3900 | response = kmalloc(resp_size, GFP_NOIO); | 3912 | response = kmalloc(resp_size, GFP_NOIO); |
3901 | if (response == NULL) { | 3913 | if (response == NULL) { |
3902 | dev_err(DEV, "kmalloc of response failed\n"); | 3914 | dev_err(DEV, "kmalloc of response failed\n"); |
3903 | rv = 0; | 3915 | rv = -1; |
3904 | goto fail; | 3916 | goto fail; |
3905 | } | 3917 | } |
3906 | 3918 | ||
@@ -3910,7 +3922,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
3910 | rv = crypto_hash_digest(&desc, &sg, sg.length, response); | 3922 | rv = crypto_hash_digest(&desc, &sg, sg.length, response); |
3911 | if (rv) { | 3923 | if (rv) { |
3912 | dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); | 3924 | dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); |
3913 | rv = 0; | 3925 | rv = -1; |
3914 | goto fail; | 3926 | goto fail; |
3915 | } | 3927 | } |
3916 | 3928 | ||
@@ -3944,9 +3956,9 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
3944 | } | 3956 | } |
3945 | 3957 | ||
3946 | right_response = kmalloc(resp_size, GFP_NOIO); | 3958 | right_response = kmalloc(resp_size, GFP_NOIO); |
3947 | if (response == NULL) { | 3959 | if (right_response == NULL) { |
3948 | dev_err(DEV, "kmalloc of right_response failed\n"); | 3960 | dev_err(DEV, "kmalloc of right_response failed\n"); |
3949 | rv = 0; | 3961 | rv = -1; |
3950 | goto fail; | 3962 | goto fail; |
3951 | } | 3963 | } |
3952 | 3964 | ||
@@ -3955,7 +3967,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
3955 | rv = crypto_hash_digest(&desc, &sg, sg.length, right_response); | 3967 | rv = crypto_hash_digest(&desc, &sg, sg.length, right_response); |
3956 | if (rv) { | 3968 | if (rv) { |
3957 | dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); | 3969 | dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); |
3958 | rv = 0; | 3970 | rv = -1; |
3959 | goto fail; | 3971 | goto fail; |
3960 | } | 3972 | } |
3961 | 3973 | ||
@@ -3964,6 +3976,8 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
3964 | if (rv) | 3976 | if (rv) |
3965 | dev_info(DEV, "Peer authenticated using %d bytes of '%s' HMAC\n", | 3977 | dev_info(DEV, "Peer authenticated using %d bytes of '%s' HMAC\n", |
3966 | resp_size, mdev->net_conf->cram_hmac_alg); | 3978 | resp_size, mdev->net_conf->cram_hmac_alg); |
3979 | else | ||
3980 | rv = -1; | ||
3967 | 3981 | ||
3968 | fail: | 3982 | fail: |
3969 | kfree(peers_ch); | 3983 | kfree(peers_ch); |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index be625475cf6d..4b22feb01a0c 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -503,16 +503,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, | |||
503 | return 0; | 503 | return 0; |
504 | } | 504 | } |
505 | 505 | ||
506 | if (blk_stack_limits(limits, &q->limits, start << 9) < 0) | 506 | if (bdev_stack_limits(limits, bdev, start) < 0) |
507 | DMWARN("%s: target device %s is misaligned: " | 507 | DMWARN("%s: adding target device %s caused an alignment inconsistency: " |
508 | "physical_block_size=%u, logical_block_size=%u, " | 508 | "physical_block_size=%u, logical_block_size=%u, " |
509 | "alignment_offset=%u, start=%llu", | 509 | "alignment_offset=%u, start=%llu", |
510 | dm_device_name(ti->table->md), bdevname(bdev, b), | 510 | dm_device_name(ti->table->md), bdevname(bdev, b), |
511 | q->limits.physical_block_size, | 511 | q->limits.physical_block_size, |
512 | q->limits.logical_block_size, | 512 | q->limits.logical_block_size, |
513 | q->limits.alignment_offset, | 513 | q->limits.alignment_offset, |
514 | (unsigned long long) start << 9); | 514 | (unsigned long long) start << SECTOR_SHIFT); |
515 | |||
516 | 515 | ||
517 | /* | 516 | /* |
518 | * Check if merge fn is supported. | 517 | * Check if merge fn is supported. |
@@ -1026,9 +1025,9 @@ combine_limits: | |||
1026 | * for the table. | 1025 | * for the table. |
1027 | */ | 1026 | */ |
1028 | if (blk_stack_limits(limits, &ti_limits, 0) < 0) | 1027 | if (blk_stack_limits(limits, &ti_limits, 0) < 0) |
1029 | DMWARN("%s: target device " | 1028 | DMWARN("%s: adding target device " |
1030 | "(start sect %llu len %llu) " | 1029 | "(start sect %llu len %llu) " |
1031 | "is misaligned", | 1030 | "caused an alignment inconsistency", |
1032 | dm_device_name(table->md), | 1031 | dm_device_name(table->md), |
1033 | (unsigned long long) ti->begin, | 1032 | (unsigned long long) ti->begin, |
1034 | (unsigned long long) ti->len); | 1033 | (unsigned long long) ti->len); |
@@ -1080,15 +1079,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
1080 | struct queue_limits *limits) | 1079 | struct queue_limits *limits) |
1081 | { | 1080 | { |
1082 | /* | 1081 | /* |
1083 | * Each target device in the table has a data area that should normally | ||
1084 | * be aligned such that the DM device's alignment_offset is 0. | ||
1085 | * FIXME: Propagate alignment_offsets up the stack and warn of | ||
1086 | * sub-optimal or inconsistent settings. | ||
1087 | */ | ||
1088 | limits->alignment_offset = 0; | ||
1089 | limits->misaligned = 0; | ||
1090 | |||
1091 | /* | ||
1092 | * Copy table's limits to the DM device's request_queue | 1082 | * Copy table's limits to the DM device's request_queue |
1093 | */ | 1083 | */ |
1094 | q->limits = *limits; | 1084 | q->limits = *limits; |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index db32c25e3605..f526e735c5ab 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -364,6 +364,7 @@ config EEEPC_LAPTOP | |||
364 | select HWMON | 364 | select HWMON |
365 | select LEDS_CLASS | 365 | select LEDS_CLASS |
366 | select NEW_LEDS | 366 | select NEW_LEDS |
367 | select INPUT_SPARSEKMAP | ||
367 | ---help--- | 368 | ---help--- |
368 | This driver supports the Fn-Fx keys on Eee PC laptops. | 369 | This driver supports the Fn-Fx keys on Eee PC laptops. |
369 | 370 | ||
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 5838c69b2fb3..e2be6bb33d92 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -31,10 +31,12 @@ | |||
31 | #include <acpi/acpi_bus.h> | 31 | #include <acpi/acpi_bus.h> |
32 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
33 | #include <linux/input.h> | 33 | #include <linux/input.h> |
34 | #include <linux/input/sparse-keymap.h> | ||
34 | #include <linux/rfkill.h> | 35 | #include <linux/rfkill.h> |
35 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
36 | #include <linux/pci_hotplug.h> | 37 | #include <linux/pci_hotplug.h> |
37 | #include <linux/leds.h> | 38 | #include <linux/leds.h> |
39 | #include <linux/dmi.h> | ||
38 | 40 | ||
39 | #define EEEPC_LAPTOP_VERSION "0.1" | 41 | #define EEEPC_LAPTOP_VERSION "0.1" |
40 | #define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver" | 42 | #define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver" |
@@ -48,6 +50,14 @@ MODULE_AUTHOR("Corentin Chary, Eric Cooper"); | |||
48 | MODULE_DESCRIPTION(EEEPC_LAPTOP_NAME); | 50 | MODULE_DESCRIPTION(EEEPC_LAPTOP_NAME); |
49 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
50 | 52 | ||
53 | static bool hotplug_disabled; | ||
54 | |||
55 | module_param(hotplug_disabled, bool, 0644); | ||
56 | MODULE_PARM_DESC(hotplug_disabled, | ||
57 | "Disable hotplug for wireless device. " | ||
58 | "If your laptop need that, please report to " | ||
59 | "acpi4asus-user@lists.sourceforge.net."); | ||
60 | |||
51 | /* | 61 | /* |
52 | * Definitions for Asus EeePC | 62 | * Definitions for Asus EeePC |
53 | */ | 63 | */ |
@@ -120,38 +130,28 @@ static const char *cm_setv[] = { | |||
120 | NULL, NULL, "PBPS", "TPDS" | 130 | NULL, NULL, "PBPS", "TPDS" |
121 | }; | 131 | }; |
122 | 132 | ||
123 | struct key_entry { | ||
124 | char type; | ||
125 | u8 code; | ||
126 | u16 keycode; | ||
127 | }; | ||
128 | |||
129 | enum { KE_KEY, KE_END }; | ||
130 | |||
131 | static const struct key_entry eeepc_keymap[] = { | 133 | static const struct key_entry eeepc_keymap[] = { |
132 | /* Sleep already handled via generic ACPI code */ | 134 | { KE_KEY, 0x10, { KEY_WLAN } }, |
133 | {KE_KEY, 0x10, KEY_WLAN }, | 135 | { KE_KEY, 0x11, { KEY_WLAN } }, |
134 | {KE_KEY, 0x11, KEY_WLAN }, | 136 | { KE_KEY, 0x12, { KEY_PROG1 } }, |
135 | {KE_KEY, 0x12, KEY_PROG1 }, | 137 | { KE_KEY, 0x13, { KEY_MUTE } }, |
136 | {KE_KEY, 0x13, KEY_MUTE }, | 138 | { KE_KEY, 0x14, { KEY_VOLUMEDOWN } }, |
137 | {KE_KEY, 0x14, KEY_VOLUMEDOWN }, | 139 | { KE_KEY, 0x15, { KEY_VOLUMEUP } }, |
138 | {KE_KEY, 0x15, KEY_VOLUMEUP }, | 140 | { KE_KEY, 0x16, { KEY_DISPLAY_OFF } }, |
139 | {KE_KEY, 0x16, KEY_DISPLAY_OFF }, | 141 | { KE_KEY, 0x1a, { KEY_COFFEE } }, |
140 | {KE_KEY, 0x1a, KEY_COFFEE }, | 142 | { KE_KEY, 0x1b, { KEY_ZOOM } }, |
141 | {KE_KEY, 0x1b, KEY_ZOOM }, | 143 | { KE_KEY, 0x1c, { KEY_PROG2 } }, |
142 | {KE_KEY, 0x1c, KEY_PROG2 }, | 144 | { KE_KEY, 0x1d, { KEY_PROG3 } }, |
143 | {KE_KEY, 0x1d, KEY_PROG3 }, | 145 | { KE_KEY, NOTIFY_BRN_MIN, { KEY_BRIGHTNESSDOWN } }, |
144 | {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN }, | 146 | { KE_KEY, NOTIFY_BRN_MAX, { KEY_BRIGHTNESSUP } }, |
145 | {KE_KEY, NOTIFY_BRN_MAX, KEY_BRIGHTNESSUP }, | 147 | { KE_KEY, 0x30, { KEY_SWITCHVIDEOMODE } }, |
146 | {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, | 148 | { KE_KEY, 0x31, { KEY_SWITCHVIDEOMODE } }, |
147 | {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, | 149 | { KE_KEY, 0x32, { KEY_SWITCHVIDEOMODE } }, |
148 | {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, | 150 | { KE_KEY, 0x37, { KEY_F13 } }, /* Disable Touchpad */ |
149 | {KE_KEY, 0x37, KEY_F13 }, /* Disable Touchpad */ | 151 | { KE_KEY, 0x38, { KEY_F14 } }, |
150 | {KE_KEY, 0x38, KEY_F14 }, | 152 | { KE_END, 0 }, |
151 | {KE_END, 0}, | ||
152 | }; | 153 | }; |
153 | 154 | ||
154 | |||
155 | /* | 155 | /* |
156 | * This is the main structure, we can use it to store useful information | 156 | * This is the main structure, we can use it to store useful information |
157 | */ | 157 | */ |
@@ -159,6 +159,8 @@ struct eeepc_laptop { | |||
159 | acpi_handle handle; /* the handle of the acpi device */ | 159 | acpi_handle handle; /* the handle of the acpi device */ |
160 | u32 cm_supported; /* the control methods supported | 160 | u32 cm_supported; /* the control methods supported |
161 | by this BIOS */ | 161 | by this BIOS */ |
162 | bool cpufv_disabled; | ||
163 | bool hotplug_disabled; | ||
162 | u16 event_count[128]; /* count for each event */ | 164 | u16 event_count[128]; /* count for each event */ |
163 | 165 | ||
164 | struct platform_device *platform_device; | 166 | struct platform_device *platform_device; |
@@ -378,6 +380,8 @@ static ssize_t store_cpufv(struct device *dev, | |||
378 | struct eeepc_cpufv c; | 380 | struct eeepc_cpufv c; |
379 | int rv, value; | 381 | int rv, value; |
380 | 382 | ||
383 | if (eeepc->cpufv_disabled) | ||
384 | return -EPERM; | ||
381 | if (get_cpufv(eeepc, &c)) | 385 | if (get_cpufv(eeepc, &c)) |
382 | return -ENODEV; | 386 | return -ENODEV; |
383 | rv = parse_arg(buf, count, &value); | 387 | rv = parse_arg(buf, count, &value); |
@@ -389,6 +393,41 @@ static ssize_t store_cpufv(struct device *dev, | |||
389 | return rv; | 393 | return rv; |
390 | } | 394 | } |
391 | 395 | ||
396 | static ssize_t show_cpufv_disabled(struct device *dev, | ||
397 | struct device_attribute *attr, | ||
398 | char *buf) | ||
399 | { | ||
400 | struct eeepc_laptop *eeepc = dev_get_drvdata(dev); | ||
401 | |||
402 | return sprintf(buf, "%d\n", eeepc->cpufv_disabled); | ||
403 | } | ||
404 | |||
405 | static ssize_t store_cpufv_disabled(struct device *dev, | ||
406 | struct device_attribute *attr, | ||
407 | const char *buf, size_t count) | ||
408 | { | ||
409 | struct eeepc_laptop *eeepc = dev_get_drvdata(dev); | ||
410 | int rv, value; | ||
411 | |||
412 | rv = parse_arg(buf, count, &value); | ||
413 | if (rv < 0) | ||
414 | return rv; | ||
415 | |||
416 | switch (value) { | ||
417 | case 0: | ||
418 | if (eeepc->cpufv_disabled) | ||
419 | pr_warning("cpufv enabled (not officially supported " | ||
420 | "on this model)\n"); | ||
421 | eeepc->cpufv_disabled = false; | ||
422 | return rv; | ||
423 | case 1: | ||
424 | return -EPERM; | ||
425 | default: | ||
426 | return -EINVAL; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | |||
392 | static struct device_attribute dev_attr_cpufv = { | 431 | static struct device_attribute dev_attr_cpufv = { |
393 | .attr = { | 432 | .attr = { |
394 | .name = "cpufv", | 433 | .name = "cpufv", |
@@ -404,12 +443,22 @@ static struct device_attribute dev_attr_available_cpufv = { | |||
404 | .show = show_available_cpufv | 443 | .show = show_available_cpufv |
405 | }; | 444 | }; |
406 | 445 | ||
446 | static struct device_attribute dev_attr_cpufv_disabled = { | ||
447 | .attr = { | ||
448 | .name = "cpufv_disabled", | ||
449 | .mode = 0644 }, | ||
450 | .show = show_cpufv_disabled, | ||
451 | .store = store_cpufv_disabled | ||
452 | }; | ||
453 | |||
454 | |||
407 | static struct attribute *platform_attributes[] = { | 455 | static struct attribute *platform_attributes[] = { |
408 | &dev_attr_camera.attr, | 456 | &dev_attr_camera.attr, |
409 | &dev_attr_cardr.attr, | 457 | &dev_attr_cardr.attr, |
410 | &dev_attr_disp.attr, | 458 | &dev_attr_disp.attr, |
411 | &dev_attr_cpufv.attr, | 459 | &dev_attr_cpufv.attr, |
412 | &dev_attr_available_cpufv.attr, | 460 | &dev_attr_available_cpufv.attr, |
461 | &dev_attr_cpufv_disabled.attr, | ||
413 | NULL | 462 | NULL |
414 | }; | 463 | }; |
415 | 464 | ||
@@ -796,6 +845,9 @@ static int eeepc_rfkill_init(struct eeepc_laptop *eeepc) | |||
796 | if (result && result != -ENODEV) | 845 | if (result && result != -ENODEV) |
797 | goto exit; | 846 | goto exit; |
798 | 847 | ||
848 | if (eeepc->hotplug_disabled) | ||
849 | return 0; | ||
850 | |||
799 | result = eeepc_setup_pci_hotplug(eeepc); | 851 | result = eeepc_setup_pci_hotplug(eeepc); |
800 | /* | 852 | /* |
801 | * If we get -EBUSY then something else is handling the PCI hotplug - | 853 | * If we get -EBUSY then something else is handling the PCI hotplug - |
@@ -1090,120 +1142,42 @@ static void eeepc_backlight_exit(struct eeepc_laptop *eeepc) | |||
1090 | /* | 1142 | /* |
1091 | * Input device (i.e. hotkeys) | 1143 | * Input device (i.e. hotkeys) |
1092 | */ | 1144 | */ |
1093 | static struct key_entry *eeepc_get_entry_by_scancode( | 1145 | static int eeepc_input_init(struct eeepc_laptop *eeepc) |
1094 | struct eeepc_laptop *eeepc, | ||
1095 | int code) | ||
1096 | { | 1146 | { |
1097 | struct key_entry *key; | 1147 | struct input_dev *input; |
1148 | int error; | ||
1098 | 1149 | ||
1099 | for (key = eeepc->keymap; key->type != KE_END; key++) | 1150 | input = input_allocate_device(); |
1100 | if (code == key->code) | 1151 | if (!input) { |
1101 | return key; | 1152 | pr_info("Unable to allocate input device\n"); |
1102 | 1153 | return -ENOMEM; | |
1103 | return NULL; | ||
1104 | } | ||
1105 | |||
1106 | static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) | ||
1107 | { | ||
1108 | static struct key_entry *key; | ||
1109 | |||
1110 | key = eeepc_get_entry_by_scancode(eeepc, event); | ||
1111 | if (key) { | ||
1112 | switch (key->type) { | ||
1113 | case KE_KEY: | ||
1114 | input_report_key(eeepc->inputdev, key->keycode, | ||
1115 | 1); | ||
1116 | input_sync(eeepc->inputdev); | ||
1117 | input_report_key(eeepc->inputdev, key->keycode, | ||
1118 | 0); | ||
1119 | input_sync(eeepc->inputdev); | ||
1120 | break; | ||
1121 | } | ||
1122 | } | 1154 | } |
1123 | } | ||
1124 | |||
1125 | static struct key_entry *eeepc_get_entry_by_keycode( | ||
1126 | struct eeepc_laptop *eeepc, int code) | ||
1127 | { | ||
1128 | struct key_entry *key; | ||
1129 | |||
1130 | for (key = eeepc->keymap; key->type != KE_END; key++) | ||
1131 | if (code == key->keycode && key->type == KE_KEY) | ||
1132 | return key; | ||
1133 | 1155 | ||
1134 | return NULL; | 1156 | input->name = "Asus EeePC extra buttons"; |
1135 | } | 1157 | input->phys = EEEPC_LAPTOP_FILE "/input0"; |
1158 | input->id.bustype = BUS_HOST; | ||
1159 | input->dev.parent = &eeepc->platform_device->dev; | ||
1136 | 1160 | ||
1137 | static int eeepc_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 1161 | error = sparse_keymap_setup(input, eeepc_keymap, NULL); |
1138 | { | 1162 | if (error) { |
1139 | struct eeepc_laptop *eeepc = input_get_drvdata(dev); | 1163 | pr_err("Unable to setup input device keymap\n"); |
1140 | struct key_entry *key = eeepc_get_entry_by_scancode(eeepc, scancode); | 1164 | goto err_free_dev; |
1141 | |||
1142 | if (key && key->type == KE_KEY) { | ||
1143 | *keycode = key->keycode; | ||
1144 | return 0; | ||
1145 | } | 1165 | } |
1146 | 1166 | ||
1147 | return -EINVAL; | 1167 | error = input_register_device(input); |
1148 | } | 1168 | if (error) { |
1149 | 1169 | pr_err("Unable to register input device\n"); | |
1150 | static int eeepc_setkeycode(struct input_dev *dev, int scancode, int keycode) | 1170 | goto err_free_keymap; |
1151 | { | ||
1152 | struct eeepc_laptop *eeepc = input_get_drvdata(dev); | ||
1153 | struct key_entry *key; | ||
1154 | int old_keycode; | ||
1155 | |||
1156 | if (keycode < 0 || keycode > KEY_MAX) | ||
1157 | return -EINVAL; | ||
1158 | |||
1159 | key = eeepc_get_entry_by_scancode(eeepc, scancode); | ||
1160 | if (key && key->type == KE_KEY) { | ||
1161 | old_keycode = key->keycode; | ||
1162 | key->keycode = keycode; | ||
1163 | set_bit(keycode, dev->keybit); | ||
1164 | if (!eeepc_get_entry_by_keycode(eeepc, old_keycode)) | ||
1165 | clear_bit(old_keycode, dev->keybit); | ||
1166 | return 0; | ||
1167 | } | 1171 | } |
1168 | 1172 | ||
1169 | return -EINVAL; | 1173 | eeepc->inputdev = input; |
1170 | } | ||
1171 | |||
1172 | static int eeepc_input_init(struct eeepc_laptop *eeepc) | ||
1173 | { | ||
1174 | const struct key_entry *key; | ||
1175 | int result; | ||
1176 | |||
1177 | eeepc->inputdev = input_allocate_device(); | ||
1178 | if (!eeepc->inputdev) { | ||
1179 | pr_info("Unable to allocate input device\n"); | ||
1180 | return -ENOMEM; | ||
1181 | } | ||
1182 | eeepc->inputdev->name = "Asus EeePC extra buttons"; | ||
1183 | eeepc->inputdev->dev.parent = &eeepc->platform_device->dev; | ||
1184 | eeepc->inputdev->phys = EEEPC_LAPTOP_FILE "/input0"; | ||
1185 | eeepc->inputdev->id.bustype = BUS_HOST; | ||
1186 | eeepc->inputdev->getkeycode = eeepc_getkeycode; | ||
1187 | eeepc->inputdev->setkeycode = eeepc_setkeycode; | ||
1188 | input_set_drvdata(eeepc->inputdev, eeepc); | ||
1189 | |||
1190 | eeepc->keymap = kmemdup(eeepc_keymap, sizeof(eeepc_keymap), | ||
1191 | GFP_KERNEL); | ||
1192 | for (key = eeepc_keymap; key->type != KE_END; key++) { | ||
1193 | switch (key->type) { | ||
1194 | case KE_KEY: | ||
1195 | set_bit(EV_KEY, eeepc->inputdev->evbit); | ||
1196 | set_bit(key->keycode, eeepc->inputdev->keybit); | ||
1197 | break; | ||
1198 | } | ||
1199 | } | ||
1200 | result = input_register_device(eeepc->inputdev); | ||
1201 | if (result) { | ||
1202 | pr_info("Unable to register input device\n"); | ||
1203 | input_free_device(eeepc->inputdev); | ||
1204 | return result; | ||
1205 | } | ||
1206 | return 0; | 1174 | return 0; |
1175 | |||
1176 | err_free_keymap: | ||
1177 | sparse_keymap_free(input); | ||
1178 | err_free_dev: | ||
1179 | input_free_device(input); | ||
1180 | return error; | ||
1207 | } | 1181 | } |
1208 | 1182 | ||
1209 | static void eeepc_input_exit(struct eeepc_laptop *eeepc) | 1183 | static void eeepc_input_exit(struct eeepc_laptop *eeepc) |
@@ -1253,11 +1227,59 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event) | |||
1253 | * event will be desired value (or else ignored) | 1227 | * event will be desired value (or else ignored) |
1254 | */ | 1228 | */ |
1255 | } | 1229 | } |
1256 | eeepc_input_notify(eeepc, event); | 1230 | sparse_keymap_report_event(eeepc->inputdev, event, |
1231 | 1, true); | ||
1257 | } | 1232 | } |
1258 | } else { | 1233 | } else { |
1259 | /* Everything else is a bona-fide keypress event */ | 1234 | /* Everything else is a bona-fide keypress event */ |
1260 | eeepc_input_notify(eeepc, event); | 1235 | sparse_keymap_report_event(eeepc->inputdev, event, 1, true); |
1236 | } | ||
1237 | } | ||
1238 | |||
1239 | static void eeepc_dmi_check(struct eeepc_laptop *eeepc) | ||
1240 | { | ||
1241 | const char *model; | ||
1242 | |||
1243 | model = dmi_get_system_info(DMI_PRODUCT_NAME); | ||
1244 | if (!model) | ||
1245 | return; | ||
1246 | |||
1247 | /* | ||
1248 | * Blacklist for setting cpufv (cpu speed). | ||
1249 | * | ||
1250 | * EeePC 4G ("701") implements CFVS, but it is not supported | ||
1251 | * by the pre-installed OS, and the original option to change it | ||
1252 | * in the BIOS setup screen was removed in later versions. | ||
1253 | * | ||
1254 | * Judging by the lack of "Super Hybrid Engine" on Asus product pages, | ||
1255 | * this applies to all "701" models (4G/4G Surf/2G Surf). | ||
1256 | * | ||
1257 | * So Asus made a deliberate decision not to support it on this model. | ||
1258 | * We have several reports that using it can cause the system to hang | ||
1259 | * | ||
1260 | * The hang has also been reported on a "702" (Model name "8G"?). | ||
1261 | * | ||
1262 | * We avoid dmi_check_system() / dmi_match(), because they use | ||
1263 | * substring matching. We don't want to affect the "701SD" | ||
1264 | * and "701SDX" models, because they do support S.H.E. | ||
1265 | */ | ||
1266 | if (strcmp(model, "701") == 0 || strcmp(model, "702") == 0) { | ||
1267 | eeepc->cpufv_disabled = true; | ||
1268 | pr_info("model %s does not officially support setting cpu " | ||
1269 | "speed\n", model); | ||
1270 | pr_info("cpufv disabled to avoid instability\n"); | ||
1271 | } | ||
1272 | |||
1273 | /* | ||
1274 | * Blacklist for wlan hotplug | ||
1275 | * | ||
1276 | * Eeepc 1005HA doesn't work like others models and don't need the | ||
1277 | * hotplug code. In fact, current hotplug code seems to unplug another | ||
1278 | * device... | ||
1279 | */ | ||
1280 | if (strcmp(model, "1005HA") == 0 || strcmp(model, "1201N") == 0) { | ||
1281 | eeepc->hotplug_disabled = true; | ||
1282 | pr_info("wlan hotplug disabled\n"); | ||
1261 | } | 1283 | } |
1262 | } | 1284 | } |
1263 | 1285 | ||
@@ -1342,6 +1364,10 @@ static int __devinit eeepc_acpi_add(struct acpi_device *device) | |||
1342 | strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS); | 1364 | strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS); |
1343 | device->driver_data = eeepc; | 1365 | device->driver_data = eeepc; |
1344 | 1366 | ||
1367 | eeepc->hotplug_disabled = hotplug_disabled; | ||
1368 | |||
1369 | eeepc_dmi_check(eeepc); | ||
1370 | |||
1345 | result = eeepc_acpi_init(eeepc, device); | 1371 | result = eeepc_acpi_init(eeepc, device); |
1346 | if (result) | 1372 | if (result) |
1347 | goto fail_platform; | 1373 | goto fail_platform; |
@@ -1452,10 +1478,12 @@ static int __init eeepc_laptop_init(void) | |||
1452 | result = acpi_bus_register_driver(&eeepc_acpi_driver); | 1478 | result = acpi_bus_register_driver(&eeepc_acpi_driver); |
1453 | if (result < 0) | 1479 | if (result < 0) |
1454 | goto fail_acpi_driver; | 1480 | goto fail_acpi_driver; |
1481 | |||
1455 | if (!eeepc_device_present) { | 1482 | if (!eeepc_device_present) { |
1456 | result = -ENODEV; | 1483 | result = -ENODEV; |
1457 | goto fail_no_device; | 1484 | goto fail_no_device; |
1458 | } | 1485 | } |
1486 | |||
1459 | return 0; | 1487 | return 0; |
1460 | 1488 | ||
1461 | fail_no_device: | 1489 | fail_no_device: |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 5af53340da6f..3f71a605a492 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -1201,9 +1201,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device) | |||
1201 | /* the buffer is filled with magic numbers describing the devices | 1201 | /* the buffer is filled with magic numbers describing the devices |
1202 | * available, 0xff terminates the enumeration | 1202 | * available, 0xff terminates the enumeration |
1203 | */ | 1203 | */ |
1204 | while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff && | 1204 | for (i = 0; i < device_enum->buffer.length; i++) { |
1205 | i < device_enum->buffer.length) { | 1205 | |
1206 | i++; | 1206 | dev_code = *(device_enum->buffer.pointer + i); |
1207 | if (dev_code == 0xff) | ||
1208 | break; | ||
1209 | |||
1207 | dprintk("Radio devices, looking at 0x%.2x\n", dev_code); | 1210 | dprintk("Radio devices, looking at 0x%.2x\n", dev_code); |
1208 | 1211 | ||
1209 | if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI]) | 1212 | if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI]) |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 96f11715cd26..355dffcc23b0 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -494,7 +494,7 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, | |||
494 | return 0; | 494 | return 0; |
495 | /* allocate 2^1 pages = 8K (on i386); | 495 | /* allocate 2^1 pages = 8K (on i386); |
496 | * should be more than enough for one device */ | 496 | * should be more than enough for one device */ |
497 | pages_start = (char *)__get_free_pages(GFP_KERNEL, 1); | 497 | pages_start = (char *)__get_free_pages(GFP_NOIO, 1); |
498 | if (!pages_start) | 498 | if (!pages_start) |
499 | return -ENOMEM; | 499 | return -ENOMEM; |
500 | 500 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 0495fa651225..80995ef0868c 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1684,6 +1684,24 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev, | |||
1684 | } | 1684 | } |
1685 | } | 1685 | } |
1686 | if (cur_alt && new_alt) { | 1686 | if (cur_alt && new_alt) { |
1687 | struct usb_interface *iface = usb_ifnum_to_if(udev, | ||
1688 | cur_alt->desc.bInterfaceNumber); | ||
1689 | |||
1690 | if (iface->resetting_device) { | ||
1691 | /* | ||
1692 | * The USB core just reset the device, so the xHCI host | ||
1693 | * and the device will think alt setting 0 is installed. | ||
1694 | * However, the USB core will pass in the alternate | ||
1695 | * setting installed before the reset as cur_alt. Dig | ||
1696 | * out the alternate setting 0 structure, or the first | ||
1697 | * alternate setting if a broken device doesn't have alt | ||
1698 | * setting 0. | ||
1699 | */ | ||
1700 | cur_alt = usb_altnum_to_altsetting(iface, 0); | ||
1701 | if (!cur_alt) | ||
1702 | cur_alt = &iface->altsetting[0]; | ||
1703 | } | ||
1704 | |||
1687 | /* Drop all the endpoints in the current alt setting */ | 1705 | /* Drop all the endpoints in the current alt setting */ |
1688 | for (i = 0; i < cur_alt->desc.bNumEndpoints; i++) { | 1706 | for (i = 0; i < cur_alt->desc.bNumEndpoints; i++) { |
1689 | ret = hcd->driver->drop_endpoint(hcd, udev, | 1707 | ret = hcd->driver->drop_endpoint(hcd, udev, |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 0cec6caf6e9b..35cc8b9ba1f5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -3347,6 +3347,9 @@ static void hub_events(void) | |||
3347 | USB_PORT_FEAT_C_SUSPEND); | 3347 | USB_PORT_FEAT_C_SUSPEND); |
3348 | udev = hdev->children[i-1]; | 3348 | udev = hdev->children[i-1]; |
3349 | if (udev) { | 3349 | if (udev) { |
3350 | /* TRSMRCY = 10 msec */ | ||
3351 | msleep(10); | ||
3352 | |||
3350 | usb_lock_device(udev); | 3353 | usb_lock_device(udev); |
3351 | ret = remote_wakeup(hdev-> | 3354 | ret = remote_wakeup(hdev-> |
3352 | children[i-1]); | 3355 | children[i-1]); |
@@ -3692,19 +3695,14 @@ static int usb_reset_and_verify_device(struct usb_device *udev) | |||
3692 | usb_enable_interface(udev, intf, true); | 3695 | usb_enable_interface(udev, intf, true); |
3693 | ret = 0; | 3696 | ret = 0; |
3694 | } else { | 3697 | } else { |
3695 | /* We've just reset the device, so it will think alt | 3698 | /* Let the bandwidth allocation function know that this |
3696 | * setting 0 is installed. For usb_set_interface() to | 3699 | * device has been reset, and it will have to use |
3697 | * work properly, we need to set the current alternate | 3700 | * alternate setting 0 as the current alternate setting. |
3698 | * interface setting to 0 (or the first alt setting, if | ||
3699 | * the device doesn't have alt setting 0). | ||
3700 | */ | 3701 | */ |
3701 | intf->cur_altsetting = | 3702 | intf->resetting_device = 1; |
3702 | usb_find_alt_setting(config, i, 0); | ||
3703 | if (!intf->cur_altsetting) | ||
3704 | intf->cur_altsetting = | ||
3705 | &config->intf_cache[i]->altsetting[0]; | ||
3706 | ret = usb_set_interface(udev, desc->bInterfaceNumber, | 3703 | ret = usb_set_interface(udev, desc->bInterfaceNumber, |
3707 | desc->bAlternateSetting); | 3704 | desc->bAlternateSetting); |
3705 | intf->resetting_device = 0; | ||
3708 | } | 3706 | } |
3709 | if (ret < 0) { | 3707 | if (ret < 0) { |
3710 | dev_err(&udev->dev, "failed to restore interface %d " | 3708 | dev_err(&udev->dev, "failed to restore interface %d " |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 1b994846e8e0..9bc95fec793f 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -906,11 +906,11 @@ char *usb_cache_string(struct usb_device *udev, int index) | |||
906 | if (index <= 0) | 906 | if (index <= 0) |
907 | return NULL; | 907 | return NULL; |
908 | 908 | ||
909 | buf = kmalloc(MAX_USB_STRING_SIZE, GFP_KERNEL); | 909 | buf = kmalloc(MAX_USB_STRING_SIZE, GFP_NOIO); |
910 | if (buf) { | 910 | if (buf) { |
911 | len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE); | 911 | len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE); |
912 | if (len > 0) { | 912 | if (len > 0) { |
913 | smallbuf = kmalloc(++len, GFP_KERNEL); | 913 | smallbuf = kmalloc(++len, GFP_NOIO); |
914 | if (!smallbuf) | 914 | if (!smallbuf) |
915 | return buf; | 915 | return buf; |
916 | memcpy(smallbuf, buf, len); | 916 | memcpy(smallbuf, buf, len); |
@@ -1731,7 +1731,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) | |||
1731 | if (cp) { | 1731 | if (cp) { |
1732 | nintf = cp->desc.bNumInterfaces; | 1732 | nintf = cp->desc.bNumInterfaces; |
1733 | new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), | 1733 | new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), |
1734 | GFP_KERNEL); | 1734 | GFP_NOIO); |
1735 | if (!new_interfaces) { | 1735 | if (!new_interfaces) { |
1736 | dev_err(&dev->dev, "Out of memory\n"); | 1736 | dev_err(&dev->dev, "Out of memory\n"); |
1737 | return -ENOMEM; | 1737 | return -ENOMEM; |
@@ -1740,7 +1740,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) | |||
1740 | for (; n < nintf; ++n) { | 1740 | for (; n < nintf; ++n) { |
1741 | new_interfaces[n] = kzalloc( | 1741 | new_interfaces[n] = kzalloc( |
1742 | sizeof(struct usb_interface), | 1742 | sizeof(struct usb_interface), |
1743 | GFP_KERNEL); | 1743 | GFP_NOIO); |
1744 | if (!new_interfaces[n]) { | 1744 | if (!new_interfaces[n]) { |
1745 | dev_err(&dev->dev, "Out of memory\n"); | 1745 | dev_err(&dev->dev, "Out of memory\n"); |
1746 | ret = -ENOMEM; | 1746 | ret = -ENOMEM; |
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 485edf937f25..5f3908f6e2dc 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -115,6 +115,12 @@ show_speed(struct device *dev, struct device_attribute *attr, char *buf) | |||
115 | case USB_SPEED_HIGH: | 115 | case USB_SPEED_HIGH: |
116 | speed = "480"; | 116 | speed = "480"; |
117 | break; | 117 | break; |
118 | case USB_SPEED_VARIABLE: | ||
119 | speed = "480"; | ||
120 | break; | ||
121 | case USB_SPEED_SUPER: | ||
122 | speed = "5000"; | ||
123 | break; | ||
118 | default: | 124 | default: |
119 | speed = "unknown"; | 125 | speed = "unknown"; |
120 | } | 126 | } |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 5859522d6edd..1ec3857f22e6 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -787,9 +787,10 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
787 | 787 | ||
788 | /* start 20 msec resume signaling from this port, | 788 | /* start 20 msec resume signaling from this port, |
789 | * and make khubd collect PORT_STAT_C_SUSPEND to | 789 | * and make khubd collect PORT_STAT_C_SUSPEND to |
790 | * stop that signaling. | 790 | * stop that signaling. Use 5 ms extra for safety, |
791 | * like usb_port_resume() does. | ||
791 | */ | 792 | */ |
792 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 793 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
793 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 794 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
794 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 795 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
795 | } | 796 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 2c6571c05f35..c75d9270c752 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -120,9 +120,26 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
120 | del_timer_sync(&ehci->watchdog); | 120 | del_timer_sync(&ehci->watchdog); |
121 | del_timer_sync(&ehci->iaa_watchdog); | 121 | del_timer_sync(&ehci->iaa_watchdog); |
122 | 122 | ||
123 | port = HCS_N_PORTS (ehci->hcs_params); | ||
124 | spin_lock_irq (&ehci->lock); | 123 | spin_lock_irq (&ehci->lock); |
125 | 124 | ||
125 | /* Once the controller is stopped, port resumes that are already | ||
126 | * in progress won't complete. Hence if remote wakeup is enabled | ||
127 | * for the root hub and any ports are in the middle of a resume or | ||
128 | * remote wakeup, we must fail the suspend. | ||
129 | */ | ||
130 | if (hcd->self.root_hub->do_remote_wakeup) { | ||
131 | port = HCS_N_PORTS(ehci->hcs_params); | ||
132 | while (port--) { | ||
133 | if (ehci->reset_done[port] != 0) { | ||
134 | spin_unlock_irq(&ehci->lock); | ||
135 | ehci_dbg(ehci, "suspend failed because " | ||
136 | "port %d is resuming\n", | ||
137 | port + 1); | ||
138 | return -EBUSY; | ||
139 | } | ||
140 | } | ||
141 | } | ||
142 | |||
126 | /* stop schedules, clean any completed work */ | 143 | /* stop schedules, clean any completed work */ |
127 | if (HC_IS_RUNNING(hcd->state)) { | 144 | if (HC_IS_RUNNING(hcd->state)) { |
128 | ehci_quiesce (ehci); | 145 | ehci_quiesce (ehci); |
@@ -138,6 +155,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
138 | */ | 155 | */ |
139 | ehci->bus_suspended = 0; | 156 | ehci->bus_suspended = 0; |
140 | ehci->owned_ports = 0; | 157 | ehci->owned_ports = 0; |
158 | port = HCS_N_PORTS(ehci->hcs_params); | ||
141 | while (port--) { | 159 | while (port--) { |
142 | u32 __iomem *reg = &ehci->regs->port_status [port]; | 160 | u32 __iomem *reg = &ehci->regs->port_status [port]; |
143 | u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; | 161 | u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index a427d3b00634..89521775c567 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -849,9 +849,10 @@ qh_make ( | |||
849 | * But interval 1 scheduling is simpler, and | 849 | * But interval 1 scheduling is simpler, and |
850 | * includes high bandwidth. | 850 | * includes high bandwidth. |
851 | */ | 851 | */ |
852 | dbg ("intr period %d uframes, NYET!", | 852 | urb->interval = 1; |
853 | urb->interval); | 853 | } else if (qh->period > ehci->periodic_size) { |
854 | goto done; | 854 | qh->period = ehci->periodic_size; |
855 | urb->interval = qh->period << 3; | ||
855 | } | 856 | } |
856 | } else { | 857 | } else { |
857 | int think_time; | 858 | int think_time; |
@@ -874,6 +875,10 @@ qh_make ( | |||
874 | usb_calc_bus_time (urb->dev->speed, | 875 | usb_calc_bus_time (urb->dev->speed, |
875 | is_input, 0, max_packet (maxp))); | 876 | is_input, 0, max_packet (maxp))); |
876 | qh->period = urb->interval; | 877 | qh->period = urb->interval; |
878 | if (qh->period > ehci->periodic_size) { | ||
879 | qh->period = ehci->periodic_size; | ||
880 | urb->interval = qh->period; | ||
881 | } | ||
877 | } | 882 | } |
878 | } | 883 | } |
879 | 884 | ||
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c index 0951818ef93b..78e7c3cfcb72 100644 --- a/drivers/usb/host/fhci-hcd.c +++ b/drivers/usb/host/fhci-hcd.c | |||
@@ -242,9 +242,10 @@ err: | |||
242 | static void fhci_usb_free(void *lld) | 242 | static void fhci_usb_free(void *lld) |
243 | { | 243 | { |
244 | struct fhci_usb *usb = lld; | 244 | struct fhci_usb *usb = lld; |
245 | struct fhci_hcd *fhci = usb->fhci; | 245 | struct fhci_hcd *fhci; |
246 | 246 | ||
247 | if (usb) { | 247 | if (usb) { |
248 | fhci = usb->fhci; | ||
248 | fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF); | 249 | fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF); |
249 | fhci_ep0_free(usb); | 250 | fhci_ep0_free(usb); |
250 | kfree(usb->actual_frame); | 251 | kfree(usb->actual_frame); |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 73352f3739b5..42971657fde2 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
@@ -2270,10 +2270,10 @@ static int isp1362_mem_config(struct usb_hcd *hcd) | |||
2270 | dev_info(hcd->self.controller, "ISP1362 Memory usage:\n"); | 2270 | dev_info(hcd->self.controller, "ISP1362 Memory usage:\n"); |
2271 | dev_info(hcd->self.controller, " ISTL: 2 * %4d: %4d @ $%04x:$%04x\n", | 2271 | dev_info(hcd->self.controller, " ISTL: 2 * %4d: %4d @ $%04x:$%04x\n", |
2272 | istl_size / 2, istl_size, 0, istl_size / 2); | 2272 | istl_size / 2, istl_size, 0, istl_size / 2); |
2273 | dev_info(hcd->self.controller, " INTL: %4d * (%3lu+8): %4d @ $%04x\n", | 2273 | dev_info(hcd->self.controller, " INTL: %4d * (%3zu+8): %4d @ $%04x\n", |
2274 | ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE, | 2274 | ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE, |
2275 | intl_size, istl_size); | 2275 | intl_size, istl_size); |
2276 | dev_info(hcd->self.controller, " ATL : %4d * (%3lu+8): %4d @ $%04x\n", | 2276 | dev_info(hcd->self.controller, " ATL : %4d * (%3zu+8): %4d @ $%04x\n", |
2277 | atl_buffers, atl_blksize - PTD_HEADER_SIZE, | 2277 | atl_buffers, atl_blksize - PTD_HEADER_SIZE, |
2278 | atl_size, istl_size + intl_size); | 2278 | atl_size, istl_size + intl_size); |
2279 | dev_info(hcd->self.controller, " USED/FREE: %4d %4d\n", total, | 2279 | dev_info(hcd->self.controller, " USED/FREE: %4d %4d\n", total, |
@@ -2697,6 +2697,8 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
2697 | void __iomem *data_reg; | 2697 | void __iomem *data_reg; |
2698 | int irq; | 2698 | int irq; |
2699 | int retval = 0; | 2699 | int retval = 0; |
2700 | struct resource *irq_res; | ||
2701 | unsigned int irq_flags = 0; | ||
2700 | 2702 | ||
2701 | /* basic sanity checks first. board-specific init logic should | 2703 | /* basic sanity checks first. board-specific init logic should |
2702 | * have initialized this the three resources and probably board | 2704 | * have initialized this the three resources and probably board |
@@ -2710,11 +2712,12 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
2710 | 2712 | ||
2711 | data = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2713 | data = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2712 | addr = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 2714 | addr = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
2713 | irq = platform_get_irq(pdev, 0); | 2715 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
2714 | if (!addr || !data || irq < 0) { | 2716 | if (!addr || !data || !irq_res) { |
2715 | retval = -ENODEV; | 2717 | retval = -ENODEV; |
2716 | goto err1; | 2718 | goto err1; |
2717 | } | 2719 | } |
2720 | irq = irq_res->start; | ||
2718 | 2721 | ||
2719 | #ifdef CONFIG_USB_HCD_DMA | 2722 | #ifdef CONFIG_USB_HCD_DMA |
2720 | if (pdev->dev.dma_mask) { | 2723 | if (pdev->dev.dma_mask) { |
@@ -2781,12 +2784,16 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
2781 | } | 2784 | } |
2782 | #endif | 2785 | #endif |
2783 | 2786 | ||
2784 | #ifdef CONFIG_ARM | 2787 | if (irq_res->flags & IORESOURCE_IRQ_HIGHEDGE) |
2785 | if (isp1362_hcd->board) | 2788 | irq_flags |= IRQF_TRIGGER_RISING; |
2786 | set_irq_type(irq, isp1362_hcd->board->int_act_high ? IRQT_RISING : IRQT_FALLING); | 2789 | if (irq_res->flags & IORESOURCE_IRQ_LOWEDGE) |
2787 | #endif | 2790 | irq_flags |= IRQF_TRIGGER_FALLING; |
2791 | if (irq_res->flags & IORESOURCE_IRQ_HIGHLEVEL) | ||
2792 | irq_flags |= IRQF_TRIGGER_HIGH; | ||
2793 | if (irq_res->flags & IORESOURCE_IRQ_LOWLEVEL) | ||
2794 | irq_flags |= IRQF_TRIGGER_LOW; | ||
2788 | 2795 | ||
2789 | retval = usb_add_hcd(hcd, irq, IRQF_TRIGGER_LOW | IRQF_DISABLED | IRQF_SHARED); | 2796 | retval = usb_add_hcd(hcd, irq, irq_flags | IRQF_DISABLED | IRQF_SHARED); |
2790 | if (retval != 0) | 2797 | if (retval != 0) |
2791 | goto err6; | 2798 | goto err6; |
2792 | pr_info("%s, irq %d\n", hcd->product_desc, irq); | 2799 | pr_info("%s, irq %d\n", hcd->product_desc, irq); |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 9600a58299db..27b8f7cb4471 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -1039,12 +1039,12 @@ static void do_atl_int(struct usb_hcd *usb_hcd) | |||
1039 | if (!nakcount && (dw3 & DW3_QTD_ACTIVE)) { | 1039 | if (!nakcount && (dw3 & DW3_QTD_ACTIVE)) { |
1040 | u32 buffstatus; | 1040 | u32 buffstatus; |
1041 | 1041 | ||
1042 | /* XXX | 1042 | /* |
1043 | * NAKs are handled in HW by the chip. Usually if the | 1043 | * NAKs are handled in HW by the chip. Usually if the |
1044 | * device is not able to send data fast enough. | 1044 | * device is not able to send data fast enough. |
1045 | * This did not trigger for a long time now. | 1045 | * This happens mostly on slower hardware. |
1046 | */ | 1046 | */ |
1047 | printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: " | 1047 | printk(KERN_NOTICE "Reloading ptd %p/%p... qh %p read: " |
1048 | "%d of %zu done: %08x cur: %08x\n", qtd, | 1048 | "%d of %zu done: %08x cur: %08x\n", qtd, |
1049 | urb, qh, PTD_XFERRED_LENGTH(dw3), | 1049 | urb, qh, PTD_XFERRED_LENGTH(dw3), |
1050 | qtd->length, done_map, | 1050 | qtd->length, done_map, |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 5cd0e48f67fb..99cd00fd3514 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -749,7 +749,20 @@ static int uhci_rh_suspend(struct usb_hcd *hcd) | |||
749 | spin_lock_irq(&uhci->lock); | 749 | spin_lock_irq(&uhci->lock); |
750 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) | 750 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) |
751 | rc = -ESHUTDOWN; | 751 | rc = -ESHUTDOWN; |
752 | else if (!uhci->dead) | 752 | else if (uhci->dead) |
753 | ; /* Dead controllers tell no tales */ | ||
754 | |||
755 | /* Once the controller is stopped, port resumes that are already | ||
756 | * in progress won't complete. Hence if remote wakeup is enabled | ||
757 | * for the root hub and any ports are in the middle of a resume or | ||
758 | * remote wakeup, we must fail the suspend. | ||
759 | */ | ||
760 | else if (hcd->self.root_hub->do_remote_wakeup && | ||
761 | uhci->resuming_ports) { | ||
762 | dev_dbg(uhci_dev(uhci), "suspend failed because a port " | ||
763 | "is resuming\n"); | ||
764 | rc = -EBUSY; | ||
765 | } else | ||
753 | suspend_rh(uhci, UHCI_RH_SUSPENDED); | 766 | suspend_rh(uhci, UHCI_RH_SUSPENDED); |
754 | spin_unlock_irq(&uhci->lock); | 767 | spin_unlock_irq(&uhci->lock); |
755 | return rc; | 768 | return rc; |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 885b585360b9..8270055848ca 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -167,7 +167,7 @@ static void uhci_check_ports(struct uhci_hcd *uhci) | |||
167 | /* Port received a wakeup request */ | 167 | /* Port received a wakeup request */ |
168 | set_bit(port, &uhci->resuming_ports); | 168 | set_bit(port, &uhci->resuming_ports); |
169 | uhci->ports_timeout = jiffies + | 169 | uhci->ports_timeout = jiffies + |
170 | msecs_to_jiffies(20); | 170 | msecs_to_jiffies(25); |
171 | 171 | ||
172 | /* Make sure we see the port again | 172 | /* Make sure we see the port again |
173 | * after the resuming period is over. */ | 173 | * after the resuming period is over. */ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index f1ea3a33b6e6..83443d6306d6 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) | |||
386 | 386 | ||
387 | dbg("%s - port %d", __func__, port->number); | 387 | dbg("%s - port %d", __func__, port->number); |
388 | 388 | ||
389 | if (serial->type->max_in_flight_urbs) { | 389 | spin_lock_irqsave(&port->lock, flags); |
390 | spin_lock_irqsave(&port->lock, flags); | 390 | if (serial->type->max_in_flight_urbs) |
391 | chars = port->tx_bytes_flight; | 391 | chars = port->tx_bytes_flight; |
392 | spin_unlock_irqrestore(&port->lock, flags); | 392 | else if (serial->num_bulk_out) |
393 | } else if (serial->num_bulk_out) | ||
394 | chars = kfifo_len(&port->write_fifo); | 393 | chars = kfifo_len(&port->write_fifo); |
394 | spin_unlock_irqrestore(&port->lock, flags); | ||
395 | 395 | ||
396 | dbg("%s - returns %d", __func__, chars); | 396 | dbg("%s - returns %d", __func__, chars); |
397 | return chars; | 397 | return chars; |
@@ -489,6 +489,8 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) | |||
489 | dbg("%s - port %d", __func__, port->number); | 489 | dbg("%s - port %d", __func__, port->number); |
490 | 490 | ||
491 | if (port->serial->type->max_in_flight_urbs) { | 491 | if (port->serial->type->max_in_flight_urbs) { |
492 | kfree(urb->transfer_buffer); | ||
493 | |||
492 | spin_lock_irqsave(&port->lock, flags); | 494 | spin_lock_irqsave(&port->lock, flags); |
493 | --port->urbs_in_flight; | 495 | --port->urbs_in_flight; |
494 | port->tx_bytes_flight -= urb->transfer_buffer_length; | 496 | port->tx_bytes_flight -= urb->transfer_buffer_length; |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 64a0a2c27e12..c932f9053188 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1807,13 +1807,6 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | |||
1807 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1807 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1808 | US_FL_GO_SLOW ), | 1808 | US_FL_GO_SLOW ), |
1809 | 1809 | ||
1810 | /* Reported by Rohan Hart <rohan.hart17@gmail.com> */ | ||
1811 | UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010, | ||
1812 | "INTOVA", | ||
1813 | "Pixtreme", | ||
1814 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1815 | US_FL_FIX_CAPACITY ), | ||
1816 | |||
1817 | /* Reported by Frederic Marchal <frederic.marchal@wowcompany.com> | 1810 | /* Reported by Frederic Marchal <frederic.marchal@wowcompany.com> |
1818 | * Mio Moov 330 | 1811 | * Mio Moov 330 |
1819 | */ | 1812 | */ |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 5a53d4f0dd11..e9f995486ec1 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -434,7 +434,8 @@ static void adjust_quirks(struct us_data *us) | |||
434 | u16 vid = le16_to_cpu(us->pusb_dev->descriptor.idVendor); | 434 | u16 vid = le16_to_cpu(us->pusb_dev->descriptor.idVendor); |
435 | u16 pid = le16_to_cpu(us->pusb_dev->descriptor.idProduct); | 435 | u16 pid = le16_to_cpu(us->pusb_dev->descriptor.idProduct); |
436 | unsigned f = 0; | 436 | unsigned f = 0; |
437 | unsigned int mask = (US_FL_SANE_SENSE | US_FL_FIX_CAPACITY | | 437 | unsigned int mask = (US_FL_SANE_SENSE | US_FL_BAD_SENSE | |
438 | US_FL_FIX_CAPACITY | | ||
438 | US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE | | 439 | US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE | |
439 | US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | | 440 | US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | |
440 | US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | | 441 | US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | |