linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: bryan.wu@analog.com
Cc: Andrey Panin <pazke@donpac.ru>, Roel Kluin <12o3l@tiscali.nl>,
	"Ahmed S. Darwish" <darwish.07@gmail.com>,
	linux-input@atrey.karlin.mff.cuni.cz,
	linux-joystick@atrey.karlin.mff.cuni.cz,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Jean Delvare <khali@linux-fr.org>
Subject: Re: [PATCH try #4] Input/Joystick Driver: add support AD7142 joystick driver
Date: Wed, 17 Oct 2007 12:12:38 -0400	[thread overview]
Message-ID: <d120d5000710170912o3503a0f8s55bb4b7294f80e58@mail.gmail.com> (raw)
In-Reply-To: <1192605120.7920.15.camel@roc-laptop>

Hi Bryan,

On 10/17/07, Bryan Wu <bryan.wu@analog.com> wrote:
> Subject: [PATCH try #4] Input/Joystick Driver: add support AD7142 joystick driver
>

My comments are in addition to Jean's:

> +
> +static void ad7142_close(struct input_dev *dev)
> +{
> +       struct ad7142_data *data = input_get_drvdata(dev);
> +       struct i2c_client *client = &data->client;
> +       unsigned short value;
> +

I think you need disable_irq() here

> +       flush_scheduled_work();
> +
> +       /*
> +        * Turn AD7142 to full shutdown mode
> +        * No CDC conversions
> +        */
> +       value = 0x0001;
> +       ad7142_i2c_write(client, PWRCONVCTL, &value, 1);

and enable_irq() here. This way you can be sure that you will not
re-arm the work between flush_scheduled_work() and shutting off the
controller.

> +
> +static int ad7142_attach(struct i2c_adapter *adap)
> +{
> +       return i2c_probe(adap, &addr_data, &ad7142_probe);
> +}
> +
> +static int ad7142_detach(struct i2c_client *client)
> +{
> +       int rc;
> +
> +       free_irq(CONFIG_BFIN_JOYSTICK_IRQ_PFX, ad7142_interrupt);
> +
> +       flush_scheduled_work();
> +
> +       rc = i2c_detach_client(client);
> +       if (!rc)
> +               kfree(i2c_get_clientdata(client));
> +       return rc;
> +}
> +
> +
> +static int __init ad7142_init(void)
> +{
> +       return i2c_add_driver(&ad7142_driver);
> +}
> +
> +static void __exit ad7142_exit(void)
> +{
> +       i2c_del_driver(&ad7142_driver);
> +}
> +
> +module_init(ad7142_init);
> +module_exit(ad7142_exit);

Where did input_unregister_device() go? It still needs to be somewhere...

-- 
Dmitry

      parent reply	other threads:[~2007-10-17 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17  7:12 [PATCH try #4] Input/Joystick Driver: add support AD7142 joystick driver Bryan Wu
2007-10-17 14:07 ` Jean Delvare
2007-10-17 15:35   ` Bryan Wu
2007-10-17 19:14   ` Robin Getz
2007-10-17 20:04     ` Jean Delvare
2007-10-17 16:12 ` Dmitry Torokhov [this message]

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=d120d5000710170912o3503a0f8s55bb4b7294f80e58@mail.gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=12o3l@tiscali.nl \
    --cc=akpm@linux-foundation.org \
    --cc=bryan.wu@analog.com \
    --cc=darwish.07@gmail.com \
    --cc=khali@linux-fr.org \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-joystick@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pazke@donpac.ru \
    /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).