From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: bryan.wu@analog.com
Cc: linux-input@atrey.karlin.mff.cuni.cz,
linux-joystick@atrey.karlin.mff.cuni.cz,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH try #2] Input/Joystick Driver: add support AD7142 joystick driver
Date: Fri, 12 Oct 2007 12:14:28 -0400 [thread overview]
Message-ID: <d120d5000710120914n79c78e61ia3de6c8ce418eb61@mail.gmail.com> (raw)
In-Reply-To: <1192204757.7089.9.camel@roc-laptop>
On 10/12/07, Bryan Wu <bryan.wu@analog.com> wrote:
> On Fri, 2007-10-12 at 11:50 -0400, Dmitry Torokhov wrote:
> > On 10/12/07, Bryan Wu <bryan.wu@analog.com> wrote:
> > > On Fri, 2007-10-12 at 10:49 -0400, Dmitry Torokhov wrote:
> > > > Hi Bryan,
> > > >
> > > > On 10/12/07, Bryan Wu <bryan.wu@analog.com> wrote:
> > > > > +
> > > [snip]
> > > > > +
> > > > > +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
>
You also need to re-initialize completion every time you done
processing in kthread otherwise you will be constantly doing
ad7142_decode(). Plus, how are you going to stop kthread (completion
may not be signalled for a long time if nobody touches the joystick).
--
Dmitry
next prev parent reply other threads:[~2007-10-12 16:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-12 7:38 [PATCH try #2] Input/Joystick Driver: add support AD7142 joystick driver Bryan Wu
2007-10-12 7:51 ` Andrey Panin
2007-10-12 9:14 ` Roel Kluin
2007-10-12 14:49 ` Dmitry Torokhov
2007-10-12 15:39 ` Bryan Wu
2007-10-12 15:50 ` Dmitry Torokhov
2007-10-12 15:59 ` Bryan Wu
2007-10-12 16:14 ` Dmitry Torokhov [this message]
2007-10-12 16:41 ` Ahmed S. Darwish
2007-10-12 17:29 ` Dmitry Torokhov
2007-10-12 19:21 ` Ahmed S. Darwish
2007-10-12 20:23 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d120d5000710120914n79c78e61ia3de6c8ce418eb61@mail.gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bryan.wu@analog.com \
--cc=linux-input@atrey.karlin.mff.cuni.cz \
--cc=linux-joystick@atrey.karlin.mff.cuni.cz \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).