View | Details | Raw Unified | Return to bug 14858 | Differences between
and this patch

Collapse All | Expand All

(-)a/drivers/acpi/ec.c (+10 lines)
Lines 112-117 static struct acpi_ec { Link Here
112
	unsigned long global_lock;
112
	unsigned long global_lock;
113
	unsigned long flags;
113
	unsigned long flags;
114
	struct mutex lock;
114
	struct mutex lock;
115
	struct mutex query_lock;
116
	struct task_struct *query_task;
115
	wait_queue_head_t wait;
117
	wait_queue_head_t wait;
116
	struct list_head list;
118
	struct list_head list;
117
	struct transaction *curr;
119
	struct transaction *curr;
Lines 310-315 static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) Link Here
310
	if (t->rdata)
312
	if (t->rdata)
311
		memset(t->rdata, 0, t->rlen);
313
		memset(t->rdata, 0, t->rlen);
312
	mutex_lock(&ec->lock);
314
	mutex_lock(&ec->lock);
315
	if (ec->query_task != get_current())
316
		mutex_lock(&ec->lock);
313
	if (ec->global_lock) {
317
	if (ec->global_lock) {
314
		status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
318
		status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
315
		if (ACPI_FAILURE(status)) {
319
		if (ACPI_FAILURE(status)) {
Lines 328-333 end: Link Here
328
	if (ec->global_lock)
332
	if (ec->global_lock)
329
		acpi_release_global_lock(glk);
333
		acpi_release_global_lock(glk);
330
unlock:
334
unlock:
335
	if (ec->query_task != get_current())
336
		mutex_unlock(&ec->query_lock);
331
	mutex_unlock(&ec->lock);
337
	mutex_unlock(&ec->lock);
332
	return status;
338
	return status;
333
}
339
}
Lines 524-535 static void acpi_ec_gpe_query(void *ec_cxt) Link Here
524
		if (value == handler->query_bit) {
530
		if (value == handler->query_bit) {
525
			/* have custom handler for this bit */
531
			/* have custom handler for this bit */
526
			memcpy(&copy, handler, sizeof(copy));
532
			memcpy(&copy, handler, sizeof(copy));
533
			ec->query_task = get_current();
534
			mutex_lock(&ec->query_lock);
527
			mutex_unlock(&ec->lock);
535
			mutex_unlock(&ec->lock);
528
			if (copy.func) {
536
			if (copy.func) {
529
				copy.func(copy.data);
537
				copy.func(copy.data);
530
			} else if (copy.handle) {
538
			} else if (copy.handle) {
531
				acpi_evaluate_object(copy.handle, NULL, NULL, NULL);
539
				acpi_evaluate_object(copy.handle, NULL, NULL, NULL);
532
			}
540
			}
541
			mutex_unlock(&ec->query_lock);
533
			return;
542
			return;
534
		}
543
		}
535
	}
544
	}
Lines 692-697 static struct acpi_ec *make_acpi_ec(void) Link Here
692
		return NULL;
701
		return NULL;
693
	ec->flags = 1 << EC_FLAGS_QUERY_PENDING;
702
	ec->flags = 1 << EC_FLAGS_QUERY_PENDING;
694
	mutex_init(&ec->lock);
703
	mutex_init(&ec->lock);
704
	mutex_init(&ec->query_lock);
695
	init_waitqueue_head(&ec->wait);
705
	init_waitqueue_head(&ec->wait);
696
	INIT_LIST_HEAD(&ec->list);
706
	INIT_LIST_HEAD(&ec->list);
697
	spin_lock_init(&ec->curr_lock);
707
	spin_lock_init(&ec->curr_lock);

Return to bug 14858