Lines 343-348
static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
Link Here
|
343 |
udelay(ACPI_EC_MSI_UDELAY); |
343 |
udelay(ACPI_EC_MSI_UDELAY); |
344 |
/* start transaction */ |
344 |
/* start transaction */ |
345 |
spin_lock_irqsave(&ec->lock, tmp); |
345 |
spin_lock_irqsave(&ec->lock, tmp); |
|
|
346 |
if (!acpi_ec_started(ec)) { |
347 |
ret = -EINVAL; |
348 |
goto unlock; |
349 |
} |
346 |
/* following two actions should be kept atomic */ |
350 |
/* following two actions should be kept atomic */ |
347 |
ec->curr = t; |
351 |
ec->curr = t; |
348 |
pr_debug("***** Command(%s) started *****\n", |
352 |
pr_debug("***** Command(%s) started *****\n", |
Lines 358-363
static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
Link Here
|
358 |
pr_debug("***** Command(%s) stopped *****\n", |
362 |
pr_debug("***** Command(%s) stopped *****\n", |
359 |
acpi_ec_cmd_string(t->command)); |
363 |
acpi_ec_cmd_string(t->command)); |
360 |
ec->curr = NULL; |
364 |
ec->curr = NULL; |
|
|
365 |
unlock: |
361 |
spin_unlock_irqrestore(&ec->lock, tmp); |
366 |
spin_unlock_irqrestore(&ec->lock, tmp); |
362 |
return ret; |
367 |
return ret; |
363 |
} |
368 |
} |
Lines 372-381
static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
Link Here
|
372 |
if (t->rdata) |
377 |
if (t->rdata) |
373 |
memset(t->rdata, 0, t->rlen); |
378 |
memset(t->rdata, 0, t->rlen); |
374 |
mutex_lock(&ec->mutex); |
379 |
mutex_lock(&ec->mutex); |
375 |
if (!acpi_ec_started(ec)) { |
|
|
376 |
status = -EINVAL; |
377 |
goto unlock; |
378 |
} |
379 |
if (ec->global_lock) { |
380 |
if (ec->global_lock) { |
380 |
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
381 |
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
381 |
if (ACPI_FAILURE(status)) { |
382 |
if (ACPI_FAILURE(status)) { |
382 |
- |
|
|