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

Collapse All | Expand All

(-)linux-2.6.27/drivers/acpi/ec.c (-32 lines)
Lines 110-117 static struct acpi_ec { Link Here
110
	struct mutex lock;
110
	struct mutex lock;
111
	wait_queue_head_t wait;
111
	wait_queue_head_t wait;
112
	struct list_head list;
112
	struct list_head list;
113
	struct delayed_work work;
114
	atomic_t irq_count;
115
	u8 pre_state;
113
	u8 pre_state;
116
	/* record the EC status when last EC interrrupt happens */
114
	/* record the EC status when last EC interrrupt happens */
117
	atomic_t ec_irq_count;
115
	atomic_t ec_irq_count;
Lines 193-216 static inline int acpi_ec_check_status(s Link Here
193
	return 0;
191
	return 0;
194
}
192
}
195
193
196
static void ec_schedule_ec_poll(struct acpi_ec *ec)
197
{
198
	if (test_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags))
199
		schedule_delayed_work(&ec->work,
200
				      msecs_to_jiffies(ACPI_EC_DELAY));
201
}
202
203
static void ec_switch_to_poll_mode(struct acpi_ec *ec)
204
{
205
	set_bit(EC_FLAGS_NO_GPE, &ec->flags);
206
	clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
207
	acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
208
	set_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags);
209
}
210
211
static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
194
static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
212
{
195
{
213
	atomic_set(&ec->irq_count, 0);
214
	if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) &&
196
	if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) &&
215
	    likely(!force_poll)) {
197
	    likely(!force_poll)) {
216
		if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event),
198
		if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event),
Lines 632-644 static u32 acpi_ec_gpe_handler(void *dat Link Here
632
	    ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
614
	    ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
633
}
615
}
634
616
635
static void do_ec_poll(struct work_struct *work)
636
{
637
	struct acpi_ec *ec = container_of(work, struct acpi_ec, work.work);
638
	atomic_set(&ec->irq_count, 0);
639
	(void)acpi_ec_gpe_handler(ec);
640
}
641
642
/* --------------------------------------------------------------------------
617
/* --------------------------------------------------------------------------
643
                             Address Space Management
618
                             Address Space Management
644
   -------------------------------------------------------------------------- */
619
   -------------------------------------------------------------------------- */
Lines 791-797 static struct acpi_ec *make_acpi_ec(void Link Here
791
	init_waitqueue_head(&ec->wait);
766
	init_waitqueue_head(&ec->wait);
792
	INIT_LIST_HEAD(&ec->list);
767
	INIT_LIST_HEAD(&ec->list);
793
	ec->pre_jiffies = jiffies;
768
	ec->pre_jiffies = jiffies;
794
	atomic_set(&ec->irq_count, 0);
795
	return ec;
769
	return ec;
796
}
770
}
797
771
Lines 830-841 ec_parse_device(acpi_handle handle, u32 Link Here
830
	return AE_CTRL_TERMINATE;
804
	return AE_CTRL_TERMINATE;
831
}
805
}
832
806
833
static void ec_poll_stop(struct acpi_ec *ec)
834
{
835
	clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags);
836
	cancel_delayed_work(&ec->work);
837
}
838
839
static void ec_remove_handlers(struct acpi_ec *ec)
807
static void ec_remove_handlers(struct acpi_ec *ec)
840
{
808
{
841
	if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
809
	if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,

Return to bug 11969