diff options
Diffstat (limited to 'drivers/acpi')
| -rw-r--r-- | drivers/acpi/Kconfig | 3 | ||||
| -rw-r--r-- | drivers/acpi/ac.c | 2 | ||||
| -rw-r--r-- | drivers/acpi/bay.c | 2 | ||||
| -rw-r--r-- | drivers/acpi/ec.c | 240 | ||||
| -rw-r--r-- | drivers/acpi/events/evgpe.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/fan.c | 35 | ||||
| -rw-r--r-- | drivers/acpi/glue.c | 20 | ||||
| -rw-r--r-- | drivers/acpi/osl.c | 90 | ||||
| -rw-r--r-- | drivers/acpi/power.c | 2 | ||||
| -rw-r--r-- | drivers/acpi/processor_core.c | 31 | ||||
| -rw-r--r-- | drivers/acpi/processor_idle.c | 37 | ||||
| -rw-r--r-- | drivers/acpi/processor_thermal.c | 30 | ||||
| -rw-r--r-- | drivers/acpi/processor_throttling.c | 10 | ||||
| -rw-r--r-- | drivers/acpi/scan.c | 60 | ||||
| -rw-r--r-- | drivers/acpi/sleep/main.c | 42 | ||||
| -rw-r--r-- | drivers/acpi/thermal.c | 22 | ||||
| -rw-r--r-- | drivers/acpi/utilities/utxface.c | 35 | ||||
| -rw-r--r-- | drivers/acpi/video.c | 316 |
18 files changed, 512 insertions, 469 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b4f5e8542829..c52fca833268 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -140,6 +140,7 @@ config ACPI_VIDEO | |||
| 140 | tristate "Video" | 140 | tristate "Video" |
| 141 | depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL | 141 | depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL |
| 142 | depends on INPUT | 142 | depends on INPUT |
| 143 | select THERMAL | ||
| 143 | help | 144 | help |
| 144 | This driver implement the ACPI Extensions For Display Adapters | 145 | This driver implement the ACPI Extensions For Display Adapters |
| 145 | for integrated graphics devices on motherboard, as specified in | 146 | for integrated graphics devices on motherboard, as specified in |
| @@ -151,6 +152,7 @@ config ACPI_VIDEO | |||
| 151 | 152 | ||
| 152 | config ACPI_FAN | 153 | config ACPI_FAN |
| 153 | tristate "Fan" | 154 | tristate "Fan" |
| 155 | select THERMAL | ||
| 154 | default y | 156 | default y |
| 155 | help | 157 | help |
| 156 | This driver adds support for ACPI fan devices, allowing user-mode | 158 | This driver adds support for ACPI fan devices, allowing user-mode |
| @@ -172,6 +174,7 @@ config ACPI_BAY | |||
| 172 | 174 | ||
| 173 | config ACPI_PROCESSOR | 175 | config ACPI_PROCESSOR |
| 174 | tristate "Processor" | 176 | tristate "Processor" |
| 177 | select THERMAL | ||
| 175 | default y | 178 | default y |
| 176 | help | 179 | help |
| 177 | This driver installs ACPI as the idle handler for Linux, and uses | 180 | This driver installs ACPI as the idle handler for Linux, and uses |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 76b9bea98b6d..43a95e5640de 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
| @@ -63,7 +63,7 @@ static int acpi_ac_add(struct acpi_device *device); | |||
| 63 | static int acpi_ac_remove(struct acpi_device *device, int type); | 63 | static int acpi_ac_remove(struct acpi_device *device, int type); |
| 64 | static int acpi_ac_resume(struct acpi_device *device); | 64 | static int acpi_ac_resume(struct acpi_device *device); |
| 65 | 65 | ||
| 66 | const static struct acpi_device_id ac_device_ids[] = { | 66 | static const struct acpi_device_id ac_device_ids[] = { |
| 67 | {"ACPI0003", 0}, | 67 | {"ACPI0003", 0}, |
| 68 | {"", 0}, | 68 | {"", 0}, |
| 69 | }; | 69 | }; |
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c index 1fa86811b8ee..d2fc94161848 100644 --- a/drivers/acpi/bay.c +++ b/drivers/acpi/bay.c | |||
| @@ -201,6 +201,7 @@ static int is_ejectable_bay(acpi_handle handle) | |||
| 201 | return 0; | 201 | return 0; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | #if 0 | ||
| 204 | /** | 205 | /** |
| 205 | * eject_removable_drive - try to eject this drive | 206 | * eject_removable_drive - try to eject this drive |
| 206 | * @dev : the device structure of the drive | 207 | * @dev : the device structure of the drive |
| @@ -225,6 +226,7 @@ int eject_removable_drive(struct device *dev) | |||
| 225 | return 0; | 226 | return 0; |
| 226 | } | 227 | } |
| 227 | EXPORT_SYMBOL_GPL(eject_removable_drive); | 228 | EXPORT_SYMBOL_GPL(eject_removable_drive); |
| 229 | #endif /* 0 */ | ||
| 228 | 230 | ||
| 229 | static int acpi_bay_add_fs(struct bay *bay) | 231 | static int acpi_bay_add_fs(struct bay *bay) |
| 230 | { | 232 | { |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 7222a18a0319..3d9362140831 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -73,38 +73,14 @@ enum ec_event { | |||
| 73 | 73 | ||
| 74 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ | 74 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ |
| 75 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 75 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
| 76 | #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */ | ||
| 76 | 77 | ||
| 77 | enum { | 78 | enum { |
| 78 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ | 79 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ |
| 79 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 80 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
| 80 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ | 81 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ |
| 81 | EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */ | 82 | EC_FLAGS_NO_GPE, /* Don't use GPE mode */ |
| 82 | EC_FLAGS_ADDRESS, /* Address is being written */ | 83 | EC_FLAGS_RESCHEDULE_POLL /* Re-schedule poll */ |
| 83 | EC_FLAGS_NO_WDATA_GPE, /* Don't expect WDATA GPE event */ | ||
| 84 | EC_FLAGS_WDATA, /* Data is being written */ | ||
| 85 | EC_FLAGS_NO_OBF1_GPE, /* Don't expect GPE before read */ | ||
| 86 | }; | ||
| 87 | |||
| 88 | static int acpi_ec_remove(struct acpi_device *device, int type); | ||
| 89 | static int acpi_ec_start(struct acpi_device *device); | ||
| 90 | static int acpi_ec_stop(struct acpi_device *device, int type); | ||
| 91 | static int acpi_ec_add(struct acpi_device *device); | ||
| 92 | |||
| 93 | static const struct acpi_device_id ec_device_ids[] = { | ||
| 94 | {"PNP0C09", 0}, | ||
| 95 | {"", 0}, | ||
| 96 | }; | ||
| 97 | |||
| 98 | static struct acpi_driver acpi_ec_driver = { | ||
| 99 | .name = "ec", | ||
| 100 | .class = ACPI_EC_CLASS, | ||
| 101 | .ids = ec_device_ids, | ||
| 102 | .ops = { | ||
| 103 | .add = acpi_ec_add, | ||
| 104 | .remove = acpi_ec_remove, | ||
| 105 | .start = acpi_ec_start, | ||
| 106 | .stop = acpi_ec_stop, | ||
| 107 | }, | ||
| 108 | }; | 84 | }; |
| 109 | 85 | ||
| 110 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 86 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
| @@ -129,6 +105,8 @@ static struct acpi_ec { | |||
| 129 | struct mutex lock; | 105 | struct mutex lock; |
| 130 | wait_queue_head_t wait; | 106 | wait_queue_head_t wait; |
| 131 | struct list_head list; | 107 | struct list_head list; |
| 108 | struct delayed_work work; | ||
| 109 | atomic_t irq_count; | ||
| 132 | u8 handlers_installed; | 110 | u8 handlers_installed; |
| 133 | } *boot_ec, *first_ec; | 111 | } *boot_ec, *first_ec; |
| 134 | 112 | ||
| @@ -177,65 +155,52 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | |||
| 177 | return 0; | 155 | return 0; |
| 178 | } | 156 | } |
| 179 | 157 | ||
| 180 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) | 158 | static void ec_schedule_ec_poll(struct acpi_ec *ec) |
| 181 | { | 159 | { |
| 182 | int ret = 0; | 160 | if (test_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags)) |
| 161 | schedule_delayed_work(&ec->work, | ||
| 162 | msecs_to_jiffies(ACPI_EC_DELAY)); | ||
| 163 | } | ||
| 183 | 164 | ||
| 184 | if (unlikely(event == ACPI_EC_EVENT_OBF_1 && | 165 | static void ec_switch_to_poll_mode(struct acpi_ec *ec) |
| 185 | test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags))) | 166 | { |
| 186 | force_poll = 1; | 167 | set_bit(EC_FLAGS_NO_GPE, &ec->flags); |
| 187 | if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) && | 168 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
| 188 | test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags))) | 169 | acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); |
| 189 | force_poll = 1; | 170 | set_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); |
| 190 | if (unlikely(test_bit(EC_FLAGS_WDATA, &ec->flags) && | 171 | } |
| 191 | test_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags))) | 172 | |
| 192 | force_poll = 1; | 173 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) |
| 174 | { | ||
| 175 | atomic_set(&ec->irq_count, 0); | ||
| 193 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && | 176 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && |
| 194 | likely(!force_poll)) { | 177 | likely(!force_poll)) { |
| 195 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), | 178 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), |
| 196 | msecs_to_jiffies(ACPI_EC_DELAY))) | 179 | msecs_to_jiffies(ACPI_EC_DELAY))) |
| 197 | goto end; | 180 | return 0; |
| 198 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 181 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
| 199 | if (acpi_ec_check_status(ec, event)) { | 182 | if (acpi_ec_check_status(ec, event)) { |
| 200 | if (event == ACPI_EC_EVENT_OBF_1) { | 183 | /* missing GPEs, switch back to poll mode */ |
| 201 | /* miss OBF_1 GPE, don't expect it */ | 184 | if (printk_ratelimit()) |
| 202 | pr_info(PREFIX "missing OBF confirmation, " | 185 | pr_info(PREFIX "missing confirmations, " |
| 203 | "don't expect it any longer.\n"); | ||
| 204 | set_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags); | ||
| 205 | } else if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) { | ||
| 206 | /* miss address GPE, don't expect it anymore */ | ||
| 207 | pr_info(PREFIX "missing address confirmation, " | ||
| 208 | "don't expect it any longer.\n"); | ||
| 209 | set_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags); | ||
| 210 | } else if (test_bit(EC_FLAGS_WDATA, &ec->flags)) { | ||
| 211 | /* miss write data GPE, don't expect it */ | ||
| 212 | pr_info(PREFIX "missing write data confirmation, " | ||
| 213 | "don't expect it any longer.\n"); | ||
| 214 | set_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags); | ||
| 215 | } else { | ||
| 216 | /* missing GPEs, switch back to poll mode */ | ||
| 217 | if (printk_ratelimit()) | ||
| 218 | pr_info(PREFIX "missing confirmations, " | ||
| 219 | "switch off interrupt mode.\n"); | 186 | "switch off interrupt mode.\n"); |
| 220 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 187 | ec_switch_to_poll_mode(ec); |
| 221 | } | 188 | ec_schedule_ec_poll(ec); |
| 222 | goto end; | 189 | return 0; |
| 223 | } | 190 | } |
| 224 | } else { | 191 | } else { |
| 225 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 192 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
| 226 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 193 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
| 227 | while (time_before(jiffies, delay)) { | 194 | while (time_before(jiffies, delay)) { |
| 228 | if (acpi_ec_check_status(ec, event)) | 195 | if (acpi_ec_check_status(ec, event)) |
| 229 | goto end; | 196 | return 0; |
| 197 | udelay(ACPI_EC_UDELAY); | ||
| 230 | } | 198 | } |
| 231 | } | 199 | } |
| 232 | pr_err(PREFIX "acpi_ec_wait timeout," | 200 | pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n", |
| 233 | " status = %d, expect_event = %d\n", | 201 | acpi_ec_read_status(ec), |
| 234 | acpi_ec_read_status(ec), event); | 202 | (event == ACPI_EC_EVENT_OBF_1) ? "\"b0=1\"" : "\"b1=0\""); |
| 235 | ret = -ETIME; | 203 | return -ETIME; |
| 236 | end: | ||
| 237 | clear_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
| 238 | return ret; | ||
| 239 | } | 204 | } |
| 240 | 205 | ||
| 241 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | 206 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, |
| @@ -245,8 +210,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
| 245 | { | 210 | { |
| 246 | int result = 0; | 211 | int result = 0; |
| 247 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 212 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
| 248 | acpi_ec_write_cmd(ec, command); | ||
| 249 | pr_debug(PREFIX "transaction start\n"); | 213 | pr_debug(PREFIX "transaction start\n"); |
| 214 | acpi_ec_write_cmd(ec, command); | ||
| 250 | for (; wdata_len > 0; --wdata_len) { | 215 | for (; wdata_len > 0; --wdata_len) { |
| 251 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | 216 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
| 252 | if (result) { | 217 | if (result) { |
| @@ -254,15 +219,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
| 254 | "write_cmd timeout, command = %d\n", command); | 219 | "write_cmd timeout, command = %d\n", command); |
| 255 | goto end; | 220 | goto end; |
| 256 | } | 221 | } |
| 257 | /* mark the address byte written to EC */ | ||
| 258 | if (rdata_len + wdata_len > 1) | ||
| 259 | set_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
| 260 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 222 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
| 261 | acpi_ec_write_data(ec, *(wdata++)); | 223 | acpi_ec_write_data(ec, *(wdata++)); |
| 262 | } | 224 | } |
| 263 | 225 | ||
| 264 | if (!rdata_len) { | 226 | if (!rdata_len) { |
| 265 | set_bit(EC_FLAGS_WDATA, &ec->flags); | ||
| 266 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | 227 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
| 267 | if (result) { | 228 | if (result) { |
| 268 | pr_err(PREFIX | 229 | pr_err(PREFIX |
| @@ -527,47 +488,51 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
| 527 | { | 488 | { |
| 528 | acpi_status status = AE_OK; | 489 | acpi_status status = AE_OK; |
| 529 | struct acpi_ec *ec = data; | 490 | struct acpi_ec *ec = data; |
| 491 | u8 state = acpi_ec_read_status(ec); | ||
| 530 | 492 | ||
| 531 | pr_debug(PREFIX "~~~> interrupt\n"); | 493 | pr_debug(PREFIX "~~~> interrupt\n"); |
| 494 | atomic_inc(&ec->irq_count); | ||
| 495 | if (atomic_read(&ec->irq_count) > 5) { | ||
| 496 | pr_err(PREFIX "GPE storm detected, disabling EC GPE\n"); | ||
| 497 | ec_switch_to_poll_mode(ec); | ||
| 498 | goto end; | ||
| 499 | } | ||
| 532 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 500 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
| 533 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) | 501 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) |
| 534 | wake_up(&ec->wait); | 502 | wake_up(&ec->wait); |
| 535 | 503 | ||
| 536 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) { | 504 | if (state & ACPI_EC_FLAG_SCI) { |
| 537 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) | 505 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
| 538 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, | 506 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
| 539 | acpi_ec_gpe_query, ec); | 507 | acpi_ec_gpe_query, ec); |
| 540 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { | 508 | } else if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && |
| 509 | !test_bit(EC_FLAGS_NO_GPE, &ec->flags) && | ||
| 510 | in_interrupt()) { | ||
| 541 | /* this is non-query, must be confirmation */ | 511 | /* this is non-query, must be confirmation */ |
| 542 | if (printk_ratelimit()) | 512 | if (printk_ratelimit()) |
| 543 | pr_info(PREFIX "non-query interrupt received," | 513 | pr_info(PREFIX "non-query interrupt received," |
| 544 | " switching to interrupt mode\n"); | 514 | " switching to interrupt mode\n"); |
| 545 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 515 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
| 516 | clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); | ||
| 546 | } | 517 | } |
| 547 | 518 | end: | |
| 519 | ec_schedule_ec_poll(ec); | ||
| 548 | return ACPI_SUCCESS(status) ? | 520 | return ACPI_SUCCESS(status) ? |
| 549 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 521 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
| 550 | } | 522 | } |
| 551 | 523 | ||
| 524 | static void do_ec_poll(struct work_struct *work) | ||
| 525 | { | ||
| 526 | struct acpi_ec *ec = container_of(work, struct acpi_ec, work.work); | ||
| 527 | atomic_set(&ec->irq_count, 0); | ||
| 528 | (void)acpi_ec_gpe_handler(ec); | ||
| 529 | } | ||
| 530 | |||
| 552 | /* -------------------------------------------------------------------------- | 531 | /* -------------------------------------------------------------------------- |
| 553 | Address Space Management | 532 | Address Space Management |
| 554 | -------------------------------------------------------------------------- */ | 533 | -------------------------------------------------------------------------- */ |
| 555 | 534 | ||
| 556 | static acpi_status | 535 | static acpi_status |
| 557 | acpi_ec_space_setup(acpi_handle region_handle, | ||
| 558 | u32 function, void *handler_context, void **return_context) | ||
| 559 | { | ||
| 560 | /* | ||
| 561 | * The EC object is in the handler context and is needed | ||
| 562 | * when calling the acpi_ec_space_handler. | ||
| 563 | */ | ||
| 564 | *return_context = (function != ACPI_REGION_DEACTIVATE) ? | ||
| 565 | handler_context : NULL; | ||
| 566 | |||
| 567 | return AE_OK; | ||
| 568 | } | ||
| 569 | |||
| 570 | static acpi_status | ||
| 571 | acpi_ec_space_handler(u32 function, acpi_physical_address address, | 536 | acpi_ec_space_handler(u32 function, acpi_physical_address address, |
| 572 | u32 bits, acpi_integer *value, | 537 | u32 bits, acpi_integer *value, |
| 573 | void *handler_context, void *region_context) | 538 | void *handler_context, void *region_context) |
| @@ -709,6 +674,8 @@ static struct acpi_ec *make_acpi_ec(void) | |||
| 709 | mutex_init(&ec->lock); | 674 | mutex_init(&ec->lock); |
| 710 | init_waitqueue_head(&ec->wait); | 675 | init_waitqueue_head(&ec->wait); |
| 711 | INIT_LIST_HEAD(&ec->list); | 676 | INIT_LIST_HEAD(&ec->list); |
| 677 | INIT_DELAYED_WORK_DEFERRABLE(&ec->work, do_ec_poll); | ||
| 678 | atomic_set(&ec->irq_count, 0); | ||
| 712 | return ec; | 679 | return ec; |
| 713 | } | 680 | } |
| 714 | 681 | ||
| @@ -741,17 +708,21 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | |||
| 741 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); | 708 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); |
| 742 | if (ACPI_FAILURE(status)) | 709 | if (ACPI_FAILURE(status)) |
| 743 | return status; | 710 | return status; |
| 744 | /* Find and register all query methods */ | ||
| 745 | acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, | ||
| 746 | acpi_ec_register_query_methods, ec, NULL); | ||
| 747 | /* Use the global lock for all EC transactions? */ | 711 | /* Use the global lock for all EC transactions? */ |
| 748 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); | 712 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); |
| 749 | ec->handle = handle; | 713 | ec->handle = handle; |
| 750 | return AE_CTRL_TERMINATE; | 714 | return AE_CTRL_TERMINATE; |
| 751 | } | 715 | } |
| 752 | 716 | ||
| 717 | static void ec_poll_stop(struct acpi_ec *ec) | ||
| 718 | { | ||
| 719 | clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); | ||
| 720 | cancel_delayed_work(&ec->work); | ||
| 721 | } | ||
| 722 | |||
| 753 | static void ec_remove_handlers(struct acpi_ec *ec) | 723 | static void ec_remove_handlers(struct acpi_ec *ec) |
| 754 | { | 724 | { |
| 725 | ec_poll_stop(ec); | ||
| 755 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 726 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
| 756 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 727 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
| 757 | pr_err(PREFIX "failed to remove space handler\n"); | 728 | pr_err(PREFIX "failed to remove space handler\n"); |
| @@ -771,31 +742,28 @@ static int acpi_ec_add(struct acpi_device *device) | |||
| 771 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 742 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
| 772 | 743 | ||
| 773 | /* Check for boot EC */ | 744 | /* Check for boot EC */ |
| 774 | if (boot_ec) { | 745 | if (boot_ec && |
| 775 | if (boot_ec->handle == device->handle) { | 746 | (boot_ec->handle == device->handle || |
| 776 | /* Pre-loaded EC from DSDT, just move pointer */ | 747 | boot_ec->handle == ACPI_ROOT_OBJECT)) { |
| 777 | ec = boot_ec; | 748 | ec = boot_ec; |
| 778 | boot_ec = NULL; | 749 | boot_ec = NULL; |
| 779 | goto end; | 750 | } else { |
| 780 | } else if (boot_ec->handle == ACPI_ROOT_OBJECT) { | 751 | ec = make_acpi_ec(); |
| 781 | /* ECDT-based EC, time to shut it down */ | 752 | if (!ec) |
| 782 | ec_remove_handlers(boot_ec); | 753 | return -ENOMEM; |
| 783 | kfree(boot_ec); | 754 | if (ec_parse_device(device->handle, 0, ec, NULL) != |
| 784 | first_ec = boot_ec = NULL; | 755 | AE_CTRL_TERMINATE) { |
| 756 | kfree(ec); | ||
| 757 | return -EINVAL; | ||
| 785 | } | 758 | } |
| 786 | } | 759 | } |
| 787 | 760 | ||
| 788 | ec = make_acpi_ec(); | ||
| 789 | if (!ec) | ||
| 790 | return -ENOMEM; | ||
| 791 | |||
| 792 | if (ec_parse_device(device->handle, 0, ec, NULL) != | ||
| 793 | AE_CTRL_TERMINATE) { | ||
| 794 | kfree(ec); | ||
| 795 | return -EINVAL; | ||
| 796 | } | ||
| 797 | ec->handle = device->handle; | 761 | ec->handle = device->handle; |
| 798 | end: | 762 | |
| 763 | /* Find and register all query methods */ | ||
| 764 | acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1, | ||
| 765 | acpi_ec_register_query_methods, ec, NULL); | ||
| 766 | |||
| 799 | if (!first_ec) | 767 | if (!first_ec) |
| 800 | first_ec = ec; | 768 | first_ec = ec; |
| 801 | acpi_driver_data(device) = ec; | 769 | acpi_driver_data(device) = ec; |
| @@ -870,7 +838,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
| 870 | status = acpi_install_address_space_handler(ec->handle, | 838 | status = acpi_install_address_space_handler(ec->handle, |
| 871 | ACPI_ADR_SPACE_EC, | 839 | ACPI_ADR_SPACE_EC, |
| 872 | &acpi_ec_space_handler, | 840 | &acpi_ec_space_handler, |
| 873 | &acpi_ec_space_setup, ec); | 841 | NULL, ec); |
| 874 | if (ACPI_FAILURE(status)) { | 842 | if (ACPI_FAILURE(status)) { |
| 875 | acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); | 843 | acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); |
| 876 | return -ENODEV; | 844 | return -ENODEV; |
| @@ -897,6 +865,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
| 897 | 865 | ||
| 898 | /* EC is fully operational, allow queries */ | 866 | /* EC is fully operational, allow queries */ |
| 899 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 867 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
| 868 | ec_schedule_ec_poll(ec); | ||
| 900 | return ret; | 869 | return ret; |
| 901 | } | 870 | } |
| 902 | 871 | ||
| @@ -924,6 +893,11 @@ int __init acpi_boot_ec_enable(void) | |||
| 924 | return -EFAULT; | 893 | return -EFAULT; |
| 925 | } | 894 | } |
| 926 | 895 | ||
| 896 | static const struct acpi_device_id ec_device_ids[] = { | ||
| 897 | {"PNP0C09", 0}, | ||
| 898 | {"", 0}, | ||
| 899 | }; | ||
| 900 | |||
| 927 | int __init acpi_ec_ecdt_probe(void) | 901 | int __init acpi_ec_ecdt_probe(void) |
| 928 | { | 902 | { |
| 929 | int ret; | 903 | int ret; |
| @@ -944,6 +918,7 @@ int __init acpi_ec_ecdt_probe(void) | |||
| 944 | boot_ec->data_addr = ecdt_ptr->data.address; | 918 | boot_ec->data_addr = ecdt_ptr->data.address; |
| 945 | boot_ec->gpe = ecdt_ptr->gpe; | 919 | boot_ec->gpe = ecdt_ptr->gpe; |
| 946 | boot_ec->handle = ACPI_ROOT_OBJECT; | 920 | boot_ec->handle = ACPI_ROOT_OBJECT; |
| 921 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); | ||
| 947 | } else { | 922 | } else { |
| 948 | /* This workaround is needed only on some broken machines, | 923 | /* This workaround is needed only on some broken machines, |
| 949 | * which require early EC, but fail to provide ECDT */ | 924 | * which require early EC, but fail to provide ECDT */ |
| @@ -973,6 +948,39 @@ int __init acpi_ec_ecdt_probe(void) | |||
| 973 | return -ENODEV; | 948 | return -ENODEV; |
| 974 | } | 949 | } |
| 975 | 950 | ||
| 951 | static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) | ||
| 952 | { | ||
| 953 | struct acpi_ec *ec = acpi_driver_data(device); | ||
| 954 | /* Stop using GPE */ | ||
| 955 | set_bit(EC_FLAGS_NO_GPE, &ec->flags); | ||
| 956 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
| 957 | acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | ||
| 958 | return 0; | ||
| 959 | } | ||
| 960 | |||
| 961 | static int acpi_ec_resume(struct acpi_device *device) | ||
| 962 | { | ||
| 963 | struct acpi_ec *ec = acpi_driver_data(device); | ||
| 964 | /* Enable use of GPE back */ | ||
| 965 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); | ||
| 966 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | ||
| 967 | return 0; | ||
| 968 | } | ||
| 969 | |||
| 970 | static struct acpi_driver acpi_ec_driver = { | ||
| 971 | .name = "ec", | ||
| 972 | .class = ACPI_EC_CLASS, | ||
| 973 | .ids = ec_device_ids, | ||
| 974 | .ops = { | ||
| 975 | .add = acpi_ec_add, | ||
| 976 | .remove = acpi_ec_remove, | ||
| 977 | .start = acpi_ec_start, | ||
| 978 | .stop = acpi_ec_stop, | ||
| 979 | .suspend = acpi_ec_suspend, | ||
| 980 | .resume = acpi_ec_resume, | ||
| 981 | }, | ||
| 982 | }; | ||
| 983 | |||
| 976 | static int __init acpi_ec_init(void) | 984 | static int __init acpi_ec_init(void) |
| 977 | { | 985 | { |
| 978 | int result = 0; | 986 | int result = 0; |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index f55e1fd9e0b8..5354be44f876 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
| @@ -248,10 +248,6 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
| 248 | 248 | ||
| 249 | ACPI_FUNCTION_TRACE(ev_disable_gpe); | 249 | ACPI_FUNCTION_TRACE(ev_disable_gpe); |
| 250 | 250 | ||
| 251 | if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { | ||
| 252 | return_ACPI_STATUS(AE_OK); | ||
| 253 | } | ||
| 254 | |||
| 255 | /* Make sure HW enable masks are updated */ | 251 | /* Make sure HW enable masks are updated */ |
| 256 | 252 | ||
| 257 | status = | 253 | status = |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index c8e3cba423ef..cf635cde836b 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
| @@ -260,24 +260,23 @@ static int acpi_fan_add(struct acpi_device *device) | |||
| 260 | result = PTR_ERR(cdev); | 260 | result = PTR_ERR(cdev); |
| 261 | goto end; | 261 | goto end; |
| 262 | } | 262 | } |
| 263 | if (cdev) { | 263 | |
| 264 | printk(KERN_INFO PREFIX | 264 | printk(KERN_INFO PREFIX |
| 265 | "%s is registered as cooling_device%d\n", | 265 | "%s is registered as cooling_device%d\n", |
| 266 | device->dev.bus_id, cdev->id); | 266 | device->dev.bus_id, cdev->id); |
| 267 | 267 | ||
| 268 | acpi_driver_data(device) = cdev; | 268 | acpi_driver_data(device) = cdev; |
| 269 | result = sysfs_create_link(&device->dev.kobj, | 269 | result = sysfs_create_link(&device->dev.kobj, |
| 270 | &cdev->device.kobj, | 270 | &cdev->device.kobj, |
| 271 | "thermal_cooling"); | 271 | "thermal_cooling"); |
| 272 | if (result) | 272 | if (result) |
| 273 | return result; | 273 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
| 274 | 274 | ||
| 275 | result = sysfs_create_link(&cdev->device.kobj, | 275 | result = sysfs_create_link(&cdev->device.kobj, |
| 276 | &device->dev.kobj, | 276 | &device->dev.kobj, |
| 277 | "device"); | 277 | "device"); |
| 278 | if (result) | 278 | if (result) |
| 279 | return result; | 279 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
| 280 | } | ||
| 281 | 280 | ||
| 282 | result = acpi_fan_add_fs(device); | 281 | result = acpi_fan_add_fs(device); |
| 283 | if (result) | 282 | if (result) |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index eda0978b57c6..06f8634fe58b 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -142,6 +142,7 @@ EXPORT_SYMBOL(acpi_get_physical_device); | |||
| 142 | 142 | ||
| 143 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | 143 | static int acpi_bind_one(struct device *dev, acpi_handle handle) |
| 144 | { | 144 | { |
| 145 | struct acpi_device *acpi_dev; | ||
| 145 | acpi_status status; | 146 | acpi_status status; |
| 146 | 147 | ||
| 147 | if (dev->archdata.acpi_handle) { | 148 | if (dev->archdata.acpi_handle) { |
| @@ -157,6 +158,16 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
| 157 | } | 158 | } |
| 158 | dev->archdata.acpi_handle = handle; | 159 | dev->archdata.acpi_handle = handle; |
| 159 | 160 | ||
| 161 | status = acpi_bus_get_device(handle, &acpi_dev); | ||
| 162 | if (!ACPI_FAILURE(status)) { | ||
| 163 | int ret; | ||
| 164 | |||
| 165 | ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, | ||
| 166 | "firmware_node"); | ||
| 167 | ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | ||
| 168 | "physical_node"); | ||
| 169 | } | ||
| 170 | |||
| 160 | return 0; | 171 | return 0; |
| 161 | } | 172 | } |
| 162 | 173 | ||
| @@ -165,8 +176,17 @@ static int acpi_unbind_one(struct device *dev) | |||
| 165 | if (!dev->archdata.acpi_handle) | 176 | if (!dev->archdata.acpi_handle) |
| 166 | return 0; | 177 | return 0; |
| 167 | if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { | 178 | if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { |
| 179 | struct acpi_device *acpi_dev; | ||
| 180 | |||
| 168 | /* acpi_get_physical_device increase refcnt by one */ | 181 | /* acpi_get_physical_device increase refcnt by one */ |
| 169 | put_device(dev); | 182 | put_device(dev); |
| 183 | |||
| 184 | if (!acpi_bus_get_device(dev->archdata.acpi_handle, | ||
| 185 | &acpi_dev)) { | ||
| 186 | sysfs_remove_link(&dev->kobj, "firmware_node"); | ||
| 187 | sysfs_remove_link(&acpi_dev->dev.kobj, "physical_node"); | ||
| 188 | } | ||
| 189 | |||
| 170 | acpi_detach_data(dev->archdata.acpi_handle, | 190 | acpi_detach_data(dev->archdata.acpi_handle, |
| 171 | acpi_glue_data_handler); | 191 | acpi_glue_data_handler); |
| 172 | dev->archdata.acpi_handle = NULL; | 192 | dev->archdata.acpi_handle = NULL; |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index a697fb6cf050..235a1386888a 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | * Copyright (C) 2000 Andrew Henroid | 4 | * Copyright (C) 2000 Andrew Henroid |
| 5 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 5 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
| 6 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 6 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
| 7 | * Copyright (c) 2008 Intel Corporation | ||
| 8 | * Author: Matthew Wilcox <willy@linux.intel.com> | ||
| 7 | * | 9 | * |
| 8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 9 | * | 11 | * |
| @@ -37,15 +39,18 @@ | |||
| 37 | #include <linux/workqueue.h> | 39 | #include <linux/workqueue.h> |
| 38 | #include <linux/nmi.h> | 40 | #include <linux/nmi.h> |
| 39 | #include <linux/acpi.h> | 41 | #include <linux/acpi.h> |
| 40 | #include <acpi/acpi.h> | ||
| 41 | #include <asm/io.h> | ||
| 42 | #include <acpi/acpi_bus.h> | ||
| 43 | #include <acpi/processor.h> | ||
| 44 | #include <asm/uaccess.h> | ||
| 45 | |||
| 46 | #include <linux/efi.h> | 42 | #include <linux/efi.h> |
| 47 | #include <linux/ioport.h> | 43 | #include <linux/ioport.h> |
| 48 | #include <linux/list.h> | 44 | #include <linux/list.h> |
| 45 | #include <linux/jiffies.h> | ||
| 46 | #include <linux/semaphore.h> | ||
| 47 | |||
| 48 | #include <asm/io.h> | ||
| 49 | #include <asm/uaccess.h> | ||
| 50 | |||
| 51 | #include <acpi/acpi.h> | ||
| 52 | #include <acpi/acpi_bus.h> | ||
| 53 | #include <acpi/processor.h> | ||
| 49 | 54 | ||
| 50 | #define _COMPONENT ACPI_OS_SERVICES | 55 | #define _COMPONENT ACPI_OS_SERVICES |
| 51 | ACPI_MODULE_NAME("osl"); | 56 | ACPI_MODULE_NAME("osl"); |
| @@ -737,6 +742,7 @@ EXPORT_SYMBOL(acpi_os_execute); | |||
| 737 | void acpi_os_wait_events_complete(void *context) | 742 | void acpi_os_wait_events_complete(void *context) |
| 738 | { | 743 | { |
| 739 | flush_workqueue(kacpid_wq); | 744 | flush_workqueue(kacpid_wq); |
| 745 | flush_workqueue(kacpi_notify_wq); | ||
| 740 | } | 746 | } |
| 741 | 747 | ||
| 742 | EXPORT_SYMBOL(acpi_os_wait_events_complete); | 748 | EXPORT_SYMBOL(acpi_os_wait_events_complete); |
| @@ -764,7 +770,6 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) | |||
| 764 | { | 770 | { |
| 765 | struct semaphore *sem = NULL; | 771 | struct semaphore *sem = NULL; |
| 766 | 772 | ||
| 767 | |||
| 768 | sem = acpi_os_allocate(sizeof(struct semaphore)); | 773 | sem = acpi_os_allocate(sizeof(struct semaphore)); |
| 769 | if (!sem) | 774 | if (!sem) |
| 770 | return AE_NO_MEMORY; | 775 | return AE_NO_MEMORY; |
| @@ -791,12 +796,12 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) | |||
| 791 | { | 796 | { |
| 792 | struct semaphore *sem = (struct semaphore *)handle; | 797 | struct semaphore *sem = (struct semaphore *)handle; |
| 793 | 798 | ||
| 794 | |||
| 795 | if (!sem) | 799 | if (!sem) |
| 796 | return AE_BAD_PARAMETER; | 800 | return AE_BAD_PARAMETER; |
| 797 | 801 | ||
| 798 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); | 802 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); |
| 799 | 803 | ||
| 804 | BUG_ON(!list_empty(&sem->wait_list)); | ||
| 800 | kfree(sem); | 805 | kfree(sem); |
| 801 | sem = NULL; | 806 | sem = NULL; |
| 802 | 807 | ||
| @@ -804,21 +809,15 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) | |||
| 804 | } | 809 | } |
| 805 | 810 | ||
| 806 | /* | 811 | /* |
| 807 | * TODO: The kernel doesn't have a 'down_timeout' function -- had to | ||
| 808 | * improvise. The process is to sleep for one scheduler quantum | ||
| 809 | * until the semaphore becomes available. Downside is that this | ||
| 810 | * may result in starvation for timeout-based waits when there's | ||
| 811 | * lots of semaphore activity. | ||
| 812 | * | ||
| 813 | * TODO: Support for units > 1? | 812 | * TODO: Support for units > 1? |
| 814 | */ | 813 | */ |
| 815 | acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | 814 | acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) |
| 816 | { | 815 | { |
| 817 | acpi_status status = AE_OK; | 816 | acpi_status status = AE_OK; |
| 818 | struct semaphore *sem = (struct semaphore *)handle; | 817 | struct semaphore *sem = (struct semaphore *)handle; |
| 818 | long jiffies; | ||
| 819 | int ret = 0; | 819 | int ret = 0; |
| 820 | 820 | ||
| 821 | |||
| 822 | if (!sem || (units < 1)) | 821 | if (!sem || (units < 1)) |
| 823 | return AE_BAD_PARAMETER; | 822 | return AE_BAD_PARAMETER; |
| 824 | 823 | ||
| @@ -828,58 +827,14 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
| 828 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", | 827 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", |
| 829 | handle, units, timeout)); | 828 | handle, units, timeout)); |
| 830 | 829 | ||
| 831 | /* | 830 | if (timeout == ACPI_WAIT_FOREVER) |
| 832 | * This can be called during resume with interrupts off. | 831 | jiffies = MAX_SCHEDULE_TIMEOUT; |
| 833 | * Like boot-time, we should be single threaded and will | 832 | else |
| 834 | * always get the lock if we try -- timeout or not. | 833 | jiffies = msecs_to_jiffies(timeout); |
| 835 | * If this doesn't succeed, then we will oops courtesy of | 834 | |
| 836 | * might_sleep() in down(). | 835 | ret = down_timeout(sem, jiffies); |
| 837 | */ | 836 | if (ret) |
| 838 | if (!down_trylock(sem)) | 837 | status = AE_TIME; |
| 839 | return AE_OK; | ||
| 840 | |||
| 841 | switch (timeout) { | ||
| 842 | /* | ||
| 843 | * No Wait: | ||
| 844 | * -------- | ||
| 845 | * A zero timeout value indicates that we shouldn't wait - just | ||
| 846 | * acquire the semaphore if available otherwise return AE_TIME | ||
| 847 | * (a.k.a. 'would block'). | ||
| 848 | */ | ||
| 849 | case 0: | ||
| 850 | if (down_trylock(sem)) | ||
| 851 | status = AE_TIME; | ||
| 852 | break; | ||
| 853 | |||
| 854 | /* | ||
| 855 | * Wait Indefinitely: | ||
| 856 | * ------------------ | ||
| 857 | */ | ||
| 858 | case ACPI_WAIT_FOREVER: | ||
| 859 | down(sem); | ||
| 860 | break; | ||
| 861 | |||
| 862 | /* | ||
| 863 | * Wait w/ Timeout: | ||
| 864 | * ---------------- | ||
| 865 | */ | ||
| 866 | default: | ||
| 867 | // TODO: A better timeout algorithm? | ||
| 868 | { | ||
| 869 | int i = 0; | ||
| 870 | static const int quantum_ms = 1000 / HZ; | ||
| 871 | |||
| 872 | ret = down_trylock(sem); | ||
| 873 | for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) { | ||
| 874 | schedule_timeout_interruptible(1); | ||
| 875 | ret = down_trylock(sem); | ||
| 876 | } | ||
| 877 | |||
| 878 | if (ret != 0) | ||
| 879 | status = AE_TIME; | ||
| 880 | } | ||
| 881 | break; | ||
| 882 | } | ||
| 883 | 838 | ||
| 884 | if (ACPI_FAILURE(status)) { | 839 | if (ACPI_FAILURE(status)) { |
| 885 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 840 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
| @@ -902,7 +857,6 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) | |||
| 902 | { | 857 | { |
| 903 | struct semaphore *sem = (struct semaphore *)handle; | 858 | struct semaphore *sem = (struct semaphore *)handle; |
| 904 | 859 | ||
| 905 | |||
| 906 | if (!sem || (units < 1)) | 860 | if (!sem || (units < 1)) |
| 907 | return AE_BAD_PARAMETER; | 861 | return AE_BAD_PARAMETER; |
| 908 | 862 | ||
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 76bf6d90c700..f2a76acecfcd 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -121,7 +121,7 @@ acpi_power_get_context(acpi_handle handle, | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | *resource = acpi_driver_data(device); | 123 | *resource = acpi_driver_data(device); |
| 124 | if (!resource) | 124 | if (!*resource) |
| 125 | return -ENODEV; | 125 | return -ENODEV; |
| 126 | 126 | ||
| 127 | return 0; | 127 | return 0; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index a825b431b64f..ea5f628dcc15 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -674,22 +674,21 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
| 674 | result = PTR_ERR(pr->cdev); | 674 | result = PTR_ERR(pr->cdev); |
| 675 | goto end; | 675 | goto end; |
| 676 | } | 676 | } |
| 677 | if (pr->cdev) { | 677 | |
| 678 | printk(KERN_INFO PREFIX | 678 | printk(KERN_INFO PREFIX |
| 679 | "%s is registered as cooling_device%d\n", | 679 | "%s is registered as cooling_device%d\n", |
| 680 | device->dev.bus_id, pr->cdev->id); | 680 | device->dev.bus_id, pr->cdev->id); |
| 681 | 681 | ||
| 682 | result = sysfs_create_link(&device->dev.kobj, | 682 | result = sysfs_create_link(&device->dev.kobj, |
| 683 | &pr->cdev->device.kobj, | 683 | &pr->cdev->device.kobj, |
| 684 | "thermal_cooling"); | 684 | "thermal_cooling"); |
| 685 | if (result) | 685 | if (result) |
| 686 | return result; | 686 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
| 687 | result = sysfs_create_link(&pr->cdev->device.kobj, | 687 | result = sysfs_create_link(&pr->cdev->device.kobj, |
| 688 | &device->dev.kobj, | 688 | &device->dev.kobj, |
| 689 | "device"); | 689 | "device"); |
| 690 | if (result) | 690 | if (result) |
| 691 | return result; | 691 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
| 692 | } | ||
| 693 | 692 | ||
| 694 | if (pr->flags.throttling) { | 693 | if (pr->flags.throttling) { |
| 695 | printk(KERN_INFO PREFIX "%s [%s] (supports", | 694 | printk(KERN_INFO PREFIX "%s [%s] (supports", |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 788da9781f80..55d69dce47c4 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -418,13 +418,12 @@ static void acpi_processor_idle(void) | |||
| 418 | 418 | ||
| 419 | cx = pr->power.state; | 419 | cx = pr->power.state; |
| 420 | if (!cx || acpi_idle_suspend) { | 420 | if (!cx || acpi_idle_suspend) { |
| 421 | if (pm_idle_save) | 421 | if (pm_idle_save) { |
| 422 | pm_idle_save(); | 422 | pm_idle_save(); /* enables IRQs */ |
| 423 | else | 423 | } else { |
| 424 | acpi_safe_halt(); | 424 | acpi_safe_halt(); |
| 425 | |||
| 426 | if (irqs_disabled()) | ||
| 427 | local_irq_enable(); | 425 | local_irq_enable(); |
| 426 | } | ||
| 428 | 427 | ||
| 429 | return; | 428 | return; |
| 430 | } | 429 | } |
| @@ -520,10 +519,12 @@ static void acpi_processor_idle(void) | |||
| 520 | * Use the appropriate idle routine, the one that would | 519 | * Use the appropriate idle routine, the one that would |
| 521 | * be used without acpi C-states. | 520 | * be used without acpi C-states. |
| 522 | */ | 521 | */ |
| 523 | if (pm_idle_save) | 522 | if (pm_idle_save) { |
| 524 | pm_idle_save(); | 523 | pm_idle_save(); /* enables IRQs */ |
| 525 | else | 524 | } else { |
| 526 | acpi_safe_halt(); | 525 | acpi_safe_halt(); |
| 526 | local_irq_enable(); | ||
| 527 | } | ||
| 527 | 528 | ||
| 528 | /* | 529 | /* |
| 529 | * TBD: Can't get time duration while in C1, as resumes | 530 | * TBD: Can't get time duration while in C1, as resumes |
| @@ -534,8 +535,6 @@ static void acpi_processor_idle(void) | |||
| 534 | * skew otherwise. | 535 | * skew otherwise. |
| 535 | */ | 536 | */ |
| 536 | sleep_ticks = 0xFFFFFFFF; | 537 | sleep_ticks = 0xFFFFFFFF; |
| 537 | if (irqs_disabled()) | ||
| 538 | local_irq_enable(); | ||
| 539 | 538 | ||
| 540 | break; | 539 | break; |
| 541 | 540 | ||
| @@ -848,6 +847,7 @@ static int acpi_processor_get_power_info_default(struct acpi_processor *pr) | |||
| 848 | /* all processors need to support C1 */ | 847 | /* all processors need to support C1 */ |
| 849 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | 848 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; |
| 850 | pr->power.states[ACPI_STATE_C1].valid = 1; | 849 | pr->power.states[ACPI_STATE_C1].valid = 1; |
| 850 | pr->power.states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_HALT; | ||
| 851 | } | 851 | } |
| 852 | /* the C0 state only exists as a filler in our array */ | 852 | /* the C0 state only exists as a filler in our array */ |
| 853 | pr->power.states[ACPI_STATE_C0].valid = 1; | 853 | pr->power.states[ACPI_STATE_C0].valid = 1; |
| @@ -960,6 +960,9 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
| 960 | cx.address); | 960 | cx.address); |
| 961 | } | 961 | } |
| 962 | 962 | ||
| 963 | if (cx.type == ACPI_STATE_C1) { | ||
| 964 | cx.valid = 1; | ||
| 965 | } | ||
| 963 | 966 | ||
| 964 | obj = &(element->package.elements[2]); | 967 | obj = &(element->package.elements[2]); |
| 965 | if (obj->type != ACPI_TYPE_INTEGER) | 968 | if (obj->type != ACPI_TYPE_INTEGER) |
| @@ -1295,6 +1298,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
| 1295 | { | 1298 | { |
| 1296 | int result = 0; | 1299 | int result = 0; |
| 1297 | 1300 | ||
| 1301 | if (boot_option_idle_override) | ||
| 1302 | return 0; | ||
| 1298 | 1303 | ||
| 1299 | if (!pr) | 1304 | if (!pr) |
| 1300 | return -EINVAL; | 1305 | return -EINVAL; |
| @@ -1734,6 +1739,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
| 1734 | { | 1739 | { |
| 1735 | int ret; | 1740 | int ret; |
| 1736 | 1741 | ||
| 1742 | if (boot_option_idle_override) | ||
| 1743 | return 0; | ||
| 1744 | |||
| 1737 | if (!pr) | 1745 | if (!pr) |
| 1738 | return -EINVAL; | 1746 | return -EINVAL; |
| 1739 | 1747 | ||
| @@ -1764,6 +1772,8 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
| 1764 | struct proc_dir_entry *entry = NULL; | 1772 | struct proc_dir_entry *entry = NULL; |
| 1765 | unsigned int i; | 1773 | unsigned int i; |
| 1766 | 1774 | ||
| 1775 | if (boot_option_idle_override) | ||
| 1776 | return 0; | ||
| 1767 | 1777 | ||
| 1768 | if (!first_run) { | 1778 | if (!first_run) { |
| 1769 | dmi_check_system(processor_power_dmi_table); | 1779 | dmi_check_system(processor_power_dmi_table); |
| @@ -1799,7 +1809,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
| 1799 | * Note that we use previously set idle handler will be used on | 1809 | * Note that we use previously set idle handler will be used on |
| 1800 | * platforms that only support C1. | 1810 | * platforms that only support C1. |
| 1801 | */ | 1811 | */ |
| 1802 | if ((pr->flags.power) && (!boot_option_idle_override)) { | 1812 | if (pr->flags.power) { |
| 1803 | #ifdef CONFIG_CPU_IDLE | 1813 | #ifdef CONFIG_CPU_IDLE |
| 1804 | acpi_processor_setup_cpuidle(pr); | 1814 | acpi_processor_setup_cpuidle(pr); |
| 1805 | pr->power.dev.cpu = pr->id; | 1815 | pr->power.dev.cpu = pr->id; |
| @@ -1839,8 +1849,11 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
| 1839 | int acpi_processor_power_exit(struct acpi_processor *pr, | 1849 | int acpi_processor_power_exit(struct acpi_processor *pr, |
| 1840 | struct acpi_device *device) | 1850 | struct acpi_device *device) |
| 1841 | { | 1851 | { |
| 1852 | if (boot_option_idle_override) | ||
| 1853 | return 0; | ||
| 1854 | |||
| 1842 | #ifdef CONFIG_CPU_IDLE | 1855 | #ifdef CONFIG_CPU_IDLE |
| 1843 | if ((pr->flags.power) && (!boot_option_idle_override)) | 1856 | if (pr->flags.power) |
| 1844 | cpuidle_unregister_device(&pr->power.dev); | 1857 | cpuidle_unregister_device(&pr->power.dev); |
| 1845 | #endif | 1858 | #endif |
| 1846 | pr->flags.power_setup_done = 0; | 1859 | pr->flags.power_setup_done = 0; |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 9cb43f52f7b6..649ae99b9216 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
| @@ -97,7 +97,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) | |||
| 97 | #define CPUFREQ_THERMAL_MIN_STEP 0 | 97 | #define CPUFREQ_THERMAL_MIN_STEP 0 |
| 98 | #define CPUFREQ_THERMAL_MAX_STEP 3 | 98 | #define CPUFREQ_THERMAL_MAX_STEP 3 |
| 99 | 99 | ||
| 100 | static unsigned int cpufreq_thermal_reduction_pctg[NR_CPUS]; | 100 | static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg); |
| 101 | static unsigned int acpi_thermal_cpufreq_is_init = 0; | 101 | static unsigned int acpi_thermal_cpufreq_is_init = 0; |
| 102 | 102 | ||
| 103 | static int cpu_has_cpufreq(unsigned int cpu) | 103 | static int cpu_has_cpufreq(unsigned int cpu) |
| @@ -113,9 +113,9 @@ static int acpi_thermal_cpufreq_increase(unsigned int cpu) | |||
| 113 | if (!cpu_has_cpufreq(cpu)) | 113 | if (!cpu_has_cpufreq(cpu)) |
| 114 | return -ENODEV; | 114 | return -ENODEV; |
| 115 | 115 | ||
| 116 | if (cpufreq_thermal_reduction_pctg[cpu] < | 116 | if (per_cpu(cpufreq_thermal_reduction_pctg, cpu) < |
| 117 | CPUFREQ_THERMAL_MAX_STEP) { | 117 | CPUFREQ_THERMAL_MAX_STEP) { |
| 118 | cpufreq_thermal_reduction_pctg[cpu]++; | 118 | per_cpu(cpufreq_thermal_reduction_pctg, cpu)++; |
| 119 | cpufreq_update_policy(cpu); | 119 | cpufreq_update_policy(cpu); |
| 120 | return 0; | 120 | return 0; |
| 121 | } | 121 | } |
| @@ -128,14 +128,14 @@ static int acpi_thermal_cpufreq_decrease(unsigned int cpu) | |||
| 128 | if (!cpu_has_cpufreq(cpu)) | 128 | if (!cpu_has_cpufreq(cpu)) |
| 129 | return -ENODEV; | 129 | return -ENODEV; |
| 130 | 130 | ||
| 131 | if (cpufreq_thermal_reduction_pctg[cpu] > | 131 | if (per_cpu(cpufreq_thermal_reduction_pctg, cpu) > |
| 132 | (CPUFREQ_THERMAL_MIN_STEP + 1)) | 132 | (CPUFREQ_THERMAL_MIN_STEP + 1)) |
| 133 | cpufreq_thermal_reduction_pctg[cpu]--; | 133 | per_cpu(cpufreq_thermal_reduction_pctg, cpu)--; |
| 134 | else | 134 | else |
| 135 | cpufreq_thermal_reduction_pctg[cpu] = 0; | 135 | per_cpu(cpufreq_thermal_reduction_pctg, cpu) = 0; |
| 136 | cpufreq_update_policy(cpu); | 136 | cpufreq_update_policy(cpu); |
| 137 | /* We reached max freq again and can leave passive mode */ | 137 | /* We reached max freq again and can leave passive mode */ |
| 138 | return !cpufreq_thermal_reduction_pctg[cpu]; | 138 | return !per_cpu(cpufreq_thermal_reduction_pctg, cpu); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, | 141 | static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, |
| @@ -147,9 +147,10 @@ static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, | |||
| 147 | if (event != CPUFREQ_ADJUST) | 147 | if (event != CPUFREQ_ADJUST) |
| 148 | goto out; | 148 | goto out; |
| 149 | 149 | ||
| 150 | max_freq = | 150 | max_freq = ( |
| 151 | (policy->cpuinfo.max_freq * | 151 | policy->cpuinfo.max_freq * |
| 152 | (100 - cpufreq_thermal_reduction_pctg[policy->cpu] * 20)) / 100; | 152 | (100 - per_cpu(cpufreq_thermal_reduction_pctg, policy->cpu) * 20) |
| 153 | ) / 100; | ||
| 153 | 154 | ||
| 154 | cpufreq_verify_within_limits(policy, 0, max_freq); | 155 | cpufreq_verify_within_limits(policy, 0, max_freq); |
| 155 | 156 | ||
| @@ -174,7 +175,7 @@ static int cpufreq_get_cur_state(unsigned int cpu) | |||
| 174 | if (!cpu_has_cpufreq(cpu)) | 175 | if (!cpu_has_cpufreq(cpu)) |
| 175 | return 0; | 176 | return 0; |
| 176 | 177 | ||
| 177 | return cpufreq_thermal_reduction_pctg[cpu]; | 178 | return per_cpu(cpufreq_thermal_reduction_pctg, cpu); |
| 178 | } | 179 | } |
| 179 | 180 | ||
| 180 | static int cpufreq_set_cur_state(unsigned int cpu, int state) | 181 | static int cpufreq_set_cur_state(unsigned int cpu, int state) |
| @@ -182,7 +183,7 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) | |||
| 182 | if (!cpu_has_cpufreq(cpu)) | 183 | if (!cpu_has_cpufreq(cpu)) |
| 183 | return 0; | 184 | return 0; |
| 184 | 185 | ||
| 185 | cpufreq_thermal_reduction_pctg[cpu] = state; | 186 | per_cpu(cpufreq_thermal_reduction_pctg, cpu) = state; |
| 186 | cpufreq_update_policy(cpu); | 187 | cpufreq_update_policy(cpu); |
| 187 | return 0; | 188 | return 0; |
| 188 | } | 189 | } |
| @@ -191,8 +192,9 @@ void acpi_thermal_cpufreq_init(void) | |||
| 191 | { | 192 | { |
| 192 | int i; | 193 | int i; |
| 193 | 194 | ||
| 194 | for (i = 0; i < NR_CPUS; i++) | 195 | for (i = 0; i < nr_cpu_ids; i++) |
| 195 | cpufreq_thermal_reduction_pctg[i] = 0; | 196 | if (cpu_present(i)) |
| 197 | per_cpu(cpufreq_thermal_reduction_pctg, i) = 0; | ||
| 196 | 198 | ||
| 197 | i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block, | 199 | i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block, |
| 198 | CPUFREQ_POLICY_NOTIFIER); | 200 | CPUFREQ_POLICY_NOTIFIER); |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 1b8e592a8241..0bba3a914e86 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
| @@ -838,10 +838,10 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) | |||
| 838 | * Migrate task to the cpu pointed by pr. | 838 | * Migrate task to the cpu pointed by pr. |
| 839 | */ | 839 | */ |
| 840 | saved_mask = current->cpus_allowed; | 840 | saved_mask = current->cpus_allowed; |
| 841 | set_cpus_allowed(current, cpumask_of_cpu(pr->id)); | 841 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(pr->id)); |
| 842 | ret = pr->throttling.acpi_processor_get_throttling(pr); | 842 | ret = pr->throttling.acpi_processor_get_throttling(pr); |
| 843 | /* restore the previous state */ | 843 | /* restore the previous state */ |
| 844 | set_cpus_allowed(current, saved_mask); | 844 | set_cpus_allowed_ptr(current, &saved_mask); |
| 845 | 845 | ||
| 846 | return ret; | 846 | return ret; |
| 847 | } | 847 | } |
| @@ -1025,7 +1025,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
| 1025 | * it can be called only for the cpu pointed by pr. | 1025 | * it can be called only for the cpu pointed by pr. |
| 1026 | */ | 1026 | */ |
| 1027 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { | 1027 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { |
| 1028 | set_cpus_allowed(current, cpumask_of_cpu(pr->id)); | 1028 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(pr->id)); |
| 1029 | ret = p_throttling->acpi_processor_set_throttling(pr, | 1029 | ret = p_throttling->acpi_processor_set_throttling(pr, |
| 1030 | t_state.target_state); | 1030 | t_state.target_state); |
| 1031 | } else { | 1031 | } else { |
| @@ -1056,7 +1056,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
| 1056 | continue; | 1056 | continue; |
| 1057 | } | 1057 | } |
| 1058 | t_state.cpu = i; | 1058 | t_state.cpu = i; |
| 1059 | set_cpus_allowed(current, cpumask_of_cpu(i)); | 1059 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(i)); |
| 1060 | ret = match_pr->throttling. | 1060 | ret = match_pr->throttling. |
| 1061 | acpi_processor_set_throttling( | 1061 | acpi_processor_set_throttling( |
| 1062 | match_pr, t_state.target_state); | 1062 | match_pr, t_state.target_state); |
| @@ -1074,7 +1074,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
| 1074 | &t_state); | 1074 | &t_state); |
| 1075 | } | 1075 | } |
| 1076 | /* restore the previous state */ | 1076 | /* restore the previous state */ |
| 1077 | set_cpus_allowed(current, saved_mask); | 1077 | set_cpus_allowed_ptr(current, &saved_mask); |
| 1078 | return ret; | 1078 | return ret; |
| 1079 | } | 1079 | } |
| 1080 | 1080 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 464ee6ea8c61..6d85289f1c12 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -691,6 +691,9 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
| 691 | acpi_status status = 0; | 691 | acpi_status status = 0; |
| 692 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 692 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 693 | union acpi_object *package = NULL; | 693 | union acpi_object *package = NULL; |
| 694 | union acpi_object in_arg[3]; | ||
| 695 | struct acpi_object_list arg_list = { 3, in_arg }; | ||
| 696 | acpi_status psw_status = AE_OK; | ||
| 694 | 697 | ||
| 695 | struct acpi_device_id button_device_ids[] = { | 698 | struct acpi_device_id button_device_ids[] = { |
| 696 | {"PNP0C0D", 0}, | 699 | {"PNP0C0D", 0}, |
| @@ -699,7 +702,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
| 699 | {"", 0}, | 702 | {"", 0}, |
| 700 | }; | 703 | }; |
| 701 | 704 | ||
| 702 | |||
| 703 | /* _PRW */ | 705 | /* _PRW */ |
| 704 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); | 706 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); |
| 705 | if (ACPI_FAILURE(status)) { | 707 | if (ACPI_FAILURE(status)) { |
| @@ -717,6 +719,45 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
| 717 | kfree(buffer.pointer); | 719 | kfree(buffer.pointer); |
| 718 | 720 | ||
| 719 | device->wakeup.flags.valid = 1; | 721 | device->wakeup.flags.valid = 1; |
| 722 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping | ||
| 723 | * system for the ACPI device with the _PRW object. | ||
| 724 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. | ||
| 725 | * So it is necessary to call _DSW object first. Only when it is not | ||
| 726 | * present will the _PSW object used. | ||
| 727 | */ | ||
| 728 | /* | ||
| 729 | * Three agruments are needed for the _DSW object. | ||
| 730 | * Argument 0: enable/disable the wake capabilities | ||
| 731 | * When _DSW object is called to disable the wake capabilities, maybe | ||
| 732 | * the first argument is filled. The value of the other two agruments | ||
| 733 | * is meaningless. | ||
| 734 | */ | ||
| 735 | in_arg[0].type = ACPI_TYPE_INTEGER; | ||
| 736 | in_arg[0].integer.value = 0; | ||
| 737 | in_arg[1].type = ACPI_TYPE_INTEGER; | ||
| 738 | in_arg[1].integer.value = 0; | ||
| 739 | in_arg[2].type = ACPI_TYPE_INTEGER; | ||
| 740 | in_arg[2].integer.value = 0; | ||
| 741 | psw_status = acpi_evaluate_object(device->handle, "_DSW", | ||
| 742 | &arg_list, NULL); | ||
| 743 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
| 744 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _DSW\n")); | ||
| 745 | /* | ||
| 746 | * When the _DSW object is not present, OSPM will call _PSW object. | ||
| 747 | */ | ||
| 748 | if (psw_status == AE_NOT_FOUND) { | ||
| 749 | /* | ||
| 750 | * Only one agruments is required for the _PSW object. | ||
| 751 | * agrument 0: enable/disable the wake capabilities | ||
| 752 | */ | ||
| 753 | arg_list.count = 1; | ||
| 754 | in_arg[0].integer.value = 0; | ||
| 755 | psw_status = acpi_evaluate_object(device->handle, "_PSW", | ||
| 756 | &arg_list, NULL); | ||
| 757 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
| 758 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in " | ||
| 759 | "evaluate _PSW\n")); | ||
| 760 | } | ||
| 720 | /* Power button, Lid switch always enable wakeup */ | 761 | /* Power button, Lid switch always enable wakeup */ |
| 721 | if (!acpi_match_device_ids(device, button_device_ids)) | 762 | if (!acpi_match_device_ids(device, button_device_ids)) |
| 722 | device->wakeup.flags.run_wake = 1; | 763 | device->wakeup.flags.run_wake = 1; |
| @@ -881,10 +922,7 @@ static void acpi_device_get_busid(struct acpi_device *device, | |||
| 881 | static int | 922 | static int |
| 882 | acpi_video_bus_match(struct acpi_device *device) | 923 | acpi_video_bus_match(struct acpi_device *device) |
| 883 | { | 924 | { |
| 884 | acpi_handle h_dummy1; | 925 | acpi_handle h_dummy; |
| 885 | acpi_handle h_dummy2; | ||
| 886 | acpi_handle h_dummy3; | ||
| 887 | |||
| 888 | 926 | ||
| 889 | if (!device) | 927 | if (!device) |
| 890 | return -EINVAL; | 928 | return -EINVAL; |
| @@ -894,18 +932,18 @@ acpi_video_bus_match(struct acpi_device *device) | |||
| 894 | */ | 932 | */ |
| 895 | 933 | ||
| 896 | /* Does this device able to support video switching ? */ | 934 | /* Does this device able to support video switching ? */ |
| 897 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && | 935 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && |
| 898 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) | 936 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) |
| 899 | return 0; | 937 | return 0; |
| 900 | 938 | ||
| 901 | /* Does this device able to retrieve a video ROM ? */ | 939 | /* Does this device able to retrieve a video ROM ? */ |
| 902 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) | 940 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) |
| 903 | return 0; | 941 | return 0; |
| 904 | 942 | ||
| 905 | /* Does this device able to configure which video head to be POSTed ? */ | 943 | /* Does this device able to configure which video head to be POSTed ? */ |
| 906 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && | 944 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && |
| 907 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && | 945 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && |
| 908 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) | 946 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) |
| 909 | return 0; | 947 | return 0; |
| 910 | 948 | ||
| 911 | return -ENODEV; | 949 | return -ENODEV; |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 71183eea7906..c3b0cd88d09f 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
| @@ -51,7 +51,7 @@ static int acpi_sleep_prepare(u32 acpi_state) | |||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | #ifdef CONFIG_SUSPEND | 53 | #ifdef CONFIG_SUSPEND |
| 54 | static struct platform_suspend_ops acpi_pm_ops; | 54 | static struct platform_suspend_ops acpi_suspend_ops; |
| 55 | 55 | ||
| 56 | extern void do_suspend_lowlevel(void); | 56 | extern void do_suspend_lowlevel(void); |
| 57 | 57 | ||
| @@ -65,11 +65,11 @@ static u32 acpi_suspend_states[] = { | |||
| 65 | static int init_8259A_after_S1; | 65 | static int init_8259A_after_S1; |
| 66 | 66 | ||
| 67 | /** | 67 | /** |
| 68 | * acpi_pm_begin - Set the target system sleep state to the state | 68 | * acpi_suspend_begin - Set the target system sleep state to the state |
| 69 | * associated with given @pm_state, if supported. | 69 | * associated with given @pm_state, if supported. |
| 70 | */ | 70 | */ |
| 71 | 71 | ||
| 72 | static int acpi_pm_begin(suspend_state_t pm_state) | 72 | static int acpi_suspend_begin(suspend_state_t pm_state) |
| 73 | { | 73 | { |
| 74 | u32 acpi_state = acpi_suspend_states[pm_state]; | 74 | u32 acpi_state = acpi_suspend_states[pm_state]; |
| 75 | int error = 0; | 75 | int error = 0; |
| @@ -85,13 +85,13 @@ static int acpi_pm_begin(suspend_state_t pm_state) | |||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| 88 | * acpi_pm_prepare - Do preliminary suspend work. | 88 | * acpi_suspend_prepare - Do preliminary suspend work. |
| 89 | * | 89 | * |
| 90 | * If necessary, set the firmware waking vector and do arch-specific | 90 | * If necessary, set the firmware waking vector and do arch-specific |
| 91 | * nastiness to get the wakeup code to the waking vector. | 91 | * nastiness to get the wakeup code to the waking vector. |
| 92 | */ | 92 | */ |
| 93 | 93 | ||
| 94 | static int acpi_pm_prepare(void) | 94 | static int acpi_suspend_prepare(void) |
| 95 | { | 95 | { |
| 96 | int error = acpi_sleep_prepare(acpi_target_sleep_state); | 96 | int error = acpi_sleep_prepare(acpi_target_sleep_state); |
| 97 | 97 | ||
| @@ -104,7 +104,7 @@ static int acpi_pm_prepare(void) | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | /** | 106 | /** |
| 107 | * acpi_pm_enter - Actually enter a sleep state. | 107 | * acpi_suspend_enter - Actually enter a sleep state. |
| 108 | * @pm_state: ignored | 108 | * @pm_state: ignored |
| 109 | * | 109 | * |
| 110 | * Flush caches and go to sleep. For STR we have to call arch-specific | 110 | * Flush caches and go to sleep. For STR we have to call arch-specific |
| @@ -112,7 +112,7 @@ static int acpi_pm_prepare(void) | |||
| 112 | * It's unfortunate, but it works. Please fix if you're feeling frisky. | 112 | * It's unfortunate, but it works. Please fix if you're feeling frisky. |
| 113 | */ | 113 | */ |
| 114 | 114 | ||
| 115 | static int acpi_pm_enter(suspend_state_t pm_state) | 115 | static int acpi_suspend_enter(suspend_state_t pm_state) |
| 116 | { | 116 | { |
| 117 | acpi_status status = AE_OK; | 117 | acpi_status status = AE_OK; |
| 118 | unsigned long flags = 0; | 118 | unsigned long flags = 0; |
| @@ -169,13 +169,13 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | /** | 171 | /** |
| 172 | * acpi_pm_finish - Instruct the platform to leave a sleep state. | 172 | * acpi_suspend_finish - Instruct the platform to leave a sleep state. |
| 173 | * | 173 | * |
| 174 | * This is called after we wake back up (or if entering the sleep state | 174 | * This is called after we wake back up (or if entering the sleep state |
| 175 | * failed). | 175 | * failed). |
| 176 | */ | 176 | */ |
| 177 | 177 | ||
| 178 | static void acpi_pm_finish(void) | 178 | static void acpi_suspend_finish(void) |
| 179 | { | 179 | { |
| 180 | u32 acpi_state = acpi_target_sleep_state; | 180 | u32 acpi_state = acpi_target_sleep_state; |
| 181 | 181 | ||
| @@ -196,19 +196,19 @@ static void acpi_pm_finish(void) | |||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | /** | 198 | /** |
| 199 | * acpi_pm_end - Finish up suspend sequence. | 199 | * acpi_suspend_end - Finish up suspend sequence. |
| 200 | */ | 200 | */ |
| 201 | 201 | ||
| 202 | static void acpi_pm_end(void) | 202 | static void acpi_suspend_end(void) |
| 203 | { | 203 | { |
| 204 | /* | 204 | /* |
| 205 | * This is necessary in case acpi_pm_finish() is not called during a | 205 | * This is necessary in case acpi_suspend_finish() is not called during a |
| 206 | * failing transition to a sleep state. | 206 | * failing transition to a sleep state. |
| 207 | */ | 207 | */ |
| 208 | acpi_target_sleep_state = ACPI_STATE_S0; | 208 | acpi_target_sleep_state = ACPI_STATE_S0; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | static int acpi_pm_state_valid(suspend_state_t pm_state) | 211 | static int acpi_suspend_state_valid(suspend_state_t pm_state) |
| 212 | { | 212 | { |
| 213 | u32 acpi_state; | 213 | u32 acpi_state; |
| 214 | 214 | ||
| @@ -224,13 +224,13 @@ static int acpi_pm_state_valid(suspend_state_t pm_state) | |||
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static struct platform_suspend_ops acpi_pm_ops = { | 227 | static struct platform_suspend_ops acpi_suspend_ops = { |
| 228 | .valid = acpi_pm_state_valid, | 228 | .valid = acpi_suspend_state_valid, |
| 229 | .begin = acpi_pm_begin, | 229 | .begin = acpi_suspend_begin, |
| 230 | .prepare = acpi_pm_prepare, | 230 | .prepare = acpi_suspend_prepare, |
| 231 | .enter = acpi_pm_enter, | 231 | .enter = acpi_suspend_enter, |
| 232 | .finish = acpi_pm_finish, | 232 | .finish = acpi_suspend_finish, |
| 233 | .end = acpi_pm_end, | 233 | .end = acpi_suspend_end, |
| 234 | }; | 234 | }; |
| 235 | 235 | ||
| 236 | /* | 236 | /* |
| @@ -492,7 +492,7 @@ int __init acpi_sleep_init(void) | |||
| 492 | } | 492 | } |
| 493 | } | 493 | } |
| 494 | 494 | ||
| 495 | suspend_set_ops(&acpi_pm_ops); | 495 | suspend_set_ops(&acpi_suspend_ops); |
| 496 | #endif | 496 | #endif |
| 497 | 497 | ||
| 498 | #ifdef CONFIG_HIBERNATION | 498 | #ifdef CONFIG_HIBERNATION |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 1bcecc7dd2ca..782c2250443e 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -884,10 +884,15 @@ static void acpi_thermal_check(void *data) | |||
| 884 | static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) | 884 | static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) |
| 885 | { | 885 | { |
| 886 | struct acpi_thermal *tz = thermal->devdata; | 886 | struct acpi_thermal *tz = thermal->devdata; |
| 887 | int result; | ||
| 887 | 888 | ||
| 888 | if (!tz) | 889 | if (!tz) |
| 889 | return -EINVAL; | 890 | return -EINVAL; |
| 890 | 891 | ||
| 892 | result = acpi_thermal_get_temperature(tz); | ||
| 893 | if (result) | ||
| 894 | return result; | ||
| 895 | |||
| 891 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); | 896 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); |
| 892 | } | 897 | } |
| 893 | 898 | ||
| @@ -1012,6 +1017,18 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
| 1012 | return -EINVAL; | 1017 | return -EINVAL; |
| 1013 | } | 1018 | } |
| 1014 | 1019 | ||
| 1020 | static int thermal_get_crit_temp(struct thermal_zone_device *thermal, | ||
| 1021 | unsigned long *temperature) { | ||
| 1022 | struct acpi_thermal *tz = thermal->devdata; | ||
| 1023 | |||
| 1024 | if (tz->trips.critical.flags.valid) { | ||
| 1025 | *temperature = KELVIN_TO_MILLICELSIUS( | ||
| 1026 | tz->trips.critical.temperature); | ||
| 1027 | return 0; | ||
| 1028 | } else | ||
| 1029 | return -EINVAL; | ||
| 1030 | } | ||
| 1031 | |||
| 1015 | typedef int (*cb)(struct thermal_zone_device *, int, | 1032 | typedef int (*cb)(struct thermal_zone_device *, int, |
| 1016 | struct thermal_cooling_device *); | 1033 | struct thermal_cooling_device *); |
| 1017 | static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, | 1034 | static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, |
| @@ -1103,6 +1120,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { | |||
| 1103 | .set_mode = thermal_set_mode, | 1120 | .set_mode = thermal_set_mode, |
| 1104 | .get_trip_type = thermal_get_trip_type, | 1121 | .get_trip_type = thermal_get_trip_type, |
| 1105 | .get_trip_temp = thermal_get_trip_temp, | 1122 | .get_trip_temp = thermal_get_trip_temp, |
| 1123 | .get_crit_temp = thermal_get_crit_temp, | ||
| 1106 | }; | 1124 | }; |
| 1107 | 1125 | ||
| 1108 | static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | 1126 | static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) |
| @@ -1123,7 +1141,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
| 1123 | 1141 | ||
| 1124 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && | 1142 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && |
| 1125 | tz->trips.active[i].flags.valid; i++, trips++); | 1143 | tz->trips.active[i].flags.valid; i++, trips++); |
| 1126 | tz->thermal_zone = thermal_zone_device_register("ACPI thermal zone", | 1144 | tz->thermal_zone = thermal_zone_device_register("acpitz", |
| 1127 | trips, tz, &acpi_thermal_zone_ops); | 1145 | trips, tz, &acpi_thermal_zone_ops); |
| 1128 | if (IS_ERR(tz->thermal_zone)) | 1146 | if (IS_ERR(tz->thermal_zone)) |
| 1129 | return -ENODEV; | 1147 | return -ENODEV; |
| @@ -1710,7 +1728,6 @@ static int acpi_thermal_resume(struct acpi_device *device) | |||
| 1710 | return AE_OK; | 1728 | return AE_OK; |
| 1711 | } | 1729 | } |
| 1712 | 1730 | ||
| 1713 | #ifdef CONFIG_DMI | ||
| 1714 | static int thermal_act(const struct dmi_system_id *d) { | 1731 | static int thermal_act(const struct dmi_system_id *d) { |
| 1715 | 1732 | ||
| 1716 | if (act == 0) { | 1733 | if (act == 0) { |
| @@ -1785,7 +1802,6 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = { | |||
| 1785 | }, | 1802 | }, |
| 1786 | {} | 1803 | {} |
| 1787 | }; | 1804 | }; |
| 1788 | #endif /* CONFIG_DMI */ | ||
| 1789 | 1805 | ||
| 1790 | static int __init acpi_thermal_init(void) | 1806 | static int __init acpi_thermal_init(void) |
| 1791 | { | 1807 | { |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index a92d91277ef9..f8bdadf3c32f 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
| @@ -193,24 +193,6 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | /* | ||
| 197 | * Complete the GPE initialization for the GPE blocks defined in the FADT | ||
| 198 | * (GPE block 0 and 1). | ||
| 199 | * | ||
| 200 | * Note1: This is where the _PRW methods are executed for the GPEs. These | ||
| 201 | * methods can only be executed after the SCI and Global Lock handlers are | ||
| 202 | * installed and initialized. | ||
| 203 | * | ||
| 204 | * Note2: Currently, there seems to be no need to run the _REG methods | ||
| 205 | * before execution of the _PRW methods and enabling of the GPEs. | ||
| 206 | */ | ||
| 207 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
| 208 | status = acpi_ev_install_fadt_gpes(); | ||
| 209 | if (ACPI_FAILURE(status)) { | ||
| 210 | return (status); | ||
| 211 | } | ||
| 212 | } | ||
| 213 | |||
| 214 | return_ACPI_STATUS(status); | 196 | return_ACPI_STATUS(status); |
| 215 | } | 197 | } |
| 216 | 198 | ||
| @@ -281,6 +263,23 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
| 281 | } | 263 | } |
| 282 | 264 | ||
| 283 | /* | 265 | /* |
| 266 | * Complete the GPE initialization for the GPE blocks defined in the FADT | ||
| 267 | * (GPE block 0 and 1). | ||
| 268 | * | ||
| 269 | * Note1: This is where the _PRW methods are executed for the GPEs. These | ||
| 270 | * methods can only be executed after the SCI and Global Lock handlers are | ||
| 271 | * installed and initialized. | ||
| 272 | * | ||
| 273 | * Note2: Currently, there seems to be no need to run the _REG methods | ||
| 274 | * before execution of the _PRW methods and enabling of the GPEs. | ||
| 275 | */ | ||
| 276 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
| 277 | status = acpi_ev_install_fadt_gpes(); | ||
| 278 | if (ACPI_FAILURE(status)) | ||
| 279 | return (status); | ||
| 280 | } | ||
| 281 | |||
| 282 | /* | ||
| 284 | * Empty the caches (delete the cached objects) on the assumption that | 283 | * Empty the caches (delete the cached objects) on the assumption that |
| 285 | * the table load filled them up more than they will be at runtime -- | 284 | * the table load filled them up more than they will be at runtime -- |
| 286 | * thus wasting non-paged memory. | 285 | * thus wasting non-paged memory. |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 980a74188781..33c502e56026 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -57,8 +57,6 @@ | |||
| 57 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88 | 57 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88 |
| 58 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89 | 58 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89 |
| 59 | 59 | ||
| 60 | #define ACPI_VIDEO_HEAD_INVALID (~0u - 1) | ||
| 61 | #define ACPI_VIDEO_HEAD_END (~0u) | ||
| 62 | #define MAX_NAME_LEN 20 | 60 | #define MAX_NAME_LEN 20 |
| 63 | 61 | ||
| 64 | #define ACPI_VIDEO_DISPLAY_CRT 1 | 62 | #define ACPI_VIDEO_DISPLAY_CRT 1 |
| @@ -734,21 +732,19 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
| 734 | if (IS_ERR(device->cdev)) | 732 | if (IS_ERR(device->cdev)) |
| 735 | return; | 733 | return; |
| 736 | 734 | ||
| 737 | if (device->cdev) { | 735 | printk(KERN_INFO PREFIX |
| 738 | printk(KERN_INFO PREFIX | 736 | "%s is registered as cooling_device%d\n", |
| 739 | "%s is registered as cooling_device%d\n", | 737 | device->dev->dev.bus_id, device->cdev->id); |
| 740 | device->dev->dev.bus_id, device->cdev->id); | 738 | result = sysfs_create_link(&device->dev->dev.kobj, |
| 741 | result = sysfs_create_link(&device->dev->dev.kobj, | 739 | &device->cdev->device.kobj, |
| 742 | &device->cdev->device.kobj, | 740 | "thermal_cooling"); |
| 743 | "thermal_cooling"); | 741 | if (result) |
| 744 | if (result) | 742 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
| 745 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 743 | result = sysfs_create_link(&device->cdev->device.kobj, |
| 746 | result = sysfs_create_link(&device->cdev->device.kobj, | 744 | &device->dev->dev.kobj, "device"); |
| 747 | &device->dev->dev.kobj, | 745 | if (result) |
| 748 | "device"); | 746 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
| 749 | if (result) | 747 | |
| 750 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | ||
| 751 | } | ||
| 752 | } | 748 | } |
| 753 | if (device->cap._DCS && device->cap._DSS){ | 749 | if (device->cap._DCS && device->cap._DSS){ |
| 754 | static int count = 0; | 750 | static int count = 0; |
| @@ -1050,87 +1046,90 @@ acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file) | |||
| 1050 | 1046 | ||
| 1051 | static int acpi_video_device_add_fs(struct acpi_device *device) | 1047 | static int acpi_video_device_add_fs(struct acpi_device *device) |
| 1052 | { | 1048 | { |
| 1053 | struct proc_dir_entry *entry = NULL; | 1049 | struct proc_dir_entry *entry, *device_dir; |
| 1054 | struct acpi_video_device *vid_dev; | 1050 | struct acpi_video_device *vid_dev; |
| 1055 | 1051 | ||
| 1056 | |||
| 1057 | if (!device) | ||
| 1058 | return -ENODEV; | ||
| 1059 | |||
| 1060 | vid_dev = acpi_driver_data(device); | 1052 | vid_dev = acpi_driver_data(device); |
| 1061 | if (!vid_dev) | 1053 | if (!vid_dev) |
| 1062 | return -ENODEV; | 1054 | return -ENODEV; |
| 1063 | 1055 | ||
| 1064 | if (!acpi_device_dir(device)) { | 1056 | device_dir = proc_mkdir(acpi_device_bid(device), |
| 1065 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 1057 | vid_dev->video->dir); |
| 1066 | vid_dev->video->dir); | 1058 | if (!device_dir) |
| 1067 | if (!acpi_device_dir(device)) | 1059 | return -ENOMEM; |
| 1068 | return -ENODEV; | 1060 | |
| 1069 | acpi_device_dir(device)->owner = THIS_MODULE; | 1061 | device_dir->owner = THIS_MODULE; |
| 1070 | } | ||
| 1071 | 1062 | ||
| 1072 | /* 'info' [R] */ | 1063 | /* 'info' [R] */ |
| 1073 | entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); | 1064 | entry = create_proc_entry("info", S_IRUGO, device_dir); |
| 1074 | if (!entry) | 1065 | if (!entry) |
| 1075 | return -ENODEV; | 1066 | goto err_remove_dir; |
| 1076 | else { | 1067 | |
| 1077 | entry->proc_fops = &acpi_video_device_info_fops; | 1068 | entry->proc_fops = &acpi_video_device_info_fops; |
| 1078 | entry->data = acpi_driver_data(device); | 1069 | entry->data = acpi_driver_data(device); |
| 1079 | entry->owner = THIS_MODULE; | 1070 | entry->owner = THIS_MODULE; |
| 1080 | } | ||
| 1081 | 1071 | ||
| 1082 | /* 'state' [R/W] */ | 1072 | /* 'state' [R/W] */ |
| 1083 | entry = | 1073 | entry = create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, |
| 1084 | create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, | 1074 | device_dir); |
| 1085 | acpi_device_dir(device)); | ||
| 1086 | if (!entry) | 1075 | if (!entry) |
| 1087 | return -ENODEV; | 1076 | goto err_remove_info; |
| 1088 | else { | 1077 | |
| 1089 | acpi_video_device_state_fops.write = acpi_video_device_write_state; | 1078 | acpi_video_device_state_fops.write = acpi_video_device_write_state; |
| 1090 | entry->proc_fops = &acpi_video_device_state_fops; | 1079 | entry->proc_fops = &acpi_video_device_state_fops; |
| 1091 | entry->data = acpi_driver_data(device); | 1080 | entry->data = acpi_driver_data(device); |
| 1092 | entry->owner = THIS_MODULE; | 1081 | entry->owner = THIS_MODULE; |
| 1093 | } | ||
| 1094 | 1082 | ||
| 1095 | /* 'brightness' [R/W] */ | 1083 | /* 'brightness' [R/W] */ |
| 1096 | entry = | 1084 | entry = create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, |
| 1097 | create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, | 1085 | device_dir); |
| 1098 | acpi_device_dir(device)); | ||
| 1099 | if (!entry) | 1086 | if (!entry) |
| 1100 | return -ENODEV; | 1087 | goto err_remove_state; |
| 1101 | else { | 1088 | |
| 1102 | acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; | 1089 | acpi_video_device_brightness_fops.write = |
| 1103 | entry->proc_fops = &acpi_video_device_brightness_fops; | 1090 | acpi_video_device_write_brightness; |
| 1104 | entry->data = acpi_driver_data(device); | 1091 | entry->proc_fops = &acpi_video_device_brightness_fops; |
| 1105 | entry->owner = THIS_MODULE; | 1092 | entry->data = acpi_driver_data(device); |
| 1106 | } | 1093 | entry->owner = THIS_MODULE; |
| 1107 | 1094 | ||
| 1108 | /* 'EDID' [R] */ | 1095 | /* 'EDID' [R] */ |
| 1109 | entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); | 1096 | entry = create_proc_entry("EDID", S_IRUGO, device_dir); |
| 1110 | if (!entry) | 1097 | if (!entry) |
| 1111 | return -ENODEV; | 1098 | goto err_remove_brightness; |
| 1112 | else { | ||
| 1113 | entry->proc_fops = &acpi_video_device_EDID_fops; | ||
| 1114 | entry->data = acpi_driver_data(device); | ||
| 1115 | entry->owner = THIS_MODULE; | ||
| 1116 | } | ||
| 1117 | 1099 | ||
| 1100 | entry->proc_fops = &acpi_video_device_EDID_fops; | ||
| 1101 | entry->data = acpi_driver_data(device); | ||
| 1102 | entry->owner = THIS_MODULE; | ||
| 1103 | |||
| 1104 | acpi_device_dir(device) = device_dir; | ||
| 1118 | return 0; | 1105 | return 0; |
| 1106 | |||
| 1107 | err_remove_brightness: | ||
| 1108 | remove_proc_entry("brightness", device_dir); | ||
| 1109 | err_remove_state: | ||
| 1110 | remove_proc_entry("state", device_dir); | ||
| 1111 | err_remove_info: | ||
| 1112 | remove_proc_entry("info", device_dir); | ||
| 1113 | err_remove_dir: | ||
| 1114 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); | ||
| 1115 | return -ENOMEM; | ||
| 1119 | } | 1116 | } |
| 1120 | 1117 | ||
| 1121 | static int acpi_video_device_remove_fs(struct acpi_device *device) | 1118 | static int acpi_video_device_remove_fs(struct acpi_device *device) |
| 1122 | { | 1119 | { |
| 1123 | struct acpi_video_device *vid_dev; | 1120 | struct acpi_video_device *vid_dev; |
| 1121 | struct proc_dir_entry *device_dir; | ||
| 1124 | 1122 | ||
| 1125 | vid_dev = acpi_driver_data(device); | 1123 | vid_dev = acpi_driver_data(device); |
| 1126 | if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) | 1124 | if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) |
| 1127 | return -ENODEV; | 1125 | return -ENODEV; |
| 1128 | 1126 | ||
| 1129 | if (acpi_device_dir(device)) { | 1127 | device_dir = acpi_device_dir(device); |
| 1130 | remove_proc_entry("info", acpi_device_dir(device)); | 1128 | if (device_dir) { |
| 1131 | remove_proc_entry("state", acpi_device_dir(device)); | 1129 | remove_proc_entry("info", device_dir); |
| 1132 | remove_proc_entry("brightness", acpi_device_dir(device)); | 1130 | remove_proc_entry("state", device_dir); |
| 1133 | remove_proc_entry("EDID", acpi_device_dir(device)); | 1131 | remove_proc_entry("brightness", device_dir); |
| 1132 | remove_proc_entry("EDID", device_dir); | ||
| 1134 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); | 1133 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); |
| 1135 | acpi_device_dir(device) = NULL; | 1134 | acpi_device_dir(device) = NULL; |
| 1136 | } | 1135 | } |
| @@ -1337,94 +1336,91 @@ acpi_video_bus_write_DOS(struct file *file, | |||
| 1337 | 1336 | ||
| 1338 | static int acpi_video_bus_add_fs(struct acpi_device *device) | 1337 | static int acpi_video_bus_add_fs(struct acpi_device *device) |
| 1339 | { | 1338 | { |
| 1340 | struct proc_dir_entry *entry = NULL; | 1339 | struct acpi_video_bus *video = acpi_driver_data(device); |
| 1341 | struct acpi_video_bus *video; | 1340 | struct proc_dir_entry *device_dir; |
| 1342 | 1341 | struct proc_dir_entry *entry; | |
| 1343 | 1342 | ||
| 1344 | video = acpi_driver_data(device); | 1343 | device_dir = proc_mkdir(acpi_device_bid(device), acpi_video_dir); |
| 1344 | if (!device_dir) | ||
| 1345 | return -ENOMEM; | ||
| 1345 | 1346 | ||
| 1346 | if (!acpi_device_dir(device)) { | 1347 | device_dir->owner = THIS_MODULE; |
| 1347 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | ||
| 1348 | acpi_video_dir); | ||
| 1349 | if (!acpi_device_dir(device)) | ||
| 1350 | return -ENODEV; | ||
| 1351 | video->dir = acpi_device_dir(device); | ||
| 1352 | acpi_device_dir(device)->owner = THIS_MODULE; | ||
| 1353 | } | ||
| 1354 | 1348 | ||
| 1355 | /* 'info' [R] */ | 1349 | /* 'info' [R] */ |
| 1356 | entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); | 1350 | entry = create_proc_entry("info", S_IRUGO, device_dir); |
| 1357 | if (!entry) | 1351 | if (!entry) |
| 1358 | return -ENODEV; | 1352 | goto err_remove_dir; |
| 1359 | else { | 1353 | |
| 1360 | entry->proc_fops = &acpi_video_bus_info_fops; | 1354 | entry->proc_fops = &acpi_video_bus_info_fops; |
| 1361 | entry->data = acpi_driver_data(device); | 1355 | entry->data = acpi_driver_data(device); |
| 1362 | entry->owner = THIS_MODULE; | 1356 | entry->owner = THIS_MODULE; |
| 1363 | } | ||
| 1364 | 1357 | ||
| 1365 | /* 'ROM' [R] */ | 1358 | /* 'ROM' [R] */ |
| 1366 | entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); | 1359 | entry = create_proc_entry("ROM", S_IRUGO, device_dir); |
| 1367 | if (!entry) | 1360 | if (!entry) |
| 1368 | return -ENODEV; | 1361 | goto err_remove_info; |
| 1369 | else { | 1362 | |
| 1370 | entry->proc_fops = &acpi_video_bus_ROM_fops; | 1363 | entry->proc_fops = &acpi_video_bus_ROM_fops; |
| 1371 | entry->data = acpi_driver_data(device); | 1364 | entry->data = acpi_driver_data(device); |
| 1372 | entry->owner = THIS_MODULE; | 1365 | entry->owner = THIS_MODULE; |
| 1373 | } | ||
| 1374 | 1366 | ||
| 1375 | /* 'POST_info' [R] */ | 1367 | /* 'POST_info' [R] */ |
| 1376 | entry = | 1368 | entry = create_proc_entry("POST_info", S_IRUGO, device_dir); |
| 1377 | create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); | ||
| 1378 | if (!entry) | 1369 | if (!entry) |
| 1379 | return -ENODEV; | 1370 | goto err_remove_rom; |
| 1380 | else { | 1371 | |
| 1381 | entry->proc_fops = &acpi_video_bus_POST_info_fops; | 1372 | entry->proc_fops = &acpi_video_bus_POST_info_fops; |
| 1382 | entry->data = acpi_driver_data(device); | 1373 | entry->data = acpi_driver_data(device); |
| 1383 | entry->owner = THIS_MODULE; | 1374 | entry->owner = THIS_MODULE; |
| 1384 | } | ||
| 1385 | 1375 | ||
| 1386 | /* 'POST' [R/W] */ | 1376 | /* 'POST' [R/W] */ |
| 1387 | entry = | 1377 | entry = create_proc_entry("POST", S_IFREG | S_IRUGO | S_IWUSR, |
| 1388 | create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, | 1378 | device_dir); |
| 1389 | acpi_device_dir(device)); | ||
| 1390 | if (!entry) | 1379 | if (!entry) |
| 1391 | return -ENODEV; | 1380 | goto err_remove_post_info; |
| 1392 | else { | 1381 | |
| 1393 | acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; | 1382 | acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; |
| 1394 | entry->proc_fops = &acpi_video_bus_POST_fops; | 1383 | entry->proc_fops = &acpi_video_bus_POST_fops; |
| 1395 | entry->data = acpi_driver_data(device); | 1384 | entry->data = acpi_driver_data(device); |
| 1396 | entry->owner = THIS_MODULE; | 1385 | entry->owner = THIS_MODULE; |
| 1397 | } | ||
| 1398 | 1386 | ||
| 1399 | /* 'DOS' [R/W] */ | 1387 | /* 'DOS' [R/W] */ |
| 1400 | entry = | 1388 | entry = create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IWUSR, |
| 1401 | create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, | 1389 | device_dir); |
| 1402 | acpi_device_dir(device)); | ||
| 1403 | if (!entry) | 1390 | if (!entry) |
| 1404 | return -ENODEV; | 1391 | goto err_remove_post; |
| 1405 | else { | 1392 | |
| 1406 | acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; | 1393 | acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; |
| 1407 | entry->proc_fops = &acpi_video_bus_DOS_fops; | 1394 | entry->proc_fops = &acpi_video_bus_DOS_fops; |
| 1408 | entry->data = acpi_driver_data(device); | 1395 | entry->data = acpi_driver_data(device); |
| 1409 | entry->owner = THIS_MODULE; | 1396 | entry->owner = THIS_MODULE; |
| 1410 | } | ||
| 1411 | 1397 | ||
| 1398 | video->dir = acpi_device_dir(device) = device_dir; | ||
| 1412 | return 0; | 1399 | return 0; |
| 1400 | |||
| 1401 | err_remove_post: | ||
| 1402 | remove_proc_entry("POST", device_dir); | ||
| 1403 | err_remove_post_info: | ||
| 1404 | remove_proc_entry("POST_info", device_dir); | ||
| 1405 | err_remove_rom: | ||
| 1406 | remove_proc_entry("ROM", device_dir); | ||
| 1407 | err_remove_info: | ||
| 1408 | remove_proc_entry("info", device_dir); | ||
| 1409 | err_remove_dir: | ||
| 1410 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); | ||
| 1411 | return -ENOMEM; | ||
| 1413 | } | 1412 | } |
| 1414 | 1413 | ||
| 1415 | static int acpi_video_bus_remove_fs(struct acpi_device *device) | 1414 | static int acpi_video_bus_remove_fs(struct acpi_device *device) |
| 1416 | { | 1415 | { |
| 1417 | struct acpi_video_bus *video; | 1416 | struct proc_dir_entry *device_dir = acpi_device_dir(device); |
| 1418 | |||
| 1419 | |||
| 1420 | video = acpi_driver_data(device); | ||
| 1421 | 1417 | ||
| 1422 | if (acpi_device_dir(device)) { | 1418 | if (device_dir) { |
| 1423 | remove_proc_entry("info", acpi_device_dir(device)); | 1419 | remove_proc_entry("info", device_dir); |
| 1424 | remove_proc_entry("ROM", acpi_device_dir(device)); | 1420 | remove_proc_entry("ROM", device_dir); |
| 1425 | remove_proc_entry("POST_info", acpi_device_dir(device)); | 1421 | remove_proc_entry("POST_info", device_dir); |
| 1426 | remove_proc_entry("POST", acpi_device_dir(device)); | 1422 | remove_proc_entry("POST", device_dir); |
| 1427 | remove_proc_entry("DOS", acpi_device_dir(device)); | 1423 | remove_proc_entry("DOS", device_dir); |
| 1428 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); | 1424 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); |
| 1429 | acpi_device_dir(device) = NULL; | 1425 | acpi_device_dir(device) = NULL; |
| 1430 | } | 1426 | } |
| @@ -1440,11 +1436,15 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) | |||
| 1440 | static struct acpi_video_device_attrib* | 1436 | static struct acpi_video_device_attrib* |
| 1441 | acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id) | 1437 | acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id) |
| 1442 | { | 1438 | { |
| 1443 | int count; | 1439 | struct acpi_video_enumerated_device *ids; |
| 1440 | int i; | ||
| 1441 | |||
| 1442 | for (i = 0; i < video->attached_count; i++) { | ||
| 1443 | ids = &video->attached_array[i]; | ||
| 1444 | if ((ids->value.int_val & 0xffff) == device_id) | ||
| 1445 | return &ids->value.attrib; | ||
| 1446 | } | ||
| 1444 | 1447 | ||
| 1445 | for(count = 0; count < video->attached_count; count++) | ||
| 1446 | if((video->attached_array[count].value.int_val & 0xffff) == device_id) | ||
| 1447 | return &(video->attached_array[count].value.attrib); | ||
| 1448 | return NULL; | 1448 | return NULL; |
| 1449 | } | 1449 | } |
| 1450 | 1450 | ||
| @@ -1571,20 +1571,16 @@ static void | |||
| 1571 | acpi_video_device_bind(struct acpi_video_bus *video, | 1571 | acpi_video_device_bind(struct acpi_video_bus *video, |
| 1572 | struct acpi_video_device *device) | 1572 | struct acpi_video_device *device) |
| 1573 | { | 1573 | { |
| 1574 | struct acpi_video_enumerated_device *ids; | ||
| 1574 | int i; | 1575 | int i; |
| 1575 | 1576 | ||
| 1576 | #define IDS_VAL(i) video->attached_array[i].value.int_val | 1577 | for (i = 0; i < video->attached_count; i++) { |
| 1577 | #define IDS_BIND(i) video->attached_array[i].bind_info | 1578 | ids = &video->attached_array[i]; |
| 1578 | 1579 | if (device->device_id == (ids->value.int_val & 0xffff)) { | |
| 1579 | for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && | 1580 | ids->bind_info = device; |
| 1580 | i < video->attached_count; i++) { | ||
| 1581 | if (device->device_id == (IDS_VAL(i) & 0xffff)) { | ||
| 1582 | IDS_BIND(i) = device; | ||
| 1583 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i)); | 1581 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i)); |
| 1584 | } | 1582 | } |
| 1585 | } | 1583 | } |
| 1586 | #undef IDS_VAL | ||
| 1587 | #undef IDS_BIND | ||
| 1588 | } | 1584 | } |
| 1589 | 1585 | ||
| 1590 | /* | 1586 | /* |
| @@ -1603,7 +1599,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
| 1603 | int status; | 1599 | int status; |
| 1604 | int count; | 1600 | int count; |
| 1605 | int i; | 1601 | int i; |
| 1606 | struct acpi_video_enumerated_device *active_device_list; | 1602 | struct acpi_video_enumerated_device *active_list; |
| 1607 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 1603 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 1608 | union acpi_object *dod = NULL; | 1604 | union acpi_object *dod = NULL; |
| 1609 | union acpi_object *obj; | 1605 | union acpi_object *obj; |
| @@ -1624,13 +1620,10 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
| 1624 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n", | 1620 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n", |
| 1625 | dod->package.count)); | 1621 | dod->package.count)); |
| 1626 | 1622 | ||
| 1627 | active_device_list = kmalloc((1 + | 1623 | active_list = kcalloc(1 + dod->package.count, |
| 1628 | dod->package.count) * | 1624 | sizeof(struct acpi_video_enumerated_device), |
| 1629 | sizeof(struct | 1625 | GFP_KERNEL); |
| 1630 | acpi_video_enumerated_device), | 1626 | if (!active_list) { |
| 1631 | GFP_KERNEL); | ||
| 1632 | |||
| 1633 | if (!active_device_list) { | ||
| 1634 | status = -ENOMEM; | 1627 | status = -ENOMEM; |
| 1635 | goto out; | 1628 | goto out; |
| 1636 | } | 1629 | } |
| @@ -1640,23 +1633,24 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
| 1640 | obj = &dod->package.elements[i]; | 1633 | obj = &dod->package.elements[i]; |
| 1641 | 1634 | ||
| 1642 | if (obj->type != ACPI_TYPE_INTEGER) { | 1635 | if (obj->type != ACPI_TYPE_INTEGER) { |
| 1643 | printk(KERN_ERR PREFIX "Invalid _DOD data\n"); | 1636 | printk(KERN_ERR PREFIX |
| 1644 | active_device_list[i].value.int_val = | 1637 | "Invalid _DOD data in element %d\n", i); |
| 1645 | ACPI_VIDEO_HEAD_INVALID; | 1638 | continue; |
| 1646 | } | 1639 | } |
| 1647 | active_device_list[i].value.int_val = obj->integer.value; | 1640 | |
| 1648 | active_device_list[i].bind_info = NULL; | 1641 | active_list[count].value.int_val = obj->integer.value; |
| 1642 | active_list[count].bind_info = NULL; | ||
| 1649 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, | 1643 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, |
| 1650 | (int)obj->integer.value)); | 1644 | (int)obj->integer.value)); |
| 1651 | count++; | 1645 | count++; |
| 1652 | } | 1646 | } |
| 1653 | active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END; | ||
| 1654 | 1647 | ||
| 1655 | kfree(video->attached_array); | 1648 | kfree(video->attached_array); |
| 1656 | 1649 | ||
| 1657 | video->attached_array = active_device_list; | 1650 | video->attached_array = active_list; |
| 1658 | video->attached_count = count; | 1651 | video->attached_count = count; |
| 1659 | out: | 1652 | |
| 1653 | out: | ||
| 1660 | kfree(buffer.pointer); | 1654 | kfree(buffer.pointer); |
| 1661 | return status; | 1655 | return status; |
| 1662 | } | 1656 | } |
