Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 118828
b: refs/heads/master
c: dd15f8c
h: refs/heads/master
v: v3
  • Loading branch information
Alexey Starikovskiy authored and Len Brown committed Nov 11, 2008
1 parent 54c03de commit b5ae5bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f8248434e6a11d7cd314281be3b39bbcf82fc243
refs/heads/master: dd15f8c42af09031e27da5b4d697ce925511f2e1
21 changes: 13 additions & 8 deletions trunk/drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ struct transaction {
u8 command;
u8 wlen;
u8 rlen;
bool done;
};

static struct acpi_ec {
Expand Down Expand Up @@ -178,7 +179,7 @@ static int ec_transaction_done(struct acpi_ec *ec)
unsigned long flags;
int ret = 0;
spin_lock_irqsave(&ec->curr_lock, flags);
if (!ec->curr || (!ec->curr->wlen && !ec->curr->rlen))
if (!ec->curr || ec->curr->done)
ret = 1;
spin_unlock_irqrestore(&ec->curr_lock, flags);
return ret;
Expand All @@ -195,17 +196,20 @@ static void gpe_transaction(struct acpi_ec *ec, u8 status)
acpi_ec_write_data(ec, *(ec->curr->wdata++));
--ec->curr->wlen;
} else
/* false interrupt, state didn't change */
++ec->curr->irq_count;

goto err;
} else if (ec->curr->rlen > 0) {
if ((status & ACPI_EC_FLAG_OBF) == 1) {
*(ec->curr->rdata++) = acpi_ec_read_data(ec);
--ec->curr->rlen;
if (--ec->curr->rlen == 0)
ec->curr->done = true;
} else
/* false interrupt, state didn't change */
++ec->curr->irq_count;
}
goto err;
} else if (ec->curr->wlen == 0 && (status & ACPI_EC_FLAG_IBF) == 0)
ec->curr->done = true;
goto unlock;
err:
/* false interrupt, state didn't change */
++ec->curr->irq_count;
unlock:
spin_unlock_irqrestore(&ec->curr_lock, flags);
}
Expand Down Expand Up @@ -265,6 +269,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
spin_lock_irqsave(&ec->curr_lock, tmp);
/* following two actions should be kept atomic */
t->irq_count = 0;
t->done = false;
ec->curr = t;
acpi_ec_write_cmd(ec, ec->curr->command);
if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
Expand Down

0 comments on commit b5ae5bb

Please sign in to comment.