[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d120d5000710170912o3503a0f8s55bb4b7294f80e58@mail.gmail.com>
Date: Wed, 17 Oct 2007 12:12:38 -0400
From: "Dmitry Torokhov" <dmitry.torokhov@...il.com>
To: bryan.wu@...log.com
Cc: "Andrey Panin" <pazke@...pac.ru>, "Roel Kluin" <12o3l@...cali.nl>,
"Ahmed S. Darwish" <darwish.07@...il.com>,
linux-input@...ey.karlin.mff.cuni.cz,
linux-joystick@...ey.karlin.mff.cuni.cz,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
"Jean Delvare" <khali@...ux-fr.org>
Subject: Re: [PATCH try #4] Input/Joystick Driver: add support AD7142 joystick driver
Hi Bryan,
On 10/17/07, Bryan Wu <bryan.wu@...log.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists