aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 07426c8c255b..a362f20c6c8b 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -177,6 +177,8 @@ static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */
177 ec_dbg(EC_DBG_REQ, fmt, ##__VA_ARGS__) 177 ec_dbg(EC_DBG_REQ, fmt, ##__VA_ARGS__)
178#define ec_dbg_evt(fmt, ...) \ 178#define ec_dbg_evt(fmt, ...) \
179 ec_dbg(EC_DBG_EVT, fmt, ##__VA_ARGS__) 179 ec_dbg(EC_DBG_EVT, fmt, ##__VA_ARGS__)
180#define ec_dbg_ref(ec, fmt, ...) \
181 ec_dbg_raw("%lu: " fmt, ec->reference_count, ## __VA_ARGS__)
180 182
181/* -------------------------------------------------------------------------- 183/* --------------------------------------------------------------------------
182 * Device Flags 184 * Device Flags
@@ -544,6 +546,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
544 ret = -EINVAL; 546 ret = -EINVAL;
545 goto unlock; 547 goto unlock;
546 } 548 }
549 ec_dbg_ref(ec, "Increase command");
547 /* following two actions should be kept atomic */ 550 /* following two actions should be kept atomic */
548 ec->curr = t; 551 ec->curr = t;
549 ec_dbg_req("Command(%s) started", acpi_ec_cmd_string(t->command)); 552 ec_dbg_req("Command(%s) started", acpi_ec_cmd_string(t->command));
@@ -557,6 +560,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
557 ec->curr = NULL; 560 ec->curr = NULL;
558 /* Disable GPE for command processing (IBF=0/OBF=1) */ 561 /* Disable GPE for command processing (IBF=0/OBF=1) */
559 acpi_ec_complete_request(ec); 562 acpi_ec_complete_request(ec);
563 ec_dbg_ref(ec, "Decrease command");
560unlock: 564unlock:
561 spin_unlock_irqrestore(&ec->lock, tmp); 565 spin_unlock_irqrestore(&ec->lock, tmp);
562 return ret; 566 return ret;
@@ -718,8 +722,10 @@ static void acpi_ec_start(struct acpi_ec *ec, bool resuming)
718 if (!test_and_set_bit(EC_FLAGS_STARTED, &ec->flags)) { 722 if (!test_and_set_bit(EC_FLAGS_STARTED, &ec->flags)) {
719 ec_dbg_drv("Starting EC"); 723 ec_dbg_drv("Starting EC");
720 /* Enable GPE for event processing (SCI_EVT=1) */ 724 /* Enable GPE for event processing (SCI_EVT=1) */
721 if (!resuming) 725 if (!resuming) {
722 acpi_ec_submit_request(ec); 726 acpi_ec_submit_request(ec);
727 ec_dbg_ref(ec, "Increase driver");
728 }
723 ec_log_drv("EC started"); 729 ec_log_drv("EC started");
724 } 730 }
725 spin_unlock_irqrestore(&ec->lock, flags); 731 spin_unlock_irqrestore(&ec->lock, flags);
@@ -748,8 +754,10 @@ static void acpi_ec_stop(struct acpi_ec *ec, bool suspending)
748 wait_event(ec->wait, acpi_ec_stopped(ec)); 754 wait_event(ec->wait, acpi_ec_stopped(ec));
749 spin_lock_irqsave(&ec->lock, flags); 755 spin_lock_irqsave(&ec->lock, flags);
750 /* Disable GPE for event processing (SCI_EVT=1) */ 756 /* Disable GPE for event processing (SCI_EVT=1) */
751 if (!suspending) 757 if (!suspending) {
752 acpi_ec_complete_request(ec); 758 acpi_ec_complete_request(ec);
759 ec_dbg_ref(ec, "Decrease driver");
760 }
753 clear_bit(EC_FLAGS_STARTED, &ec->flags); 761 clear_bit(EC_FLAGS_STARTED, &ec->flags);
754 clear_bit(EC_FLAGS_STOPPED, &ec->flags); 762 clear_bit(EC_FLAGS_STOPPED, &ec->flags);
755 ec_log_drv("EC stopped"); 763 ec_log_drv("EC stopped");