diff options
Diffstat (limited to 'drivers')
55 files changed, 856 insertions, 625 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/ata/libata-eh.c b/drivers/ata/libata-eh.c index 0ea97c942ced..9f6cfac0f2cc 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2028,8 +2028,9 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
2028 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); | 2028 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); |
2029 | 2029 | ||
2030 | /* determine whether the command is worth retrying */ | 2030 | /* determine whether the command is worth retrying */ |
2031 | if (!(qc->err_mask & AC_ERR_INVALID) && | 2031 | if (qc->flags & ATA_QCFLAG_IO || |
2032 | ((qc->flags & ATA_QCFLAG_IO) || qc->err_mask != AC_ERR_DEV)) | 2032 | (!(qc->err_mask & AC_ERR_INVALID) && |
2033 | qc->err_mask != AC_ERR_DEV)) | ||
2033 | qc->flags |= ATA_QCFLAG_RETRY; | 2034 | qc->flags |= ATA_QCFLAG_RETRY; |
2034 | 2035 | ||
2035 | /* accumulate error info */ | 2036 | /* accumulate error info */ |
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 090dd4851301..42ae452b36b0 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
@@ -354,6 +354,7 @@ int __init devtmpfs_init(void) | |||
354 | { | 354 | { |
355 | int err; | 355 | int err; |
356 | struct vfsmount *mnt; | 356 | struct vfsmount *mnt; |
357 | char options[] = "mode=0755"; | ||
357 | 358 | ||
358 | err = register_filesystem(&dev_fs_type); | 359 | err = register_filesystem(&dev_fs_type); |
359 | if (err) { | 360 | if (err) { |
@@ -362,7 +363,7 @@ int __init devtmpfs_init(void) | |||
362 | return err; | 363 | return err; |
363 | } | 364 | } |
364 | 365 | ||
365 | mnt = kern_mount_data(&dev_fs_type, "mode=0755"); | 366 | mnt = kern_mount_data(&dev_fs_type, options); |
366 | if (IS_ERR(mnt)) { | 367 | if (IS_ERR(mnt)) { |
367 | err = PTR_ERR(mnt); | 368 | err = PTR_ERR(mnt); |
368 | printk(KERN_ERR "devtmpfs: unable to create devtmpfs %i\n", err); | 369 | printk(KERN_ERR "devtmpfs: unable to create devtmpfs %i\n", err); |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index ae6b6c43cff9..bd025059711f 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -309,19 +309,17 @@ static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL); | |||
309 | * Block size attribute stuff | 309 | * Block size attribute stuff |
310 | */ | 310 | */ |
311 | static ssize_t | 311 | static ssize_t |
312 | print_block_size(struct sysdev_class *class, | 312 | print_block_size(struct class *class, char *buf) |
313 | struct sysdev_class_attribute *class_attr, | ||
314 | char *buf) | ||
315 | { | 313 | { |
316 | return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE); | 314 | return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE); |
317 | } | 315 | } |
318 | 316 | ||
319 | static SYSDEV_CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); | 317 | static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); |
320 | 318 | ||
321 | static int block_size_init(void) | 319 | static int block_size_init(void) |
322 | { | 320 | { |
323 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, | 321 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, |
324 | &attr_block_size_bytes.attr); | 322 | &class_attr_block_size_bytes.attr); |
325 | } | 323 | } |
326 | 324 | ||
327 | /* | 325 | /* |
@@ -332,9 +330,7 @@ static int block_size_init(void) | |||
332 | */ | 330 | */ |
333 | #ifdef CONFIG_ARCH_MEMORY_PROBE | 331 | #ifdef CONFIG_ARCH_MEMORY_PROBE |
334 | static ssize_t | 332 | static ssize_t |
335 | memory_probe_store(struct sysdev_class *class, | 333 | memory_probe_store(struct class *class, const char *buf, size_t count) |
336 | struct sysdev_class_attribute *class_attr, | ||
337 | const char *buf, size_t count) | ||
338 | { | 334 | { |
339 | u64 phys_addr; | 335 | u64 phys_addr; |
340 | int nid; | 336 | int nid; |
@@ -350,12 +346,12 @@ memory_probe_store(struct sysdev_class *class, | |||
350 | 346 | ||
351 | return count; | 347 | return count; |
352 | } | 348 | } |
353 | static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, memory_probe_store); | 349 | static CLASS_ATTR(probe, S_IWUSR, NULL, memory_probe_store); |
354 | 350 | ||
355 | static int memory_probe_init(void) | 351 | static int memory_probe_init(void) |
356 | { | 352 | { |
357 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, | 353 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, |
358 | &attr_probe.attr); | 354 | &class_attr_probe.attr); |
359 | } | 355 | } |
360 | #else | 356 | #else |
361 | static inline int memory_probe_init(void) | 357 | static inline int memory_probe_init(void) |
@@ -371,9 +367,7 @@ static inline int memory_probe_init(void) | |||
371 | 367 | ||
372 | /* Soft offline a page */ | 368 | /* Soft offline a page */ |
373 | static ssize_t | 369 | static ssize_t |
374 | store_soft_offline_page(struct sysdev_class *class, | 370 | store_soft_offline_page(struct class *class, const char *buf, size_t count) |
375 | struct sysdev_class_attribute *class_attr, | ||
376 | const char *buf, size_t count) | ||
377 | { | 371 | { |
378 | int ret; | 372 | int ret; |
379 | u64 pfn; | 373 | u64 pfn; |
@@ -390,9 +384,7 @@ store_soft_offline_page(struct sysdev_class *class, | |||
390 | 384 | ||
391 | /* Forcibly offline a page, including killing processes. */ | 385 | /* Forcibly offline a page, including killing processes. */ |
392 | static ssize_t | 386 | static ssize_t |
393 | store_hard_offline_page(struct sysdev_class *class, | 387 | store_hard_offline_page(struct class *class, const char *buf, size_t count) |
394 | struct sysdev_class_attribute *class_attr, | ||
395 | const char *buf, size_t count) | ||
396 | { | 388 | { |
397 | int ret; | 389 | int ret; |
398 | u64 pfn; | 390 | u64 pfn; |
@@ -405,18 +397,18 @@ store_hard_offline_page(struct sysdev_class *class, | |||
405 | return ret ? ret : count; | 397 | return ret ? ret : count; |
406 | } | 398 | } |
407 | 399 | ||
408 | static SYSDEV_CLASS_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page); | 400 | static CLASS_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page); |
409 | static SYSDEV_CLASS_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page); | 401 | static CLASS_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page); |
410 | 402 | ||
411 | static __init int memory_fail_init(void) | 403 | static __init int memory_fail_init(void) |
412 | { | 404 | { |
413 | int err; | 405 | int err; |
414 | 406 | ||
415 | err = sysfs_create_file(&memory_sysdev_class.kset.kobj, | 407 | err = sysfs_create_file(&memory_sysdev_class.kset.kobj, |
416 | &attr_soft_offline_page.attr); | 408 | &class_attr_soft_offline_page.attr); |
417 | if (!err) | 409 | if (!err) |
418 | err = sysfs_create_file(&memory_sysdev_class.kset.kobj, | 410 | err = sysfs_create_file(&memory_sysdev_class.kset.kobj, |
419 | &attr_hard_offline_page.attr); | 411 | &class_attr_hard_offline_page.attr); |
420 | return err; | 412 | return err; |
421 | } | 413 | } |
422 | #else | 414 | #else |
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/char/nozomi.c b/drivers/char/nozomi.c index 7d73cd430340..2ad7d37afbd0 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c | |||
@@ -1651,10 +1651,10 @@ static void ntty_close(struct tty_struct *tty, struct file *file) | |||
1651 | 1651 | ||
1652 | dc->open_ttys--; | 1652 | dc->open_ttys--; |
1653 | port->count--; | 1653 | port->count--; |
1654 | tty_port_tty_set(port, NULL); | ||
1655 | 1654 | ||
1656 | if (port->count == 0) { | 1655 | if (port->count == 0) { |
1657 | DBG1("close: %d", nport->token_dl); | 1656 | DBG1("close: %d", nport->token_dl); |
1657 | tty_port_tty_set(port, NULL); | ||
1658 | spin_lock_irqsave(&dc->spin_mutex, flags); | 1658 | spin_lock_irqsave(&dc->spin_mutex, flags); |
1659 | dc->last_ier &= ~(nport->token_dl); | 1659 | dc->last_ier &= ~(nport->token_dl); |
1660 | writew(dc->last_ier, dc->reg_ier); | 1660 | writew(dc->last_ier, dc->reg_ier); |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index f15df40bc318..c6f3b48be9dd 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1951,8 +1951,8 @@ static int tty_fasync(int fd, struct file *filp, int on) | |||
1951 | pid = task_pid(current); | 1951 | pid = task_pid(current); |
1952 | type = PIDTYPE_PID; | 1952 | type = PIDTYPE_PID; |
1953 | } | 1953 | } |
1954 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | ||
1955 | retval = __f_setown(filp, pid, type, 0); | 1954 | retval = __f_setown(filp, pid, type, 0); |
1955 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | ||
1956 | if (retval) | 1956 | if (retval) |
1957 | goto out; | 1957 | goto out; |
1958 | } else { | 1958 | } else { |
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 5d1c2603a130..2b0bd0b042d6 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c | |||
@@ -20,15 +20,15 @@ | |||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/i2c-pnx.h> | 21 | #include <linux/i2c-pnx.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/err.h> | ||
24 | #include <linux/clk.h> | ||
25 | |||
23 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
24 | #include <mach/i2c.h> | 27 | #include <mach/i2c.h> |
25 | #include <asm/irq.h> | ||
26 | #include <asm/uaccess.h> | ||
27 | 28 | ||
28 | #define I2C_PNX_TIMEOUT 10 /* msec */ | 29 | #define I2C_PNX_TIMEOUT 10 /* msec */ |
29 | #define I2C_PNX_SPEED_KHZ 100 | 30 | #define I2C_PNX_SPEED_KHZ 100 |
30 | #define I2C_PNX_REGION_SIZE 0x100 | 31 | #define I2C_PNX_REGION_SIZE 0x100 |
31 | #define PNX_DEFAULT_FREQ 13 /* MHz */ | ||
32 | 32 | ||
33 | static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data) | 33 | static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data) |
34 | { | 34 | { |
@@ -50,22 +50,21 @@ static inline int wait_reset(long timeout, struct i2c_pnx_algo_data *data) | |||
50 | return (timeout <= 0); | 50 | return (timeout <= 0); |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline void i2c_pnx_arm_timer(struct i2c_adapter *adap) | 53 | static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data) |
54 | { | 54 | { |
55 | struct i2c_pnx_algo_data *data = adap->algo_data; | 55 | struct timer_list *timer = &alg_data->mif.timer; |
56 | struct timer_list *timer = &data->mif.timer; | 56 | unsigned long expires = msecs_to_jiffies(I2C_PNX_TIMEOUT); |
57 | int expires = I2C_PNX_TIMEOUT / (1000 / HZ); | ||
58 | 57 | ||
59 | if (expires <= 1) | 58 | if (expires <= 1) |
60 | expires = 2; | 59 | expires = 2; |
61 | 60 | ||
62 | del_timer_sync(timer); | 61 | del_timer_sync(timer); |
63 | 62 | ||
64 | dev_dbg(&adap->dev, "Timer armed at %lu plus %u jiffies.\n", | 63 | dev_dbg(&alg_data->adapter.dev, "Timer armed at %lu plus %lu jiffies.\n", |
65 | jiffies, expires); | 64 | jiffies, expires); |
66 | 65 | ||
67 | timer->expires = jiffies + expires; | 66 | timer->expires = jiffies + expires; |
68 | timer->data = (unsigned long)adap; | 67 | timer->data = (unsigned long)&alg_data; |
69 | 68 | ||
70 | add_timer(timer); | 69 | add_timer(timer); |
71 | } | 70 | } |
@@ -77,34 +76,34 @@ static inline void i2c_pnx_arm_timer(struct i2c_adapter *adap) | |||
77 | * | 76 | * |
78 | * Generate a START signal in the desired mode. | 77 | * Generate a START signal in the desired mode. |
79 | */ | 78 | */ |
80 | static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | 79 | static int i2c_pnx_start(unsigned char slave_addr, |
80 | struct i2c_pnx_algo_data *alg_data) | ||
81 | { | 81 | { |
82 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 82 | dev_dbg(&alg_data->adapter.dev, "%s(): addr 0x%x mode %d\n", __func__, |
83 | |||
84 | dev_dbg(&adap->dev, "%s(): addr 0x%x mode %d\n", __func__, | ||
85 | slave_addr, alg_data->mif.mode); | 83 | slave_addr, alg_data->mif.mode); |
86 | 84 | ||
87 | /* Check for 7 bit slave addresses only */ | 85 | /* Check for 7 bit slave addresses only */ |
88 | if (slave_addr & ~0x7f) { | 86 | if (slave_addr & ~0x7f) { |
89 | dev_err(&adap->dev, "%s: Invalid slave address %x. " | 87 | dev_err(&alg_data->adapter.dev, |
90 | "Only 7-bit addresses are supported\n", | 88 | "%s: Invalid slave address %x. Only 7-bit addresses are supported\n", |
91 | adap->name, slave_addr); | 89 | alg_data->adapter.name, slave_addr); |
92 | return -EINVAL; | 90 | return -EINVAL; |
93 | } | 91 | } |
94 | 92 | ||
95 | /* First, make sure bus is idle */ | 93 | /* First, make sure bus is idle */ |
96 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) { | 94 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) { |
97 | /* Somebody else is monopolizing the bus */ | 95 | /* Somebody else is monopolizing the bus */ |
98 | dev_err(&adap->dev, "%s: Bus busy. Slave addr = %02x, " | 96 | dev_err(&alg_data->adapter.dev, |
99 | "cntrl = %x, stat = %x\n", | 97 | "%s: Bus busy. Slave addr = %02x, cntrl = %x, stat = %x\n", |
100 | adap->name, slave_addr, | 98 | alg_data->adapter.name, slave_addr, |
101 | ioread32(I2C_REG_CTL(alg_data)), | 99 | ioread32(I2C_REG_CTL(alg_data)), |
102 | ioread32(I2C_REG_STS(alg_data))); | 100 | ioread32(I2C_REG_STS(alg_data))); |
103 | return -EBUSY; | 101 | return -EBUSY; |
104 | } else if (ioread32(I2C_REG_STS(alg_data)) & mstatus_afi) { | 102 | } else if (ioread32(I2C_REG_STS(alg_data)) & mstatus_afi) { |
105 | /* Sorry, we lost the bus */ | 103 | /* Sorry, we lost the bus */ |
106 | dev_err(&adap->dev, "%s: Arbitration failure. " | 104 | dev_err(&alg_data->adapter.dev, |
107 | "Slave addr = %02x\n", adap->name, slave_addr); | 105 | "%s: Arbitration failure. Slave addr = %02x\n", |
106 | alg_data->adapter.name, slave_addr); | ||
108 | return -EIO; | 107 | return -EIO; |
109 | } | 108 | } |
110 | 109 | ||
@@ -115,14 +114,14 @@ static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | |||
115 | iowrite32(ioread32(I2C_REG_STS(alg_data)) | mstatus_tdi | mstatus_afi, | 114 | iowrite32(ioread32(I2C_REG_STS(alg_data)) | mstatus_tdi | mstatus_afi, |
116 | I2C_REG_STS(alg_data)); | 115 | I2C_REG_STS(alg_data)); |
117 | 116 | ||
118 | dev_dbg(&adap->dev, "%s(): sending %#x\n", __func__, | 117 | dev_dbg(&alg_data->adapter.dev, "%s(): sending %#x\n", __func__, |
119 | (slave_addr << 1) | start_bit | alg_data->mif.mode); | 118 | (slave_addr << 1) | start_bit | alg_data->mif.mode); |
120 | 119 | ||
121 | /* Write the slave address, START bit and R/W bit */ | 120 | /* Write the slave address, START bit and R/W bit */ |
122 | iowrite32((slave_addr << 1) | start_bit | alg_data->mif.mode, | 121 | iowrite32((slave_addr << 1) | start_bit | alg_data->mif.mode, |
123 | I2C_REG_TX(alg_data)); | 122 | I2C_REG_TX(alg_data)); |
124 | 123 | ||
125 | dev_dbg(&adap->dev, "%s(): exit\n", __func__); | 124 | dev_dbg(&alg_data->adapter.dev, "%s(): exit\n", __func__); |
126 | 125 | ||
127 | return 0; | 126 | return 0; |
128 | } | 127 | } |
@@ -133,13 +132,12 @@ static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | |||
133 | * | 132 | * |
134 | * Generate a STOP signal to terminate the master transaction. | 133 | * Generate a STOP signal to terminate the master transaction. |
135 | */ | 134 | */ |
136 | static void i2c_pnx_stop(struct i2c_adapter *adap) | 135 | static void i2c_pnx_stop(struct i2c_pnx_algo_data *alg_data) |
137 | { | 136 | { |
138 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
139 | /* Only 1 msec max timeout due to interrupt context */ | 137 | /* Only 1 msec max timeout due to interrupt context */ |
140 | long timeout = 1000; | 138 | long timeout = 1000; |
141 | 139 | ||
142 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 140 | dev_dbg(&alg_data->adapter.dev, "%s(): entering: stat = %04x.\n", |
143 | __func__, ioread32(I2C_REG_STS(alg_data))); | 141 | __func__, ioread32(I2C_REG_STS(alg_data))); |
144 | 142 | ||
145 | /* Write a STOP bit to TX FIFO */ | 143 | /* Write a STOP bit to TX FIFO */ |
@@ -153,7 +151,7 @@ static void i2c_pnx_stop(struct i2c_adapter *adap) | |||
153 | timeout--; | 151 | timeout--; |
154 | } | 152 | } |
155 | 153 | ||
156 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 154 | dev_dbg(&alg_data->adapter.dev, "%s(): exiting: stat = %04x.\n", |
157 | __func__, ioread32(I2C_REG_STS(alg_data))); | 155 | __func__, ioread32(I2C_REG_STS(alg_data))); |
158 | } | 156 | } |
159 | 157 | ||
@@ -163,12 +161,11 @@ static void i2c_pnx_stop(struct i2c_adapter *adap) | |||
163 | * | 161 | * |
164 | * Sends one byte of data to the slave | 162 | * Sends one byte of data to the slave |
165 | */ | 163 | */ |
166 | static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | 164 | static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data) |
167 | { | 165 | { |
168 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
169 | u32 val; | 166 | u32 val; |
170 | 167 | ||
171 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 168 | dev_dbg(&alg_data->adapter.dev, "%s(): entering: stat = %04x.\n", |
172 | __func__, ioread32(I2C_REG_STS(alg_data))); | 169 | __func__, ioread32(I2C_REG_STS(alg_data))); |
173 | 170 | ||
174 | if (alg_data->mif.len > 0) { | 171 | if (alg_data->mif.len > 0) { |
@@ -184,15 +181,15 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
184 | alg_data->mif.len--; | 181 | alg_data->mif.len--; |
185 | iowrite32(val, I2C_REG_TX(alg_data)); | 182 | iowrite32(val, I2C_REG_TX(alg_data)); |
186 | 183 | ||
187 | dev_dbg(&adap->dev, "%s(): xmit %#x [%d]\n", __func__, | 184 | dev_dbg(&alg_data->adapter.dev, "%s(): xmit %#x [%d]\n", |
188 | val, alg_data->mif.len + 1); | 185 | __func__, val, alg_data->mif.len + 1); |
189 | 186 | ||
190 | if (alg_data->mif.len == 0) { | 187 | if (alg_data->mif.len == 0) { |
191 | if (alg_data->last) { | 188 | if (alg_data->last) { |
192 | /* Wait until the STOP is seen. */ | 189 | /* Wait until the STOP is seen. */ |
193 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) | 190 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) |
194 | dev_err(&adap->dev, "The bus is still " | 191 | dev_err(&alg_data->adapter.dev, |
195 | "active after timeout\n"); | 192 | "The bus is still active after timeout\n"); |
196 | } | 193 | } |
197 | /* Disable master interrupts */ | 194 | /* Disable master interrupts */ |
198 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & | 195 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & |
@@ -201,14 +198,15 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
201 | 198 | ||
202 | del_timer_sync(&alg_data->mif.timer); | 199 | del_timer_sync(&alg_data->mif.timer); |
203 | 200 | ||
204 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine.\n", | 201 | dev_dbg(&alg_data->adapter.dev, |
202 | "%s(): Waking up xfer routine.\n", | ||
205 | __func__); | 203 | __func__); |
206 | 204 | ||
207 | complete(&alg_data->mif.complete); | 205 | complete(&alg_data->mif.complete); |
208 | } | 206 | } |
209 | } else if (alg_data->mif.len == 0) { | 207 | } else if (alg_data->mif.len == 0) { |
210 | /* zero-sized transfer */ | 208 | /* zero-sized transfer */ |
211 | i2c_pnx_stop(adap); | 209 | i2c_pnx_stop(alg_data); |
212 | 210 | ||
213 | /* Disable master interrupts. */ | 211 | /* Disable master interrupts. */ |
214 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & | 212 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & |
@@ -217,13 +215,14 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
217 | 215 | ||
218 | /* Stop timer. */ | 216 | /* Stop timer. */ |
219 | del_timer_sync(&alg_data->mif.timer); | 217 | del_timer_sync(&alg_data->mif.timer); |
220 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine after " | 218 | dev_dbg(&alg_data->adapter.dev, |
221 | "zero-xfer.\n", __func__); | 219 | "%s(): Waking up xfer routine after zero-xfer.\n", |
220 | __func__); | ||
222 | 221 | ||
223 | complete(&alg_data->mif.complete); | 222 | complete(&alg_data->mif.complete); |
224 | } | 223 | } |
225 | 224 | ||
226 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 225 | dev_dbg(&alg_data->adapter.dev, "%s(): exiting: stat = %04x.\n", |
227 | __func__, ioread32(I2C_REG_STS(alg_data))); | 226 | __func__, ioread32(I2C_REG_STS(alg_data))); |
228 | 227 | ||
229 | return 0; | 228 | return 0; |
@@ -235,21 +234,21 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
235 | * | 234 | * |
236 | * Reads one byte data from the slave | 235 | * Reads one byte data from the slave |
237 | */ | 236 | */ |
238 | static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | 237 | static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data) |
239 | { | 238 | { |
240 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
241 | unsigned int val = 0; | 239 | unsigned int val = 0; |
242 | u32 ctl = 0; | 240 | u32 ctl = 0; |
243 | 241 | ||
244 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 242 | dev_dbg(&alg_data->adapter.dev, "%s(): entering: stat = %04x.\n", |
245 | __func__, ioread32(I2C_REG_STS(alg_data))); | 243 | __func__, ioread32(I2C_REG_STS(alg_data))); |
246 | 244 | ||
247 | /* Check, whether there is already data, | 245 | /* Check, whether there is already data, |
248 | * or we didn't 'ask' for it yet. | 246 | * or we didn't 'ask' for it yet. |
249 | */ | 247 | */ |
250 | if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) { | 248 | if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) { |
251 | dev_dbg(&adap->dev, "%s(): Write dummy data to fill " | 249 | dev_dbg(&alg_data->adapter.dev, |
252 | "Rx-fifo...\n", __func__); | 250 | "%s(): Write dummy data to fill Rx-fifo...\n", |
251 | __func__); | ||
253 | 252 | ||
254 | if (alg_data->mif.len == 1) { | 253 | if (alg_data->mif.len == 1) { |
255 | /* Last byte, do not acknowledge next rcv. */ | 254 | /* Last byte, do not acknowledge next rcv. */ |
@@ -281,16 +280,16 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
281 | if (alg_data->mif.len > 0) { | 280 | if (alg_data->mif.len > 0) { |
282 | val = ioread32(I2C_REG_RX(alg_data)); | 281 | val = ioread32(I2C_REG_RX(alg_data)); |
283 | *alg_data->mif.buf++ = (u8) (val & 0xff); | 282 | *alg_data->mif.buf++ = (u8) (val & 0xff); |
284 | dev_dbg(&adap->dev, "%s(): rcv 0x%x [%d]\n", __func__, val, | 283 | dev_dbg(&alg_data->adapter.dev, "%s(): rcv 0x%x [%d]\n", |
285 | alg_data->mif.len); | 284 | __func__, val, alg_data->mif.len); |
286 | 285 | ||
287 | alg_data->mif.len--; | 286 | alg_data->mif.len--; |
288 | if (alg_data->mif.len == 0) { | 287 | if (alg_data->mif.len == 0) { |
289 | if (alg_data->last) | 288 | if (alg_data->last) |
290 | /* Wait until the STOP is seen. */ | 289 | /* Wait until the STOP is seen. */ |
291 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) | 290 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) |
292 | dev_err(&adap->dev, "The bus is still " | 291 | dev_err(&alg_data->adapter.dev, |
293 | "active after timeout\n"); | 292 | "The bus is still active after timeout\n"); |
294 | 293 | ||
295 | /* Disable master interrupts */ | 294 | /* Disable master interrupts */ |
296 | ctl = ioread32(I2C_REG_CTL(alg_data)); | 295 | ctl = ioread32(I2C_REG_CTL(alg_data)); |
@@ -304,7 +303,7 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
304 | } | 303 | } |
305 | } | 304 | } |
306 | 305 | ||
307 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 306 | dev_dbg(&alg_data->adapter.dev, "%s(): exiting: stat = %04x.\n", |
308 | __func__, ioread32(I2C_REG_STS(alg_data))); | 307 | __func__, ioread32(I2C_REG_STS(alg_data))); |
309 | 308 | ||
310 | return 0; | 309 | return 0; |
@@ -312,11 +311,11 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
312 | 311 | ||
313 | static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | 312 | static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) |
314 | { | 313 | { |
314 | struct i2c_pnx_algo_data *alg_data = dev_id; | ||
315 | u32 stat, ctl; | 315 | u32 stat, ctl; |
316 | struct i2c_adapter *adap = dev_id; | ||
317 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
318 | 316 | ||
319 | dev_dbg(&adap->dev, "%s(): mstat = %x mctrl = %x, mode = %d\n", | 317 | dev_dbg(&alg_data->adapter.dev, |
318 | "%s(): mstat = %x mctrl = %x, mode = %d\n", | ||
320 | __func__, | 319 | __func__, |
321 | ioread32(I2C_REG_STS(alg_data)), | 320 | ioread32(I2C_REG_STS(alg_data)), |
322 | ioread32(I2C_REG_CTL(alg_data)), | 321 | ioread32(I2C_REG_CTL(alg_data)), |
@@ -339,10 +338,10 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
339 | complete(&alg_data->mif.complete); | 338 | complete(&alg_data->mif.complete); |
340 | } else if (stat & mstatus_nai) { | 339 | } else if (stat & mstatus_nai) { |
341 | /* Slave did not acknowledge, generate a STOP */ | 340 | /* Slave did not acknowledge, generate a STOP */ |
342 | dev_dbg(&adap->dev, "%s(): " | 341 | dev_dbg(&alg_data->adapter.dev, |
343 | "Slave did not acknowledge, generating a STOP.\n", | 342 | "%s(): Slave did not acknowledge, generating a STOP.\n", |
344 | __func__); | 343 | __func__); |
345 | i2c_pnx_stop(adap); | 344 | i2c_pnx_stop(alg_data); |
346 | 345 | ||
347 | /* Disable master interrupts. */ | 346 | /* Disable master interrupts. */ |
348 | ctl = ioread32(I2C_REG_CTL(alg_data)); | 347 | ctl = ioread32(I2C_REG_CTL(alg_data)); |
@@ -368,9 +367,9 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
368 | */ | 367 | */ |
369 | if ((stat & mstatus_drmi) || !(stat & mstatus_rfe)) { | 368 | if ((stat & mstatus_drmi) || !(stat & mstatus_rfe)) { |
370 | if (alg_data->mif.mode == I2C_SMBUS_WRITE) { | 369 | if (alg_data->mif.mode == I2C_SMBUS_WRITE) { |
371 | i2c_pnx_master_xmit(adap); | 370 | i2c_pnx_master_xmit(alg_data); |
372 | } else if (alg_data->mif.mode == I2C_SMBUS_READ) { | 371 | } else if (alg_data->mif.mode == I2C_SMBUS_READ) { |
373 | i2c_pnx_master_rcv(adap); | 372 | i2c_pnx_master_rcv(alg_data); |
374 | } | 373 | } |
375 | } | 374 | } |
376 | } | 375 | } |
@@ -379,7 +378,8 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
379 | stat = ioread32(I2C_REG_STS(alg_data)); | 378 | stat = ioread32(I2C_REG_STS(alg_data)); |
380 | iowrite32(stat | mstatus_tdi | mstatus_afi, I2C_REG_STS(alg_data)); | 379 | iowrite32(stat | mstatus_tdi | mstatus_afi, I2C_REG_STS(alg_data)); |
381 | 380 | ||
382 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x ctrl = %x.\n", | 381 | dev_dbg(&alg_data->adapter.dev, |
382 | "%s(): exiting, stat = %x ctrl = %x.\n", | ||
383 | __func__, ioread32(I2C_REG_STS(alg_data)), | 383 | __func__, ioread32(I2C_REG_STS(alg_data)), |
384 | ioread32(I2C_REG_CTL(alg_data))); | 384 | ioread32(I2C_REG_CTL(alg_data))); |
385 | 385 | ||
@@ -388,14 +388,13 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
388 | 388 | ||
389 | static void i2c_pnx_timeout(unsigned long data) | 389 | static void i2c_pnx_timeout(unsigned long data) |
390 | { | 390 | { |
391 | struct i2c_adapter *adap = (struct i2c_adapter *)data; | 391 | struct i2c_pnx_algo_data *alg_data = (struct i2c_pnx_algo_data *)data; |
392 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
393 | u32 ctl; | 392 | u32 ctl; |
394 | 393 | ||
395 | dev_err(&adap->dev, "Master timed out. stat = %04x, cntrl = %04x. " | 394 | dev_err(&alg_data->adapter.dev, |
396 | "Resetting master...\n", | 395 | "Master timed out. stat = %04x, cntrl = %04x. Resetting master...\n", |
397 | ioread32(I2C_REG_STS(alg_data)), | 396 | ioread32(I2C_REG_STS(alg_data)), |
398 | ioread32(I2C_REG_CTL(alg_data))); | 397 | ioread32(I2C_REG_CTL(alg_data))); |
399 | 398 | ||
400 | /* Reset master and disable interrupts */ | 399 | /* Reset master and disable interrupts */ |
401 | ctl = ioread32(I2C_REG_CTL(alg_data)); | 400 | ctl = ioread32(I2C_REG_CTL(alg_data)); |
@@ -409,15 +408,14 @@ static void i2c_pnx_timeout(unsigned long data) | |||
409 | complete(&alg_data->mif.complete); | 408 | complete(&alg_data->mif.complete); |
410 | } | 409 | } |
411 | 410 | ||
412 | static inline void bus_reset_if_active(struct i2c_adapter *adap) | 411 | static inline void bus_reset_if_active(struct i2c_pnx_algo_data *alg_data) |
413 | { | 412 | { |
414 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
415 | u32 stat; | 413 | u32 stat; |
416 | 414 | ||
417 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_active) { | 415 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_active) { |
418 | dev_err(&adap->dev, | 416 | dev_err(&alg_data->adapter.dev, |
419 | "%s: Bus is still active after xfer. Reset it...\n", | 417 | "%s: Bus is still active after xfer. Reset it...\n", |
420 | adap->name); | 418 | alg_data->adapter.name); |
421 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, | 419 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, |
422 | I2C_REG_CTL(alg_data)); | 420 | I2C_REG_CTL(alg_data)); |
423 | wait_reset(I2C_PNX_TIMEOUT, alg_data); | 421 | wait_reset(I2C_PNX_TIMEOUT, alg_data); |
@@ -451,10 +449,11 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
451 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 449 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; |
452 | u32 stat = ioread32(I2C_REG_STS(alg_data)); | 450 | u32 stat = ioread32(I2C_REG_STS(alg_data)); |
453 | 451 | ||
454 | dev_dbg(&adap->dev, "%s(): entering: %d messages, stat = %04x.\n", | 452 | dev_dbg(&alg_data->adapter.dev, |
453 | "%s(): entering: %d messages, stat = %04x.\n", | ||
455 | __func__, num, ioread32(I2C_REG_STS(alg_data))); | 454 | __func__, num, ioread32(I2C_REG_STS(alg_data))); |
456 | 455 | ||
457 | bus_reset_if_active(adap); | 456 | bus_reset_if_active(alg_data); |
458 | 457 | ||
459 | /* Process transactions in a loop. */ | 458 | /* Process transactions in a loop. */ |
460 | for (i = 0; rc >= 0 && i < num; i++) { | 459 | for (i = 0; rc >= 0 && i < num; i++) { |
@@ -464,9 +463,9 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
464 | addr = pmsg->addr; | 463 | addr = pmsg->addr; |
465 | 464 | ||
466 | if (pmsg->flags & I2C_M_TEN) { | 465 | if (pmsg->flags & I2C_M_TEN) { |
467 | dev_err(&adap->dev, | 466 | dev_err(&alg_data->adapter.dev, |
468 | "%s: 10 bits addr not supported!\n", | 467 | "%s: 10 bits addr not supported!\n", |
469 | adap->name); | 468 | alg_data->adapter.name); |
470 | rc = -EINVAL; | 469 | rc = -EINVAL; |
471 | break; | 470 | break; |
472 | } | 471 | } |
@@ -478,11 +477,10 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
478 | alg_data->mif.ret = 0; | 477 | alg_data->mif.ret = 0; |
479 | alg_data->last = (i == num - 1); | 478 | alg_data->last = (i == num - 1); |
480 | 479 | ||
481 | dev_dbg(&adap->dev, "%s(): mode %d, %d bytes\n", __func__, | 480 | dev_dbg(&alg_data->adapter.dev, "%s(): mode %d, %d bytes\n", |
482 | alg_data->mif.mode, | 481 | __func__, alg_data->mif.mode, alg_data->mif.len); |
483 | alg_data->mif.len); | ||
484 | 482 | ||
485 | i2c_pnx_arm_timer(adap); | 483 | i2c_pnx_arm_timer(alg_data); |
486 | 484 | ||
487 | /* initialize the completion var */ | 485 | /* initialize the completion var */ |
488 | init_completion(&alg_data->mif.complete); | 486 | init_completion(&alg_data->mif.complete); |
@@ -493,7 +491,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
493 | I2C_REG_CTL(alg_data)); | 491 | I2C_REG_CTL(alg_data)); |
494 | 492 | ||
495 | /* Put start-code and slave-address on the bus. */ | 493 | /* Put start-code and slave-address on the bus. */ |
496 | rc = i2c_pnx_start(addr, adap); | 494 | rc = i2c_pnx_start(addr, alg_data); |
497 | if (rc < 0) | 495 | if (rc < 0) |
498 | break; | 496 | break; |
499 | 497 | ||
@@ -502,31 +500,32 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
502 | 500 | ||
503 | if (!(rc = alg_data->mif.ret)) | 501 | if (!(rc = alg_data->mif.ret)) |
504 | completed++; | 502 | completed++; |
505 | dev_dbg(&adap->dev, "%s(): Complete, return code = %d.\n", | 503 | dev_dbg(&alg_data->adapter.dev, |
504 | "%s(): Complete, return code = %d.\n", | ||
506 | __func__, rc); | 505 | __func__, rc); |
507 | 506 | ||
508 | /* Clear TDI and AFI bits in case they are set. */ | 507 | /* Clear TDI and AFI bits in case they are set. */ |
509 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_tdi) { | 508 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_tdi) { |
510 | dev_dbg(&adap->dev, | 509 | dev_dbg(&alg_data->adapter.dev, |
511 | "%s: TDI still set... clearing now.\n", | 510 | "%s: TDI still set... clearing now.\n", |
512 | adap->name); | 511 | alg_data->adapter.name); |
513 | iowrite32(stat, I2C_REG_STS(alg_data)); | 512 | iowrite32(stat, I2C_REG_STS(alg_data)); |
514 | } | 513 | } |
515 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_afi) { | 514 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_afi) { |
516 | dev_dbg(&adap->dev, | 515 | dev_dbg(&alg_data->adapter.dev, |
517 | "%s: AFI still set... clearing now.\n", | 516 | "%s: AFI still set... clearing now.\n", |
518 | adap->name); | 517 | alg_data->adapter.name); |
519 | iowrite32(stat, I2C_REG_STS(alg_data)); | 518 | iowrite32(stat, I2C_REG_STS(alg_data)); |
520 | } | 519 | } |
521 | } | 520 | } |
522 | 521 | ||
523 | bus_reset_if_active(adap); | 522 | bus_reset_if_active(alg_data); |
524 | 523 | ||
525 | /* Cleanup to be sure... */ | 524 | /* Cleanup to be sure... */ |
526 | alg_data->mif.buf = NULL; | 525 | alg_data->mif.buf = NULL; |
527 | alg_data->mif.len = 0; | 526 | alg_data->mif.len = 0; |
528 | 527 | ||
529 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x\n", | 528 | dev_dbg(&alg_data->adapter.dev, "%s(): exiting, stat = %x\n", |
530 | __func__, ioread32(I2C_REG_STS(alg_data))); | 529 | __func__, ioread32(I2C_REG_STS(alg_data))); |
531 | 530 | ||
532 | if (completed != num) | 531 | if (completed != num) |
@@ -545,69 +544,92 @@ static struct i2c_algorithm pnx_algorithm = { | |||
545 | .functionality = i2c_pnx_func, | 544 | .functionality = i2c_pnx_func, |
546 | }; | 545 | }; |
547 | 546 | ||
547 | #ifdef CONFIG_PM | ||
548 | static int i2c_pnx_controller_suspend(struct platform_device *pdev, | 548 | static int i2c_pnx_controller_suspend(struct platform_device *pdev, |
549 | pm_message_t state) | 549 | pm_message_t state) |
550 | { | 550 | { |
551 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | 551 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
552 | return i2c_pnx->suspend(pdev, state); | 552 | |
553 | /* FIXME: shouldn't this be clk_disable? */ | ||
554 | clk_enable(alg_data->clk); | ||
555 | |||
556 | return 0; | ||
553 | } | 557 | } |
554 | 558 | ||
555 | static int i2c_pnx_controller_resume(struct platform_device *pdev) | 559 | static int i2c_pnx_controller_resume(struct platform_device *pdev) |
556 | { | 560 | { |
557 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | 561 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
558 | return i2c_pnx->resume(pdev); | 562 | |
563 | return clk_enable(alg_data->clk); | ||
559 | } | 564 | } |
565 | #else | ||
566 | #define i2c_pnx_controller_suspend NULL | ||
567 | #define i2c_pnx_controller_resume NULL | ||
568 | #endif | ||
560 | 569 | ||
561 | static int __devinit i2c_pnx_probe(struct platform_device *pdev) | 570 | static int __devinit i2c_pnx_probe(struct platform_device *pdev) |
562 | { | 571 | { |
563 | unsigned long tmp; | 572 | unsigned long tmp; |
564 | int ret = 0; | 573 | int ret = 0; |
565 | struct i2c_pnx_algo_data *alg_data; | 574 | struct i2c_pnx_algo_data *alg_data; |
566 | int freq_mhz; | 575 | unsigned long freq; |
567 | struct i2c_pnx_data *i2c_pnx = pdev->dev.platform_data; | 576 | struct i2c_pnx_data *i2c_pnx = pdev->dev.platform_data; |
568 | 577 | ||
569 | if (!i2c_pnx || !i2c_pnx->adapter) { | 578 | if (!i2c_pnx || !i2c_pnx->name) { |
570 | dev_err(&pdev->dev, "%s: no platform data supplied\n", | 579 | dev_err(&pdev->dev, "%s: no platform data supplied\n", |
571 | __func__); | 580 | __func__); |
572 | ret = -EINVAL; | 581 | ret = -EINVAL; |
573 | goto out; | 582 | goto out; |
574 | } | 583 | } |
575 | 584 | ||
576 | platform_set_drvdata(pdev, i2c_pnx); | 585 | alg_data = kzalloc(sizeof(*alg_data), GFP_KERNEL); |
577 | 586 | if (!alg_data) { | |
578 | if (i2c_pnx->calculate_input_freq) | 587 | ret = -ENOMEM; |
579 | freq_mhz = i2c_pnx->calculate_input_freq(pdev); | 588 | goto err_kzalloc; |
580 | else { | ||
581 | freq_mhz = PNX_DEFAULT_FREQ; | ||
582 | dev_info(&pdev->dev, "Setting bus frequency to default value: " | ||
583 | "%d MHz\n", freq_mhz); | ||
584 | } | 589 | } |
585 | 590 | ||
586 | i2c_pnx->adapter->algo = &pnx_algorithm; | 591 | platform_set_drvdata(pdev, alg_data); |
592 | |||
593 | strlcpy(alg_data->adapter.name, i2c_pnx->name, | ||
594 | sizeof(alg_data->adapter.name)); | ||
595 | alg_data->adapter.dev.parent = &pdev->dev; | ||
596 | alg_data->adapter.algo = &pnx_algorithm; | ||
597 | alg_data->adapter.algo_data = alg_data; | ||
598 | alg_data->adapter.nr = pdev->id; | ||
599 | alg_data->i2c_pnx = i2c_pnx; | ||
600 | |||
601 | alg_data->clk = clk_get(&pdev->dev, NULL); | ||
602 | if (IS_ERR(alg_data->clk)) { | ||
603 | ret = PTR_ERR(alg_data->clk); | ||
604 | goto out_drvdata; | ||
605 | } | ||
587 | 606 | ||
588 | alg_data = i2c_pnx->adapter->algo_data; | ||
589 | init_timer(&alg_data->mif.timer); | 607 | init_timer(&alg_data->mif.timer); |
590 | alg_data->mif.timer.function = i2c_pnx_timeout; | 608 | alg_data->mif.timer.function = i2c_pnx_timeout; |
591 | alg_data->mif.timer.data = (unsigned long)i2c_pnx->adapter; | 609 | alg_data->mif.timer.data = (unsigned long)alg_data; |
592 | 610 | ||
593 | /* Register I/O resource */ | 611 | /* Register I/O resource */ |
594 | if (!request_mem_region(alg_data->base, I2C_PNX_REGION_SIZE, | 612 | if (!request_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE, |
595 | pdev->name)) { | 613 | pdev->name)) { |
596 | dev_err(&pdev->dev, | 614 | dev_err(&pdev->dev, |
597 | "I/O region 0x%08x for I2C already in use.\n", | 615 | "I/O region 0x%08x for I2C already in use.\n", |
598 | alg_data->base); | 616 | i2c_pnx->base); |
599 | ret = -ENODEV; | 617 | ret = -ENODEV; |
600 | goto out_drvdata; | 618 | goto out_clkget; |
601 | } | 619 | } |
602 | 620 | ||
603 | if (!(alg_data->ioaddr = | 621 | alg_data->ioaddr = ioremap(i2c_pnx->base, I2C_PNX_REGION_SIZE); |
604 | (u32)ioremap(alg_data->base, I2C_PNX_REGION_SIZE))) { | 622 | if (!alg_data->ioaddr) { |
605 | dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n"); | 623 | dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n"); |
606 | ret = -ENOMEM; | 624 | ret = -ENOMEM; |
607 | goto out_release; | 625 | goto out_release; |
608 | } | 626 | } |
609 | 627 | ||
610 | i2c_pnx->set_clock_run(pdev); | 628 | ret = clk_enable(alg_data->clk); |
629 | if (ret) | ||
630 | goto out_unmap; | ||
631 | |||
632 | freq = clk_get_rate(alg_data->clk); | ||
611 | 633 | ||
612 | /* | 634 | /* |
613 | * Clock Divisor High This value is the number of system clocks | 635 | * Clock Divisor High This value is the number of system clocks |
@@ -620,45 +642,47 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev) | |||
620 | * the deglitching filter length. | 642 | * the deglitching filter length. |
621 | */ | 643 | */ |
622 | 644 | ||
623 | tmp = ((freq_mhz * 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; | 645 | tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; |
624 | iowrite32(tmp, I2C_REG_CKH(alg_data)); | 646 | iowrite32(tmp, I2C_REG_CKH(alg_data)); |
625 | iowrite32(tmp, I2C_REG_CKL(alg_data)); | 647 | iowrite32(tmp, I2C_REG_CKL(alg_data)); |
626 | 648 | ||
627 | iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data)); | 649 | iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data)); |
628 | if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) { | 650 | if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) { |
629 | ret = -ENODEV; | 651 | ret = -ENODEV; |
630 | goto out_unmap; | 652 | goto out_clock; |
631 | } | 653 | } |
632 | init_completion(&alg_data->mif.complete); | 654 | init_completion(&alg_data->mif.complete); |
633 | 655 | ||
634 | ret = request_irq(alg_data->irq, i2c_pnx_interrupt, | 656 | ret = request_irq(i2c_pnx->irq, i2c_pnx_interrupt, |
635 | 0, pdev->name, i2c_pnx->adapter); | 657 | 0, pdev->name, alg_data); |
636 | if (ret) | 658 | if (ret) |
637 | goto out_clock; | 659 | goto out_clock; |
638 | 660 | ||
639 | /* Register this adapter with the I2C subsystem */ | 661 | /* Register this adapter with the I2C subsystem */ |
640 | i2c_pnx->adapter->dev.parent = &pdev->dev; | 662 | ret = i2c_add_numbered_adapter(&alg_data->adapter); |
641 | i2c_pnx->adapter->nr = pdev->id; | ||
642 | ret = i2c_add_numbered_adapter(i2c_pnx->adapter); | ||
643 | if (ret < 0) { | 663 | if (ret < 0) { |
644 | dev_err(&pdev->dev, "I2C: Failed to add bus\n"); | 664 | dev_err(&pdev->dev, "I2C: Failed to add bus\n"); |
645 | goto out_irq; | 665 | goto out_irq; |
646 | } | 666 | } |
647 | 667 | ||
648 | dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n", | 668 | dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n", |
649 | i2c_pnx->adapter->name, alg_data->base, alg_data->irq); | 669 | alg_data->adapter.name, i2c_pnx->base, i2c_pnx->irq); |
650 | 670 | ||
651 | return 0; | 671 | return 0; |
652 | 672 | ||
653 | out_irq: | 673 | out_irq: |
654 | free_irq(alg_data->irq, i2c_pnx->adapter); | 674 | free_irq(i2c_pnx->irq, alg_data); |
655 | out_clock: | 675 | out_clock: |
656 | i2c_pnx->set_clock_stop(pdev); | 676 | clk_disable(alg_data->clk); |
657 | out_unmap: | 677 | out_unmap: |
658 | iounmap((void *)alg_data->ioaddr); | 678 | iounmap(alg_data->ioaddr); |
659 | out_release: | 679 | out_release: |
660 | release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE); | 680 | release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); |
681 | out_clkget: | ||
682 | clk_put(alg_data->clk); | ||
661 | out_drvdata: | 683 | out_drvdata: |
684 | kfree(alg_data); | ||
685 | err_kzalloc: | ||
662 | platform_set_drvdata(pdev, NULL); | 686 | platform_set_drvdata(pdev, NULL); |
663 | out: | 687 | out: |
664 | return ret; | 688 | return ret; |
@@ -666,15 +690,16 @@ out: | |||
666 | 690 | ||
667 | static int __devexit i2c_pnx_remove(struct platform_device *pdev) | 691 | static int __devexit i2c_pnx_remove(struct platform_device *pdev) |
668 | { | 692 | { |
669 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | 693 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
670 | struct i2c_adapter *adap = i2c_pnx->adapter; | 694 | struct i2c_pnx_data *i2c_pnx = alg_data->i2c_pnx; |
671 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 695 | |
672 | 696 | free_irq(i2c_pnx->irq, alg_data); | |
673 | free_irq(alg_data->irq, i2c_pnx->adapter); | 697 | i2c_del_adapter(&alg_data->adapter); |
674 | i2c_del_adapter(adap); | 698 | clk_disable(alg_data->clk); |
675 | i2c_pnx->set_clock_stop(pdev); | 699 | iounmap(alg_data->ioaddr); |
676 | iounmap((void *)alg_data->ioaddr); | 700 | release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); |
677 | release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE); | 701 | clk_put(alg_data->clk); |
702 | kfree(alg_data); | ||
678 | platform_set_drvdata(pdev, NULL); | 703 | platform_set_drvdata(pdev, NULL); |
679 | 704 | ||
680 | return 0; | 705 | return 0; |
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/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index b5496a19d967..24485cc62ff8 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -328,15 +328,7 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
328 | /* U.S. Robotics 56K Voice INT PnP*/ | 328 | /* U.S. Robotics 56K Voice INT PnP*/ |
329 | { "USR9190", 0 }, | 329 | { "USR9190", 0 }, |
330 | /* Wacom tablets */ | 330 | /* Wacom tablets */ |
331 | { "WACF004", 0 }, | 331 | { "WACFXXX", 0 }, |
332 | { "WACF005", 0 }, | ||
333 | { "WACF006", 0 }, | ||
334 | { "WACF007", 0 }, | ||
335 | { "WACF008", 0 }, | ||
336 | { "WACF009", 0 }, | ||
337 | { "WACF00A", 0 }, | ||
338 | { "WACF00B", 0 }, | ||
339 | { "WACF00C", 0 }, | ||
340 | /* Compaq touchscreen */ | 332 | /* Compaq touchscreen */ |
341 | { "FPI2002", 0 }, | 333 | { "FPI2002", 0 }, |
342 | /* Fujitsu Stylistic touchscreens */ | 334 | /* Fujitsu Stylistic touchscreens */ |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 18130f11238e..60d665a17a88 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -1088,7 +1088,7 @@ imx_console_get_options(struct imx_port *sport, int *baud, | |||
1088 | int *parity, int *bits) | 1088 | int *parity, int *bits) |
1089 | { | 1089 | { |
1090 | 1090 | ||
1091 | if ( readl(sport->port.membase + UCR1) | UCR1_UARTEN ) { | 1091 | if (readl(sport->port.membase + UCR1) & UCR1_UARTEN) { |
1092 | /* ok, the port was enabled */ | 1092 | /* ok, the port was enabled */ |
1093 | unsigned int ucr2, ubir,ubmr, uartclk; | 1093 | unsigned int ucr2, ubir,ubmr, uartclk; |
1094 | unsigned int baud_raw; | 1094 | unsigned int baud_raw; |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 047530b285bb..7f2830709512 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -385,13 +385,20 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, | |||
385 | } | 385 | } |
386 | 386 | ||
387 | /* | 387 | /* |
388 | * As a last resort, if the quotient is zero, | 388 | * As a last resort, if the range cannot be met then clip to |
389 | * default to 9600 bps | 389 | * the nearest chip supported rate. |
390 | */ | 390 | */ |
391 | if (!hung_up) | 391 | if (!hung_up) { |
392 | tty_termios_encode_baud_rate(termios, 9600, 9600); | 392 | if (baud <= min) |
393 | tty_termios_encode_baud_rate(termios, | ||
394 | min + 1, min + 1); | ||
395 | else | ||
396 | tty_termios_encode_baud_rate(termios, | ||
397 | max - 1, max - 1); | ||
398 | } | ||
393 | } | 399 | } |
394 | 400 | /* Should never happen */ | |
401 | WARN_ON(1); | ||
395 | return 0; | 402 | return 0; |
396 | } | 403 | } |
397 | 404 | ||
@@ -2006,12 +2013,6 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) | |||
2006 | 2013 | ||
2007 | mutex_lock(&port->mutex); | 2014 | mutex_lock(&port->mutex); |
2008 | 2015 | ||
2009 | if (!console_suspend_enabled && uart_console(uport)) { | ||
2010 | /* we're going to avoid suspending serial console */ | ||
2011 | mutex_unlock(&port->mutex); | ||
2012 | return 0; | ||
2013 | } | ||
2014 | |||
2015 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); | 2016 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); |
2016 | if (device_may_wakeup(tty_dev)) { | 2017 | if (device_may_wakeup(tty_dev)) { |
2017 | enable_irq_wake(uport->irq); | 2018 | enable_irq_wake(uport->irq); |
@@ -2019,20 +2020,23 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) | |||
2019 | mutex_unlock(&port->mutex); | 2020 | mutex_unlock(&port->mutex); |
2020 | return 0; | 2021 | return 0; |
2021 | } | 2022 | } |
2022 | uport->suspended = 1; | 2023 | if (console_suspend_enabled || !uart_console(uport)) |
2024 | uport->suspended = 1; | ||
2023 | 2025 | ||
2024 | if (port->flags & ASYNC_INITIALIZED) { | 2026 | if (port->flags & ASYNC_INITIALIZED) { |
2025 | const struct uart_ops *ops = uport->ops; | 2027 | const struct uart_ops *ops = uport->ops; |
2026 | int tries; | 2028 | int tries; |
2027 | 2029 | ||
2028 | set_bit(ASYNCB_SUSPENDED, &port->flags); | 2030 | if (console_suspend_enabled || !uart_console(uport)) { |
2029 | clear_bit(ASYNCB_INITIALIZED, &port->flags); | 2031 | set_bit(ASYNCB_SUSPENDED, &port->flags); |
2032 | clear_bit(ASYNCB_INITIALIZED, &port->flags); | ||
2030 | 2033 | ||
2031 | spin_lock_irq(&uport->lock); | 2034 | spin_lock_irq(&uport->lock); |
2032 | ops->stop_tx(uport); | 2035 | ops->stop_tx(uport); |
2033 | ops->set_mctrl(uport, 0); | 2036 | ops->set_mctrl(uport, 0); |
2034 | ops->stop_rx(uport); | 2037 | ops->stop_rx(uport); |
2035 | spin_unlock_irq(&uport->lock); | 2038 | spin_unlock_irq(&uport->lock); |
2039 | } | ||
2036 | 2040 | ||
2037 | /* | 2041 | /* |
2038 | * Wait for the transmitter to empty. | 2042 | * Wait for the transmitter to empty. |
@@ -2047,16 +2051,18 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) | |||
2047 | drv->dev_name, | 2051 | drv->dev_name, |
2048 | drv->tty_driver->name_base + uport->line); | 2052 | drv->tty_driver->name_base + uport->line); |
2049 | 2053 | ||
2050 | ops->shutdown(uport); | 2054 | if (console_suspend_enabled || !uart_console(uport)) |
2055 | ops->shutdown(uport); | ||
2051 | } | 2056 | } |
2052 | 2057 | ||
2053 | /* | 2058 | /* |
2054 | * Disable the console device before suspending. | 2059 | * Disable the console device before suspending. |
2055 | */ | 2060 | */ |
2056 | if (uart_console(uport)) | 2061 | if (console_suspend_enabled && uart_console(uport)) |
2057 | console_stop(uport->cons); | 2062 | console_stop(uport->cons); |
2058 | 2063 | ||
2059 | uart_change_pm(state, 3); | 2064 | if (console_suspend_enabled || !uart_console(uport)) |
2065 | uart_change_pm(state, 3); | ||
2060 | 2066 | ||
2061 | mutex_unlock(&port->mutex); | 2067 | mutex_unlock(&port->mutex); |
2062 | 2068 | ||
@@ -2073,29 +2079,6 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) | |||
2073 | 2079 | ||
2074 | mutex_lock(&port->mutex); | 2080 | mutex_lock(&port->mutex); |
2075 | 2081 | ||
2076 | if (!console_suspend_enabled && uart_console(uport)) { | ||
2077 | /* no need to resume serial console, it wasn't suspended */ | ||
2078 | /* | ||
2079 | * First try to use the console cflag setting. | ||
2080 | */ | ||
2081 | memset(&termios, 0, sizeof(struct ktermios)); | ||
2082 | termios.c_cflag = uport->cons->cflag; | ||
2083 | /* | ||
2084 | * If that's unset, use the tty termios setting. | ||
2085 | */ | ||
2086 | if (termios.c_cflag == 0) | ||
2087 | termios = *state->port.tty->termios; | ||
2088 | else { | ||
2089 | termios.c_ispeed = termios.c_ospeed = | ||
2090 | tty_termios_input_baud_rate(&termios); | ||
2091 | termios.c_ispeed = termios.c_ospeed = | ||
2092 | tty_termios_baud_rate(&termios); | ||
2093 | } | ||
2094 | uport->ops->set_termios(uport, &termios, NULL); | ||
2095 | mutex_unlock(&port->mutex); | ||
2096 | return 0; | ||
2097 | } | ||
2098 | |||
2099 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); | 2082 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); |
2100 | if (!uport->suspended && device_may_wakeup(tty_dev)) { | 2083 | if (!uport->suspended && device_may_wakeup(tty_dev)) { |
2101 | disable_irq_wake(uport->irq); | 2084 | disable_irq_wake(uport->irq); |
@@ -2121,21 +2104,23 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) | |||
2121 | spin_lock_irq(&uport->lock); | 2104 | spin_lock_irq(&uport->lock); |
2122 | ops->set_mctrl(uport, 0); | 2105 | ops->set_mctrl(uport, 0); |
2123 | spin_unlock_irq(&uport->lock); | 2106 | spin_unlock_irq(&uport->lock); |
2124 | ret = ops->startup(uport); | 2107 | if (console_suspend_enabled || !uart_console(uport)) { |
2125 | if (ret == 0) { | 2108 | ret = ops->startup(uport); |
2126 | uart_change_speed(state, NULL); | 2109 | if (ret == 0) { |
2127 | spin_lock_irq(&uport->lock); | 2110 | uart_change_speed(state, NULL); |
2128 | ops->set_mctrl(uport, uport->mctrl); | 2111 | spin_lock_irq(&uport->lock); |
2129 | ops->start_tx(uport); | 2112 | ops->set_mctrl(uport, uport->mctrl); |
2130 | spin_unlock_irq(&uport->lock); | 2113 | ops->start_tx(uport); |
2131 | set_bit(ASYNCB_INITIALIZED, &port->flags); | 2114 | spin_unlock_irq(&uport->lock); |
2132 | } else { | 2115 | set_bit(ASYNCB_INITIALIZED, &port->flags); |
2133 | /* | 2116 | } else { |
2134 | * Failed to resume - maybe hardware went away? | 2117 | /* |
2135 | * Clear the "initialized" flag so we won't try | 2118 | * Failed to resume - maybe hardware went away? |
2136 | * to call the low level drivers shutdown method. | 2119 | * Clear the "initialized" flag so we won't try |
2137 | */ | 2120 | * to call the low level drivers shutdown method. |
2138 | uart_shutdown(state); | 2121 | */ |
2122 | uart_shutdown(state); | ||
2123 | } | ||
2139 | } | 2124 | } |
2140 | 2125 | ||
2141 | clear_bit(ASYNCB_SUSPENDED, &port->flags); | 2126 | clear_bit(ASYNCB_SUSPENDED, &port->flags); |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 0ee7239c5d69..df854401af2d 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -146,7 +146,8 @@ static void quirk_wakeup_oxsemi(struct pcmcia_device *link) | |||
146 | { | 146 | { |
147 | struct serial_info *info = link->priv; | 147 | struct serial_info *info = link->priv; |
148 | 148 | ||
149 | outb(12, info->c950ctrl + 1); | 149 | if (info->c950ctrl) |
150 | outb(12, info->c950ctrl + 1); | ||
150 | } | 151 | } |
151 | 152 | ||
152 | /* request_region? oxsemi branch does no request_region too... */ | 153 | /* request_region? oxsemi branch does no request_region too... */ |
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index f4c26572c7df..43c57b7688ab 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c | |||
@@ -194,9 +194,11 @@ static ssize_t set_enabled(struct device *dev, struct device_attribute *attr, | |||
194 | { | 194 | { |
195 | struct usb_interface *intf = to_usb_interface(dev); | 195 | struct usb_interface *intf = to_usb_interface(dev); |
196 | struct asus_oled_dev *odev = usb_get_intfdata(intf); | 196 | struct asus_oled_dev *odev = usb_get_intfdata(intf); |
197 | int temp = strict_strtoul(buf, 10, NULL); | 197 | unsigned long value; |
198 | if (strict_strtoul(buf, 10, &value)) | ||
199 | return -EINVAL; | ||
198 | 200 | ||
199 | enable_oled(odev, temp); | 201 | enable_oled(odev, value); |
200 | 202 | ||
201 | return count; | 203 | return count; |
202 | } | 204 | } |
@@ -207,10 +209,12 @@ static ssize_t class_set_enabled(struct device *device, | |||
207 | { | 209 | { |
208 | struct asus_oled_dev *odev = | 210 | struct asus_oled_dev *odev = |
209 | (struct asus_oled_dev *) dev_get_drvdata(device); | 211 | (struct asus_oled_dev *) dev_get_drvdata(device); |
212 | unsigned long value; | ||
210 | 213 | ||
211 | int temp = strict_strtoul(buf, 10, NULL); | 214 | if (strict_strtoul(buf, 10, &value)) |
215 | return -EINVAL; | ||
212 | 216 | ||
213 | enable_oled(odev, temp); | 217 | enable_oled(odev, value); |
214 | 218 | ||
215 | return count; | 219 | return count; |
216 | } | 220 | } |
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 6da843cc343c..e715e4dcb523 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h | |||
@@ -203,11 +203,14 @@ typedef struct _GLOBAL_t { /* Location: */ | |||
203 | * 9-0: pr ndes | 203 | * 9-0: pr ndes |
204 | */ | 204 | */ |
205 | 205 | ||
206 | #define ET_DMA10_MASK 0x3FF /* 10 bit mask for DMA10W types */ | 206 | #define ET_DMA12_MASK 0x0FFF /* 12 bit mask for DMA12W types */ |
207 | #define ET_DMA10_WRAP 0x400 | 207 | #define ET_DMA12_WRAP 0x1000 |
208 | #define ET_DMA4_MASK 0x00F /* 4 bit mask for DMA4W types */ | 208 | #define ET_DMA10_MASK 0x03FF /* 10 bit mask for DMA10W types */ |
209 | #define ET_DMA4_WRAP 0x010 | 209 | #define ET_DMA10_WRAP 0x0400 |
210 | 210 | #define ET_DMA4_MASK 0x000F /* 4 bit mask for DMA4W types */ | |
211 | #define ET_DMA4_WRAP 0x0010 | ||
212 | |||
213 | #define INDEX12(x) ((x) & ET_DMA12_MASK) | ||
211 | #define INDEX10(x) ((x) & ET_DMA10_MASK) | 214 | #define INDEX10(x) ((x) & ET_DMA10_MASK) |
212 | #define INDEX4(x) ((x) & ET_DMA4_MASK) | 215 | #define INDEX4(x) ((x) & ET_DMA4_MASK) |
213 | 216 | ||
@@ -216,6 +219,11 @@ extern inline void add_10bit(u32 *v, int n) | |||
216 | *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP); | 219 | *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP); |
217 | } | 220 | } |
218 | 221 | ||
222 | extern inline void add_12bit(u32 *v, int n) | ||
223 | { | ||
224 | *v = INDEX12(*v + n) | (*v & ET_DMA12_WRAP); | ||
225 | } | ||
226 | |||
219 | /* | 227 | /* |
220 | * 10bit DMA with wrap | 228 | * 10bit DMA with wrap |
221 | * txdma tx queue write address reg in txdma address map at 0x1010 | 229 | * txdma tx queue write address reg in txdma address map at 0x1010 |
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 3ddc9b12b8db..81c1a7478ad6 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c | |||
@@ -831,10 +831,10 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) | |||
831 | 831 | ||
832 | /* Indicate that we have used this PSR entry. */ | 832 | /* Indicate that we have used this PSR entry. */ |
833 | /* FIXME wrap 12 */ | 833 | /* FIXME wrap 12 */ |
834 | rx_local->local_psr_full = (rx_local->local_psr_full + 1) & 0xFFF; | 834 | add_12bit(&rx_local->local_psr_full, 1); |
835 | if (rx_local->local_psr_full > rx_local->PsrNumEntries - 1) { | 835 | if ((rx_local->local_psr_full & 0xFFF) > rx_local->PsrNumEntries - 1) { |
836 | /* Clear psr full and toggle the wrap bit */ | 836 | /* Clear psr full and toggle the wrap bit */ |
837 | rx_local->local_psr_full &= 0xFFF; | 837 | rx_local->local_psr_full &= ~0xFFF; |
838 | rx_local->local_psr_full ^= 0x1000; | 838 | rx_local->local_psr_full ^= 0x1000; |
839 | } | 839 | } |
840 | 840 | ||
diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c index c5b6613f2f2f..c2809f2a2ce0 100644 --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c | |||
@@ -386,7 +386,7 @@ u16 HvSignalEvent(void) | |||
386 | * retrieve the initialized message and event pages. Otherwise, we create and | 386 | * retrieve the initialized message and event pages. Otherwise, we create and |
387 | * initialize the message and event pages. | 387 | * initialize the message and event pages. |
388 | */ | 388 | */ |
389 | int HvSynicInit(u32 irqVector) | 389 | void HvSynicInit(void *irqarg) |
390 | { | 390 | { |
391 | u64 version; | 391 | u64 version; |
392 | union hv_synic_simp simp; | 392 | union hv_synic_simp simp; |
@@ -394,13 +394,14 @@ int HvSynicInit(u32 irqVector) | |||
394 | union hv_synic_sint sharedSint; | 394 | union hv_synic_sint sharedSint; |
395 | union hv_synic_scontrol sctrl; | 395 | union hv_synic_scontrol sctrl; |
396 | u64 guestID; | 396 | u64 guestID; |
397 | int ret = 0; | 397 | u32 irqVector = *((u32 *)(irqarg)); |
398 | int cpu = smp_processor_id(); | ||
398 | 399 | ||
399 | DPRINT_ENTER(VMBUS); | 400 | DPRINT_ENTER(VMBUS); |
400 | 401 | ||
401 | if (!gHvContext.HypercallPage) { | 402 | if (!gHvContext.HypercallPage) { |
402 | DPRINT_EXIT(VMBUS); | 403 | DPRINT_EXIT(VMBUS); |
403 | return ret; | 404 | return; |
404 | } | 405 | } |
405 | 406 | ||
406 | /* Check the version */ | 407 | /* Check the version */ |
@@ -425,27 +426,27 @@ int HvSynicInit(u32 irqVector) | |||
425 | */ | 426 | */ |
426 | rdmsrl(HV_X64_MSR_GUEST_OS_ID, guestID); | 427 | rdmsrl(HV_X64_MSR_GUEST_OS_ID, guestID); |
427 | if (guestID == HV_LINUX_GUEST_ID) { | 428 | if (guestID == HV_LINUX_GUEST_ID) { |
428 | gHvContext.synICMessagePage[0] = | 429 | gHvContext.synICMessagePage[cpu] = |
429 | phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT); | 430 | phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT); |
430 | gHvContext.synICEventPage[0] = | 431 | gHvContext.synICEventPage[cpu] = |
431 | phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT); | 432 | phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT); |
432 | } else { | 433 | } else { |
433 | DPRINT_ERR(VMBUS, "unknown guest id!!"); | 434 | DPRINT_ERR(VMBUS, "unknown guest id!!"); |
434 | goto Cleanup; | 435 | goto Cleanup; |
435 | } | 436 | } |
436 | DPRINT_DBG(VMBUS, "MAPPED: Simp: %p, Sifep: %p", | 437 | DPRINT_DBG(VMBUS, "MAPPED: Simp: %p, Sifep: %p", |
437 | gHvContext.synICMessagePage[0], | 438 | gHvContext.synICMessagePage[cpu], |
438 | gHvContext.synICEventPage[0]); | 439 | gHvContext.synICEventPage[cpu]); |
439 | } else { | 440 | } else { |
440 | gHvContext.synICMessagePage[0] = osd_PageAlloc(1); | 441 | gHvContext.synICMessagePage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC); |
441 | if (gHvContext.synICMessagePage[0] == NULL) { | 442 | if (gHvContext.synICMessagePage[cpu] == NULL) { |
442 | DPRINT_ERR(VMBUS, | 443 | DPRINT_ERR(VMBUS, |
443 | "unable to allocate SYNIC message page!!"); | 444 | "unable to allocate SYNIC message page!!"); |
444 | goto Cleanup; | 445 | goto Cleanup; |
445 | } | 446 | } |
446 | 447 | ||
447 | gHvContext.synICEventPage[0] = osd_PageAlloc(1); | 448 | gHvContext.synICEventPage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC); |
448 | if (gHvContext.synICEventPage[0] == NULL) { | 449 | if (gHvContext.synICEventPage[cpu] == NULL) { |
449 | DPRINT_ERR(VMBUS, | 450 | DPRINT_ERR(VMBUS, |
450 | "unable to allocate SYNIC event page!!"); | 451 | "unable to allocate SYNIC event page!!"); |
451 | goto Cleanup; | 452 | goto Cleanup; |
@@ -454,7 +455,7 @@ int HvSynicInit(u32 irqVector) | |||
454 | /* Setup the Synic's message page */ | 455 | /* Setup the Synic's message page */ |
455 | rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); | 456 | rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); |
456 | simp.SimpEnabled = 1; | 457 | simp.SimpEnabled = 1; |
457 | simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[0]) | 458 | simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[cpu]) |
458 | >> PAGE_SHIFT; | 459 | >> PAGE_SHIFT; |
459 | 460 | ||
460 | DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", | 461 | DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", |
@@ -465,7 +466,7 @@ int HvSynicInit(u32 irqVector) | |||
465 | /* Setup the Synic's event page */ | 466 | /* Setup the Synic's event page */ |
466 | rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); | 467 | rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); |
467 | siefp.SiefpEnabled = 1; | 468 | siefp.SiefpEnabled = 1; |
468 | siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[0]) | 469 | siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[cpu]) |
469 | >> PAGE_SHIFT; | 470 | >> PAGE_SHIFT; |
470 | 471 | ||
471 | DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", | 472 | DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", |
@@ -501,32 +502,30 @@ int HvSynicInit(u32 irqVector) | |||
501 | 502 | ||
502 | DPRINT_EXIT(VMBUS); | 503 | DPRINT_EXIT(VMBUS); |
503 | 504 | ||
504 | return ret; | 505 | return; |
505 | 506 | ||
506 | Cleanup: | 507 | Cleanup: |
507 | ret = -1; | ||
508 | |||
509 | if (gHvContext.GuestId == HV_LINUX_GUEST_ID) { | 508 | if (gHvContext.GuestId == HV_LINUX_GUEST_ID) { |
510 | if (gHvContext.synICEventPage[0]) | 509 | if (gHvContext.synICEventPage[cpu]) |
511 | osd_PageFree(gHvContext.synICEventPage[0], 1); | 510 | osd_PageFree(gHvContext.synICEventPage[cpu], 1); |
512 | 511 | ||
513 | if (gHvContext.synICMessagePage[0]) | 512 | if (gHvContext.synICMessagePage[cpu]) |
514 | osd_PageFree(gHvContext.synICMessagePage[0], 1); | 513 | osd_PageFree(gHvContext.synICMessagePage[cpu], 1); |
515 | } | 514 | } |
516 | 515 | ||
517 | DPRINT_EXIT(VMBUS); | 516 | DPRINT_EXIT(VMBUS); |
518 | 517 | return; | |
519 | return ret; | ||
520 | } | 518 | } |
521 | 519 | ||
522 | /** | 520 | /** |
523 | * HvSynicCleanup - Cleanup routine for HvSynicInit(). | 521 | * HvSynicCleanup - Cleanup routine for HvSynicInit(). |
524 | */ | 522 | */ |
525 | void HvSynicCleanup(void) | 523 | void HvSynicCleanup(void *arg) |
526 | { | 524 | { |
527 | union hv_synic_sint sharedSint; | 525 | union hv_synic_sint sharedSint; |
528 | union hv_synic_simp simp; | 526 | union hv_synic_simp simp; |
529 | union hv_synic_siefp siefp; | 527 | union hv_synic_siefp siefp; |
528 | int cpu = smp_processor_id(); | ||
530 | 529 | ||
531 | DPRINT_ENTER(VMBUS); | 530 | DPRINT_ENTER(VMBUS); |
532 | 531 | ||
@@ -539,6 +538,7 @@ void HvSynicCleanup(void) | |||
539 | 538 | ||
540 | sharedSint.Masked = 1; | 539 | sharedSint.Masked = 1; |
541 | 540 | ||
541 | /* Need to correctly cleanup in the case of SMP!!! */ | ||
542 | /* Disable the interrupt */ | 542 | /* Disable the interrupt */ |
543 | wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); | 543 | wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); |
544 | 544 | ||
@@ -560,8 +560,8 @@ void HvSynicCleanup(void) | |||
560 | 560 | ||
561 | wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); | 561 | wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); |
562 | 562 | ||
563 | osd_PageFree(gHvContext.synICMessagePage[0], 1); | 563 | osd_PageFree(gHvContext.synICMessagePage[cpu], 1); |
564 | osd_PageFree(gHvContext.synICEventPage[0], 1); | 564 | osd_PageFree(gHvContext.synICEventPage[cpu], 1); |
565 | } | 565 | } |
566 | 566 | ||
567 | DPRINT_EXIT(VMBUS); | 567 | DPRINT_EXIT(VMBUS); |
diff --git a/drivers/staging/hv/Hv.h b/drivers/staging/hv/Hv.h index 5379e4bfc56e..fce4b5cdac30 100644 --- a/drivers/staging/hv/Hv.h +++ b/drivers/staging/hv/Hv.h | |||
@@ -93,7 +93,7 @@ static const struct hv_guid VMBUS_SERVICE_ID = { | |||
93 | }, | 93 | }, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | #define MAX_NUM_CPUS 1 | 96 | #define MAX_NUM_CPUS 32 |
97 | 97 | ||
98 | 98 | ||
99 | struct hv_input_signal_event_buffer { | 99 | struct hv_input_signal_event_buffer { |
@@ -137,8 +137,8 @@ extern u16 HvPostMessage(union hv_connection_id connectionId, | |||
137 | 137 | ||
138 | extern u16 HvSignalEvent(void); | 138 | extern u16 HvSignalEvent(void); |
139 | 139 | ||
140 | extern int HvSynicInit(u32 irqVector); | 140 | extern void HvSynicInit(void *irqarg); |
141 | 141 | ||
142 | extern void HvSynicCleanup(void); | 142 | extern void HvSynicCleanup(void *arg); |
143 | 143 | ||
144 | #endif /* __HV_H__ */ | 144 | #endif /* __HV_H__ */ |
diff --git a/drivers/staging/hv/Vmbus.c b/drivers/staging/hv/Vmbus.c index a4dd06f6d459..35a023e9f9d1 100644 --- a/drivers/staging/hv/Vmbus.c +++ b/drivers/staging/hv/Vmbus.c | |||
@@ -129,7 +129,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo) | |||
129 | 129 | ||
130 | /* strcpy(dev->name, "vmbus"); */ | 130 | /* strcpy(dev->name, "vmbus"); */ |
131 | /* SynIC setup... */ | 131 | /* SynIC setup... */ |
132 | ret = HvSynicInit(*irqvector); | 132 | on_each_cpu(HvSynicInit, (void *)irqvector, 1); |
133 | 133 | ||
134 | /* Connect to VMBus in the root partition */ | 134 | /* Connect to VMBus in the root partition */ |
135 | ret = VmbusConnect(); | 135 | ret = VmbusConnect(); |
@@ -150,7 +150,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev) | |||
150 | DPRINT_ENTER(VMBUS); | 150 | DPRINT_ENTER(VMBUS); |
151 | VmbusChannelReleaseUnattachedChannels(); | 151 | VmbusChannelReleaseUnattachedChannels(); |
152 | VmbusDisconnect(); | 152 | VmbusDisconnect(); |
153 | HvSynicCleanup(); | 153 | on_each_cpu(HvSynicCleanup, NULL, 1); |
154 | DPRINT_EXIT(VMBUS); | 154 | DPRINT_EXIT(VMBUS); |
155 | 155 | ||
156 | return ret; | 156 | return ret; |
@@ -173,7 +173,8 @@ static void VmbusOnCleanup(struct hv_driver *drv) | |||
173 | */ | 173 | */ |
174 | static void VmbusOnMsgDPC(struct hv_driver *drv) | 174 | static void VmbusOnMsgDPC(struct hv_driver *drv) |
175 | { | 175 | { |
176 | void *page_addr = gHvContext.synICMessagePage[0]; | 176 | int cpu = smp_processor_id(); |
177 | void *page_addr = gHvContext.synICMessagePage[cpu]; | ||
177 | struct hv_message *msg = (struct hv_message *)page_addr + | 178 | struct hv_message *msg = (struct hv_message *)page_addr + |
178 | VMBUS_MESSAGE_SINT; | 179 | VMBUS_MESSAGE_SINT; |
179 | struct hv_message *copied; | 180 | struct hv_message *copied; |
@@ -230,11 +231,12 @@ static void VmbusOnEventDPC(struct hv_driver *drv) | |||
230 | static int VmbusOnISR(struct hv_driver *drv) | 231 | static int VmbusOnISR(struct hv_driver *drv) |
231 | { | 232 | { |
232 | int ret = 0; | 233 | int ret = 0; |
234 | int cpu = smp_processor_id(); | ||
233 | void *page_addr; | 235 | void *page_addr; |
234 | struct hv_message *msg; | 236 | struct hv_message *msg; |
235 | union hv_synic_event_flags *event; | 237 | union hv_synic_event_flags *event; |
236 | 238 | ||
237 | page_addr = gHvContext.synICMessagePage[0]; | 239 | page_addr = gHvContext.synICMessagePage[cpu]; |
238 | msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; | 240 | msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; |
239 | 241 | ||
240 | DPRINT_ENTER(VMBUS); | 242 | DPRINT_ENTER(VMBUS); |
@@ -248,7 +250,7 @@ static int VmbusOnISR(struct hv_driver *drv) | |||
248 | } | 250 | } |
249 | 251 | ||
250 | /* TODO: Check if there are events to be process */ | 252 | /* TODO: Check if there are events to be process */ |
251 | page_addr = gHvContext.synICEventPage[0]; | 253 | page_addr = gHvContext.synICEventPage[cpu]; |
252 | event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; | 254 | event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; |
253 | 255 | ||
254 | /* Since we are a child, we only need to check bit 0 */ | 256 | /* Since we are a child, we only need to check bit 0 */ |
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 | |
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index 430a5848a9a5..c7a9479934af 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
@@ -96,9 +96,6 @@ static void wdt_enable(void) | |||
96 | { | 96 | { |
97 | spin_lock(&io_lock); | 97 | spin_lock(&io_lock); |
98 | 98 | ||
99 | if (wdt_clk) | ||
100 | clk_set_rate(wdt_clk, 1); | ||
101 | |||
102 | /* stop counter, initiate counter reset */ | 99 | /* stop counter, initiate counter reset */ |
103 | __raw_writel(RESET_COUNT, WDTIM_CTRL(wdt_base)); | 100 | __raw_writel(RESET_COUNT, WDTIM_CTRL(wdt_base)); |
104 | /*wait for reset to complete. 100% guarantee event */ | 101 | /*wait for reset to complete. 100% guarantee event */ |
@@ -125,19 +122,25 @@ static void wdt_disable(void) | |||
125 | spin_lock(&io_lock); | 122 | spin_lock(&io_lock); |
126 | 123 | ||
127 | __raw_writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */ | 124 | __raw_writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */ |
128 | if (wdt_clk) | ||
129 | clk_set_rate(wdt_clk, 0); | ||
130 | 125 | ||
131 | spin_unlock(&io_lock); | 126 | spin_unlock(&io_lock); |
132 | } | 127 | } |
133 | 128 | ||
134 | static int pnx4008_wdt_open(struct inode *inode, struct file *file) | 129 | static int pnx4008_wdt_open(struct inode *inode, struct file *file) |
135 | { | 130 | { |
131 | int ret; | ||
132 | |||
136 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | 133 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) |
137 | return -EBUSY; | 134 | return -EBUSY; |
138 | 135 | ||
139 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 136 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
140 | 137 | ||
138 | ret = clk_enable(wdt_clk); | ||
139 | if (ret) { | ||
140 | clear_bit(WDT_IN_USE, &wdt_status); | ||
141 | return ret; | ||
142 | } | ||
143 | |||
141 | wdt_enable(); | 144 | wdt_enable(); |
142 | 145 | ||
143 | return nonseekable_open(inode, file); | 146 | return nonseekable_open(inode, file); |
@@ -225,6 +228,7 @@ static int pnx4008_wdt_release(struct inode *inode, struct file *file) | |||
225 | printk(KERN_WARNING "WATCHDOG: Device closed unexpectdly\n"); | 228 | printk(KERN_WARNING "WATCHDOG: Device closed unexpectdly\n"); |
226 | 229 | ||
227 | wdt_disable(); | 230 | wdt_disable(); |
231 | clk_disable(wdt_clk); | ||
228 | clear_bit(WDT_IN_USE, &wdt_status); | 232 | clear_bit(WDT_IN_USE, &wdt_status); |
229 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 233 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
230 | 234 | ||
@@ -273,25 +277,33 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev) | |||
273 | } | 277 | } |
274 | wdt_base = (void __iomem *)IO_ADDRESS(res->start); | 278 | wdt_base = (void __iomem *)IO_ADDRESS(res->start); |
275 | 279 | ||
276 | wdt_clk = clk_get(&pdev->dev, "wdt_ck"); | 280 | wdt_clk = clk_get(&pdev->dev, NULL); |
277 | if (IS_ERR(wdt_clk)) { | 281 | if (IS_ERR(wdt_clk)) { |
278 | ret = PTR_ERR(wdt_clk); | 282 | ret = PTR_ERR(wdt_clk); |
279 | release_resource(wdt_mem); | 283 | release_resource(wdt_mem); |
280 | kfree(wdt_mem); | 284 | kfree(wdt_mem); |
281 | goto out; | 285 | goto out; |
282 | } else | 286 | } |
283 | clk_set_rate(wdt_clk, 1); | 287 | |
288 | ret = clk_enable(wdt_clk); | ||
289 | if (ret) { | ||
290 | release_resource(wdt_mem); | ||
291 | kfree(wdt_mem); | ||
292 | goto out; | ||
293 | } | ||
284 | 294 | ||
285 | ret = misc_register(&pnx4008_wdt_miscdev); | 295 | ret = misc_register(&pnx4008_wdt_miscdev); |
286 | if (ret < 0) { | 296 | if (ret < 0) { |
287 | printk(KERN_ERR MODULE_NAME "cannot register misc device\n"); | 297 | printk(KERN_ERR MODULE_NAME "cannot register misc device\n"); |
288 | release_resource(wdt_mem); | 298 | release_resource(wdt_mem); |
289 | kfree(wdt_mem); | 299 | kfree(wdt_mem); |
290 | clk_set_rate(wdt_clk, 0); | 300 | clk_disable(wdt_clk); |
301 | clk_put(wdt_clk); | ||
291 | } else { | 302 | } else { |
292 | boot_status = (__raw_readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? | 303 | boot_status = (__raw_readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? |
293 | WDIOF_CARDRESET : 0; | 304 | WDIOF_CARDRESET : 0; |
294 | wdt_disable(); /*disable for now */ | 305 | wdt_disable(); /*disable for now */ |
306 | clk_disable(wdt_clk); | ||
295 | set_bit(WDT_DEVICE_INITED, &wdt_status); | 307 | set_bit(WDT_DEVICE_INITED, &wdt_status); |
296 | } | 308 | } |
297 | 309 | ||
@@ -302,11 +314,10 @@ out: | |||
302 | static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) | 314 | static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) |
303 | { | 315 | { |
304 | misc_deregister(&pnx4008_wdt_miscdev); | 316 | misc_deregister(&pnx4008_wdt_miscdev); |
305 | if (wdt_clk) { | 317 | |
306 | clk_set_rate(wdt_clk, 0); | 318 | clk_disable(wdt_clk); |
307 | clk_put(wdt_clk); | 319 | clk_put(wdt_clk); |
308 | wdt_clk = NULL; | 320 | |
309 | } | ||
310 | if (wdt_mem) { | 321 | if (wdt_mem) { |
311 | release_resource(wdt_mem); | 322 | release_resource(wdt_mem); |
312 | kfree(wdt_mem); | 323 | kfree(wdt_mem); |