diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 14d0c89ada2a..40002ae7db2b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | /* Uncomment next line to get verbose printout */ | 32 | /* Uncomment next line to get verbose printout */ |
33 | /* #define DEBUG */ | 33 | /* #define DEBUG */ |
34 | #define DEBUG_REF 0 | ||
35 | #define pr_fmt(fmt) "ACPI : EC: " fmt | 34 | #define pr_fmt(fmt) "ACPI : EC: " fmt |
36 | 35 | ||
37 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
@@ -91,13 +90,6 @@ enum { | |||
91 | #define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */ | 90 | #define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */ |
92 | #define ACPI_EC_COMMAND_COMPLETE 0x02 /* Completed last byte */ | 91 | #define ACPI_EC_COMMAND_COMPLETE 0x02 /* Completed last byte */ |
93 | 92 | ||
94 | #define ec_debug_ref(ec, fmt, ...) \ | ||
95 | do { \ | ||
96 | if (DEBUG_REF) \ | ||
97 | pr_debug("%lu: " fmt, ec->reference_count, \ | ||
98 | ## __VA_ARGS__); \ | ||
99 | } while (0) | ||
100 | |||
101 | /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ | 93 | /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ |
102 | static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; | 94 | static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; |
103 | module_param(ec_delay, uint, 0644); | 95 | module_param(ec_delay, uint, 0644); |
@@ -364,14 +356,12 @@ static void acpi_ec_submit_event(struct acpi_ec *ec) | |||
364 | /* Hold reference for pending event */ | 356 | /* Hold reference for pending event */ |
365 | if (!acpi_ec_submit_flushable_request(ec, true)) | 357 | if (!acpi_ec_submit_flushable_request(ec, true)) |
366 | return; | 358 | return; |
367 | ec_debug_ref(ec, "Increase event\n"); | ||
368 | if (!test_and_set_bit(EC_FLAGS_EVENT_PENDING, &ec->flags)) { | 359 | if (!test_and_set_bit(EC_FLAGS_EVENT_PENDING, &ec->flags)) { |
369 | pr_debug("***** Event query started *****\n"); | 360 | pr_debug("***** Event query started *****\n"); |
370 | schedule_work(&ec->work); | 361 | schedule_work(&ec->work); |
371 | return; | 362 | return; |
372 | } | 363 | } |
373 | acpi_ec_complete_request(ec); | 364 | acpi_ec_complete_request(ec); |
374 | ec_debug_ref(ec, "Decrease event\n"); | ||
375 | } | 365 | } |
376 | 366 | ||
377 | static void acpi_ec_complete_event(struct acpi_ec *ec) | 367 | static void acpi_ec_complete_event(struct acpi_ec *ec) |
@@ -381,7 +371,6 @@ static void acpi_ec_complete_event(struct acpi_ec *ec) | |||
381 | pr_debug("***** Event query stopped *****\n"); | 371 | pr_debug("***** Event query stopped *****\n"); |
382 | /* Unhold reference for pending event */ | 372 | /* Unhold reference for pending event */ |
383 | acpi_ec_complete_request(ec); | 373 | acpi_ec_complete_request(ec); |
384 | ec_debug_ref(ec, "Decrease event\n"); | ||
385 | /* Check if there is another SCI_EVT detected */ | 374 | /* Check if there is another SCI_EVT detected */ |
386 | acpi_ec_submit_event(ec); | 375 | acpi_ec_submit_event(ec); |
387 | } | 376 | } |
@@ -392,14 +381,12 @@ static void acpi_ec_submit_detection(struct acpi_ec *ec) | |||
392 | /* Hold reference for query submission */ | 381 | /* Hold reference for query submission */ |
393 | if (!acpi_ec_submit_flushable_request(ec, false)) | 382 | if (!acpi_ec_submit_flushable_request(ec, false)) |
394 | return; | 383 | return; |
395 | ec_debug_ref(ec, "Increase query\n"); | ||
396 | if (!test_and_set_bit(EC_FLAGS_EVENT_DETECTED, &ec->flags)) { | 384 | if (!test_and_set_bit(EC_FLAGS_EVENT_DETECTED, &ec->flags)) { |
397 | pr_debug("***** Event detection blocked *****\n"); | 385 | pr_debug("***** Event detection blocked *****\n"); |
398 | acpi_ec_submit_event(ec); | 386 | acpi_ec_submit_event(ec); |
399 | return; | 387 | return; |
400 | } | 388 | } |
401 | acpi_ec_complete_request(ec); | 389 | acpi_ec_complete_request(ec); |
402 | ec_debug_ref(ec, "Decrease query\n"); | ||
403 | } | 390 | } |
404 | 391 | ||
405 | static void acpi_ec_complete_detection(struct acpi_ec *ec) | 392 | static void acpi_ec_complete_detection(struct acpi_ec *ec) |
@@ -409,7 +396,6 @@ static void acpi_ec_complete_detection(struct acpi_ec *ec) | |||
409 | pr_debug("***** Event detetion unblocked *****\n"); | 396 | pr_debug("***** Event detetion unblocked *****\n"); |
410 | /* Unhold reference for query submission */ | 397 | /* Unhold reference for query submission */ |
411 | acpi_ec_complete_request(ec); | 398 | acpi_ec_complete_request(ec); |
412 | ec_debug_ref(ec, "Decrease query\n"); | ||
413 | } | 399 | } |
414 | } | 400 | } |
415 | 401 | ||
@@ -584,7 +570,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
584 | ret = -EINVAL; | 570 | ret = -EINVAL; |
585 | goto unlock; | 571 | goto unlock; |
586 | } | 572 | } |
587 | ec_debug_ref(ec, "Increase command\n"); | ||
588 | /* following two actions should be kept atomic */ | 573 | /* following two actions should be kept atomic */ |
589 | ec->curr = t; | 574 | ec->curr = t; |
590 | pr_debug("***** Command(%s) started *****\n", | 575 | pr_debug("***** Command(%s) started *****\n", |
@@ -600,7 +585,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
600 | ec->curr = NULL; | 585 | ec->curr = NULL; |
601 | /* Disable GPE for command processing (IBF=0/OBF=1) */ | 586 | /* Disable GPE for command processing (IBF=0/OBF=1) */ |
602 | acpi_ec_complete_request(ec); | 587 | acpi_ec_complete_request(ec); |
603 | ec_debug_ref(ec, "Decrease command\n"); | ||
604 | unlock: | 588 | unlock: |
605 | spin_unlock_irqrestore(&ec->lock, tmp); | 589 | spin_unlock_irqrestore(&ec->lock, tmp); |
606 | return ret; | 590 | return ret; |
@@ -762,10 +746,8 @@ static void acpi_ec_start(struct acpi_ec *ec, bool resuming) | |||
762 | if (!test_and_set_bit(EC_FLAGS_STARTED, &ec->flags)) { | 746 | if (!test_and_set_bit(EC_FLAGS_STARTED, &ec->flags)) { |
763 | pr_debug("+++++ Starting EC +++++\n"); | 747 | pr_debug("+++++ Starting EC +++++\n"); |
764 | /* Enable GPE for event processing (SCI_EVT=1) */ | 748 | /* Enable GPE for event processing (SCI_EVT=1) */ |
765 | if (!resuming) { | 749 | if (!resuming) |
766 | acpi_ec_submit_request(ec); | 750 | acpi_ec_submit_request(ec); |
767 | ec_debug_ref(ec, "Increase driver\n"); | ||
768 | } | ||
769 | pr_info("+++++ EC started +++++\n"); | 751 | pr_info("+++++ EC started +++++\n"); |
770 | } | 752 | } |
771 | spin_unlock_irqrestore(&ec->lock, flags); | 753 | spin_unlock_irqrestore(&ec->lock, flags); |
@@ -794,10 +776,8 @@ static void acpi_ec_stop(struct acpi_ec *ec, bool suspending) | |||
794 | wait_event(ec->wait, acpi_ec_stopped(ec)); | 776 | wait_event(ec->wait, acpi_ec_stopped(ec)); |
795 | spin_lock_irqsave(&ec->lock, flags); | 777 | spin_lock_irqsave(&ec->lock, flags); |
796 | /* Disable GPE for event processing (SCI_EVT=1) */ | 778 | /* Disable GPE for event processing (SCI_EVT=1) */ |
797 | if (!suspending) { | 779 | if (!suspending) |
798 | acpi_ec_complete_request(ec); | 780 | acpi_ec_complete_request(ec); |
799 | ec_debug_ref(ec, "Decrease driver\n"); | ||
800 | } | ||
801 | clear_bit(EC_FLAGS_STARTED, &ec->flags); | 781 | clear_bit(EC_FLAGS_STARTED, &ec->flags); |
802 | clear_bit(EC_FLAGS_STOPPED, &ec->flags); | 782 | clear_bit(EC_FLAGS_STOPPED, &ec->flags); |
803 | pr_info("+++++ EC stopped +++++\n"); | 783 | pr_info("+++++ EC stopped +++++\n"); |