diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/acpi/acpi_dbg.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/acpica/nsload.c | 7 | ||||
| -rw-r--r-- | drivers/acpi/acpica/nsparse.c | 9 | ||||
| -rw-r--r-- | drivers/acpi/pci_link.c | 63 | ||||
| -rw-r--r-- | drivers/cpuidle/cpuidle.c | 12 |
5 files changed, 62 insertions, 33 deletions
diff --git a/drivers/acpi/acpi_dbg.c b/drivers/acpi/acpi_dbg.c index 1f4128487dd4..dee86925a9a1 100644 --- a/drivers/acpi/acpi_dbg.c +++ b/drivers/acpi/acpi_dbg.c | |||
| @@ -602,7 +602,7 @@ static int acpi_aml_read_user(char __user *buf, int len) | |||
| 602 | crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1); | 602 | crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1); |
| 603 | ret = n; | 603 | ret = n; |
| 604 | out: | 604 | out: |
| 605 | acpi_aml_unlock_fifo(ACPI_AML_OUT_USER, !ret); | 605 | acpi_aml_unlock_fifo(ACPI_AML_OUT_USER, ret >= 0); |
| 606 | return ret; | 606 | return ret; |
| 607 | } | 607 | } |
| 608 | 608 | ||
| @@ -672,7 +672,7 @@ static int acpi_aml_write_user(const char __user *buf, int len) | |||
| 672 | crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); | 672 | crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); |
| 673 | ret = n; | 673 | ret = n; |
| 674 | out: | 674 | out: |
| 675 | acpi_aml_unlock_fifo(ACPI_AML_IN_USER, !ret); | 675 | acpi_aml_unlock_fifo(ACPI_AML_IN_USER, ret >= 0); |
| 676 | return n; | 676 | return n; |
| 677 | } | 677 | } |
| 678 | 678 | ||
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index b5e2b0ada0ab..297f6aacd7d4 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | #include "acnamesp.h" | 46 | #include "acnamesp.h" |
| 47 | #include "acdispat.h" | 47 | #include "acdispat.h" |
| 48 | #include "actables.h" | 48 | #include "actables.h" |
| 49 | #include "acinterp.h" | ||
| 49 | 50 | ||
| 50 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
| 51 | ACPI_MODULE_NAME("nsload") | 52 | ACPI_MODULE_NAME("nsload") |
| @@ -78,6 +79,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) | |||
| 78 | 79 | ||
| 79 | ACPI_FUNCTION_TRACE(ns_load_table); | 80 | ACPI_FUNCTION_TRACE(ns_load_table); |
| 80 | 81 | ||
| 82 | acpi_ex_enter_interpreter(); | ||
| 83 | |||
| 81 | /* | 84 | /* |
| 82 | * Parse the table and load the namespace with all named | 85 | * Parse the table and load the namespace with all named |
| 83 | * objects found within. Control methods are NOT parsed | 86 | * objects found within. Control methods are NOT parsed |
| @@ -89,7 +92,7 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) | |||
| 89 | */ | 92 | */ |
| 90 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 93 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 91 | if (ACPI_FAILURE(status)) { | 94 | if (ACPI_FAILURE(status)) { |
| 92 | return_ACPI_STATUS(status); | 95 | goto unlock_interp; |
| 93 | } | 96 | } |
| 94 | 97 | ||
| 95 | /* If table already loaded into namespace, just return */ | 98 | /* If table already loaded into namespace, just return */ |
| @@ -130,6 +133,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) | |||
| 130 | 133 | ||
| 131 | unlock: | 134 | unlock: |
| 132 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 135 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
| 136 | unlock_interp: | ||
| 137 | (void)acpi_ex_exit_interpreter(); | ||
| 133 | 138 | ||
| 134 | if (ACPI_FAILURE(status)) { | 139 | if (ACPI_FAILURE(status)) { |
| 135 | return_ACPI_STATUS(status); | 140 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 1783cd7e1446..f631a47724f0 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
| @@ -47,7 +47,6 @@ | |||
| 47 | #include "acparser.h" | 47 | #include "acparser.h" |
| 48 | #include "acdispat.h" | 48 | #include "acdispat.h" |
| 49 | #include "actables.h" | 49 | #include "actables.h" |
| 50 | #include "acinterp.h" | ||
| 51 | 50 | ||
| 52 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
| 53 | ACPI_MODULE_NAME("nsparse") | 52 | ACPI_MODULE_NAME("nsparse") |
| @@ -171,8 +170,6 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) | |||
| 171 | 170 | ||
| 172 | ACPI_FUNCTION_TRACE(ns_parse_table); | 171 | ACPI_FUNCTION_TRACE(ns_parse_table); |
| 173 | 172 | ||
| 174 | acpi_ex_enter_interpreter(); | ||
| 175 | |||
| 176 | /* | 173 | /* |
| 177 | * AML Parse, pass 1 | 174 | * AML Parse, pass 1 |
| 178 | * | 175 | * |
| @@ -188,7 +185,7 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) | |||
| 188 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, | 185 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, |
| 189 | table_index, start_node); | 186 | table_index, start_node); |
| 190 | if (ACPI_FAILURE(status)) { | 187 | if (ACPI_FAILURE(status)) { |
| 191 | goto error_exit; | 188 | return_ACPI_STATUS(status); |
| 192 | } | 189 | } |
| 193 | 190 | ||
| 194 | /* | 191 | /* |
| @@ -204,10 +201,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) | |||
| 204 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, | 201 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, |
| 205 | table_index, start_node); | 202 | table_index, start_node); |
| 206 | if (ACPI_FAILURE(status)) { | 203 | if (ACPI_FAILURE(status)) { |
| 207 | goto error_exit; | 204 | return_ACPI_STATUS(status); |
| 208 | } | 205 | } |
| 209 | 206 | ||
| 210 | error_exit: | ||
| 211 | acpi_ex_exit_interpreter(); | ||
| 212 | return_ACPI_STATUS(status); | 207 | return_ACPI_STATUS(status); |
| 213 | } | 208 | } |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 4ed4061813e6..c983bf733ad3 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -470,6 +470,7 @@ static int acpi_irq_pci_sharing_penalty(int irq) | |||
| 470 | { | 470 | { |
| 471 | struct acpi_pci_link *link; | 471 | struct acpi_pci_link *link; |
| 472 | int penalty = 0; | 472 | int penalty = 0; |
| 473 | int i; | ||
| 473 | 474 | ||
| 474 | list_for_each_entry(link, &acpi_link_list, list) { | 475 | list_for_each_entry(link, &acpi_link_list, list) { |
| 475 | /* | 476 | /* |
| @@ -478,18 +479,14 @@ static int acpi_irq_pci_sharing_penalty(int irq) | |||
| 478 | */ | 479 | */ |
| 479 | if (link->irq.active && link->irq.active == irq) | 480 | if (link->irq.active && link->irq.active == irq) |
| 480 | penalty += PIRQ_PENALTY_PCI_USING; | 481 | penalty += PIRQ_PENALTY_PCI_USING; |
| 481 | else { | 482 | |
| 482 | int i; | 483 | /* |
| 483 | 484 | * penalize the IRQs PCI might use, but not as severely. | |
| 484 | /* | 485 | */ |
| 485 | * If a link is inactive, penalize the IRQs it | 486 | for (i = 0; i < link->irq.possible_count; i++) |
| 486 | * might use, but not as severely. | 487 | if (link->irq.possible[i] == irq) |
| 487 | */ | 488 | penalty += PIRQ_PENALTY_PCI_POSSIBLE / |
| 488 | for (i = 0; i < link->irq.possible_count; i++) | 489 | link->irq.possible_count; |
| 489 | if (link->irq.possible[i] == irq) | ||
| 490 | penalty += PIRQ_PENALTY_PCI_POSSIBLE / | ||
| 491 | link->irq.possible_count; | ||
| 492 | } | ||
| 493 | } | 490 | } |
| 494 | 491 | ||
| 495 | return penalty; | 492 | return penalty; |
| @@ -499,9 +496,6 @@ static int acpi_irq_get_penalty(int irq) | |||
| 499 | { | 496 | { |
| 500 | int penalty = 0; | 497 | int penalty = 0; |
| 501 | 498 | ||
| 502 | if (irq < ACPI_MAX_ISA_IRQS) | ||
| 503 | penalty += acpi_isa_irq_penalty[irq]; | ||
| 504 | |||
| 505 | /* | 499 | /* |
| 506 | * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict | 500 | * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict |
| 507 | * with PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be | 501 | * with PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be |
| @@ -516,10 +510,49 @@ static int acpi_irq_get_penalty(int irq) | |||
| 516 | penalty += PIRQ_PENALTY_PCI_USING; | 510 | penalty += PIRQ_PENALTY_PCI_USING; |
| 517 | } | 511 | } |
| 518 | 512 | ||
| 513 | if (irq < ACPI_MAX_ISA_IRQS) | ||
| 514 | return penalty + acpi_isa_irq_penalty[irq]; | ||
| 515 | |||
| 519 | penalty += acpi_irq_pci_sharing_penalty(irq); | 516 | penalty += acpi_irq_pci_sharing_penalty(irq); |
| 520 | return penalty; | 517 | return penalty; |
| 521 | } | 518 | } |
| 522 | 519 | ||
| 520 | int __init acpi_irq_penalty_init(void) | ||
| 521 | { | ||
| 522 | struct acpi_pci_link *link; | ||
| 523 | int i; | ||
| 524 | |||
| 525 | /* | ||
| 526 | * Update penalties to facilitate IRQ balancing. | ||
| 527 | */ | ||
| 528 | list_for_each_entry(link, &acpi_link_list, list) { | ||
| 529 | |||
| 530 | /* | ||
| 531 | * reflect the possible and active irqs in the penalty table -- | ||
| 532 | * useful for breaking ties. | ||
| 533 | */ | ||
| 534 | if (link->irq.possible_count) { | ||
| 535 | int penalty = | ||
| 536 | PIRQ_PENALTY_PCI_POSSIBLE / | ||
| 537 | link->irq.possible_count; | ||
| 538 | |||
| 539 | for (i = 0; i < link->irq.possible_count; i++) { | ||
| 540 | if (link->irq.possible[i] < ACPI_MAX_ISA_IRQS) | ||
| 541 | acpi_isa_irq_penalty[link->irq. | ||
| 542 | possible[i]] += | ||
| 543 | penalty; | ||
| 544 | } | ||
| 545 | |||
| 546 | } else if (link->irq.active && | ||
| 547 | (link->irq.active < ACPI_MAX_ISA_IRQS)) { | ||
| 548 | acpi_isa_irq_penalty[link->irq.active] += | ||
| 549 | PIRQ_PENALTY_PCI_POSSIBLE; | ||
| 550 | } | ||
| 551 | } | ||
| 552 | |||
| 553 | return 0; | ||
| 554 | } | ||
| 555 | |||
| 523 | static int acpi_irq_balance = -1; /* 0: static, 1: balance */ | 556 | static int acpi_irq_balance = -1; /* 0: static, 1: balance */ |
| 524 | 557 | ||
| 525 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) | 558 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index a4d0059e232c..c73207abb5a4 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
| @@ -173,7 +173,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
| 173 | 173 | ||
| 174 | struct cpuidle_state *target_state = &drv->states[index]; | 174 | struct cpuidle_state *target_state = &drv->states[index]; |
| 175 | bool broadcast = !!(target_state->flags & CPUIDLE_FLAG_TIMER_STOP); | 175 | bool broadcast = !!(target_state->flags & CPUIDLE_FLAG_TIMER_STOP); |
| 176 | u64 time_start, time_end; | 176 | ktime_t time_start, time_end; |
| 177 | s64 diff; | 177 | s64 diff; |
| 178 | 178 | ||
| 179 | /* | 179 | /* |
| @@ -195,13 +195,13 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
| 195 | sched_idle_set_state(target_state); | 195 | sched_idle_set_state(target_state); |
| 196 | 196 | ||
| 197 | trace_cpu_idle_rcuidle(index, dev->cpu); | 197 | trace_cpu_idle_rcuidle(index, dev->cpu); |
| 198 | time_start = local_clock(); | 198 | time_start = ns_to_ktime(local_clock()); |
| 199 | 199 | ||
| 200 | stop_critical_timings(); | 200 | stop_critical_timings(); |
| 201 | entered_state = target_state->enter(dev, drv, index); | 201 | entered_state = target_state->enter(dev, drv, index); |
| 202 | start_critical_timings(); | 202 | start_critical_timings(); |
| 203 | 203 | ||
| 204 | time_end = local_clock(); | 204 | time_end = ns_to_ktime(local_clock()); |
| 205 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); | 205 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); |
| 206 | 206 | ||
| 207 | /* The cpu is no longer idle or about to enter idle. */ | 207 | /* The cpu is no longer idle or about to enter idle. */ |
| @@ -217,11 +217,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
| 217 | if (!cpuidle_state_is_coupled(drv, index)) | 217 | if (!cpuidle_state_is_coupled(drv, index)) |
| 218 | local_irq_enable(); | 218 | local_irq_enable(); |
| 219 | 219 | ||
| 220 | /* | 220 | diff = ktime_us_delta(time_end, time_start); |
| 221 | * local_clock() returns the time in nanosecond, let's shift | ||
| 222 | * by 10 (divide by 1024) to have microsecond based time. | ||
| 223 | */ | ||
| 224 | diff = (time_end - time_start) >> 10; | ||
| 225 | if (diff > INT_MAX) | 221 | if (diff > INT_MAX) |
| 226 | diff = INT_MAX; | 222 | diff = INT_MAX; |
| 227 | 223 | ||
