From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Miguel Aguilar <miguel.aguilar@ridgerun.com>
Cc: nsnehaprabha@ti.com,
davinci-linux-open-source@linux.davincidsp.com,
linux-input@vger.kernel.org, todd.fischer@ridgerun.com,
diego.dompe@ridgerun.com, clark.becker@ridgerun.com,
santiago.nunez@ridgerun.com
Subject: Re: [PATCH 1/2] Input: DaVinci Keypad Driver
Date: Thu, 24 Sep 2009 09:21:53 -0700 [thread overview]
Message-ID: <20090924162152.GA26484@core.coreip.homeip.net> (raw)
In-Reply-To: <4ABB896C.4010205@ridgerun.com>
On Thu, Sep 24, 2009 at 08:59:56AM -0600, Miguel Aguilar wrote:
> Dmitry,
>
> I addressed your comments but I still have a couple of questions.
Thank you for making the adjustments.
>
> [MA] This is the current irq function:
> static irqreturn_t davinci_ks_interrupt(int irq, void *dev_id)
> {
> struct davinci_ks *davinci_ks = dev_id;
> struct device *dev = &davinci_ks->input->dev;
> unsigned short *keymap = davinci_ks->keymap;
> u32 prev_status, new_status, changed, position;
> bool release;
> int keycode = KEY_UNKNOWN;
> int ret = IRQ_NONE;
>
> /* Disable interrupt */
> davinci_ks_write(davinci_ks, 0x0, DAVINCI_KEYSCAN_INTENA);
>
> /* Reading previous and new status of the key scan */
> prev_status = davinci_ks_read(davinci_ks, DAVINCI_KEYSCAN_PREVSTATE);
> new_status = davinci_ks_read(davinci_ks, DAVINCI_KEYSCAN_CURRENTST);
>
> changed = prev_status ^ new_status;
> position = ffs(changed) - 1;
>
> if (changed) {
> keycode = keymap[position];
> release = (new_status >> position) & 0x1;
> dev_dbg(dev, "davinci_keyscan: key %d %s\n",
> keycode, release ? "released" : "pressed");
>
> input_report_key(davinci_ks->input, keycode, !release);
> input_sync(davinci_ks->input);
>
> /* Clearing interrupt */
> davinci_ks_write(davinci_ks, DAVINCI_KEYSCAN_INT_ALL,
> DAVINCI_KEYSCAN_INTCLR);
>
> ret = IRQ_HANDLED;
> }
>
> /* Enable interrupts */
> davinci_ks_write(davinci_ks, 0x1, DAVINCI_KEYSCAN_INTENA);
>
> return ret;
I'd just return IRQ_HANDLED unconditionally and I think you should go
through all bits in changed to ensure that you don't lose key presses
(unless controller never ever reports more than 1 key pressed).
> }
>
>
>
>>> +static int __init davinci_kp_init(void)
>>> +{
>>> + return platform_driver_probe(&davinci_kp_driver, davinci_kp_probe);
>>> +}
>>> +module_init(davinci_kp_init);
> [MA] Should I use platform_driver_probe?
>
I don't see why not - you are still saving memory due to discarding
davinci_kp_probe. And if driver core is changed so that unbind is a NOP
for drivers registered with platform_driver_probe I will gladly accept a
follow-up patch to change __devexit to __exit for even more savings.
>>> +static void __exit davinci_kp_exit(void)
>>> +{
>>> + platform_driver_unregister(&davinci_kp_driver);
>>> +}
>>> +module_exit(davinci_kp_exit);
> [MA] Is the module exit function __exit or __devexit
>
Module ext routines are always __exit (and inits are __init).
Thanks.
--
Dmitry
prev parent reply other threads:[~2009-09-24 16:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-22 21:27 [PATCH 1/2] Input: DaVinci Keypad Driver miguel.aguilar
2009-09-23 3:46 ` Dmitry Torokhov
2009-09-23 14:52 ` Miguel Aguilar
2009-09-23 16:35 ` Dmitry Torokhov
2009-09-23 17:07 ` Miguel Aguilar
2009-09-23 17:25 ` Miguel Aguilar
2009-09-23 17:41 ` Dmitry Torokhov
2009-09-23 18:15 ` Miguel Aguilar
2009-09-23 18:19 ` Dmitry Torokhov
2009-09-23 17:51 ` David Brownell
2009-09-23 18:07 ` Dmitry Torokhov
2009-09-23 19:29 ` David Brownell
2009-09-23 19:51 ` Dmitry Torokhov
2009-09-23 23:05 ` David Brownell
2009-09-24 5:40 ` Dmitry Torokhov
2009-09-24 14:59 ` Miguel Aguilar
2009-09-24 16:21 ` 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=20090924162152.GA26484@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=clark.becker@ridgerun.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=diego.dompe@ridgerun.com \
--cc=linux-input@vger.kernel.org \
--cc=miguel.aguilar@ridgerun.com \
--cc=nsnehaprabha@ti.com \
--cc=santiago.nunez@ridgerun.com \
--cc=todd.fischer@ridgerun.com \
/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).