Re: [PATCH try #2] Input/Joystick Driver: add support AD7142 joystick driver
From: Bryan Wu <hidden>
Date: 2007-10-12 15:59:44
Also in:
lkml
On Fri, 2007-10-12 at 11:50 -0400, Dmitry Torokhov wrote:
On 10/12/07, Bryan Wu [off-list ref] wrote:quoted
On Fri, 2007-10-12 at 10:49 -0400, Dmitry Torokhov wrote:quoted
Hi Bryan, On 10/12/07, Bryan Wu [off-list ref] wrote:quoted
+[snip]quoted
quoted
+ +static void ad7142_close(struct input_dev *dev) +{ + free_irq(CONFIG_BFIN_JOYSTICK_IRQ_PFX, ad7142_interrupt); + kthread_stop(ad7142_task);Don't you need to write something over i2c to shut the devoce off? What stops it from continuing to generate interrupts?Actually, I am going to use "completion" to replace the whole wait_interrupt_xxx and intr_flag things which original from Aubrey. How do you think of that?I don't think it is a very good idea - for me completion is one-time deal. You use it and then you are done. How about firing a work from interrupt and either rely on the default workqueue (keventd) or create your own to execute it?
completion is a wrapper of workqueue and simpler to use.
my method:
1. In kthread:
do {
|_______|_______wait_for_completion(&ad7142_completion);
|_______|_______ad7142_decode();
|_______|_______enable_irq(CONFIG_BFIN_JOYSTICK_IRQ_PFX);
|_______} while (!kthread_should_stop());
2. In irq handler will fire "complete(&ad7142_completion);"
This is simpler and understand easier
Thanks
-Bryan