From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Fabien Marteau <fabien.marteau@armadeus.com>
Cc: Trilok Soni <tsoni@codeaurora.org>,
Scott Moreau <oreaus@gmail.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] input: joystick: Adding Austria Microsystem AS5011 joystick driver (second version)
Date: Sat, 1 Jan 2011 23:41:39 -0800 [thread overview]
Message-ID: <20110102074139.GA5429@core.coreip.homeip.net> (raw)
In-Reply-To: <4D1DC09F.2030404@armadeus.com>
Hi Fabien,
On Fri, Dec 31, 2010 at 12:38:07PM +0100, Fabien Marteau wrote:
> Hi Trilok,
>
> >
> >> + int ret;
> >> +
> >> + mutex_lock(&plat_dat->button_lock);
> >> + ret = gpio_get_value(plat_dat->button_gpio);
> >> + if (ret)
> >> + input_report_key(plat_dat->input_dev, BTN_JOYSTICK, 0);
> >> + else
> >> + input_report_key(plat_dat->input_dev, BTN_JOYSTICK, 1);
> >> + input_sync(plat_dat->input_dev);
> >> + mutex_unlock(&plat_dat->button_lock);
> >
> > Do you need this lock? Please explain.
>
> If gpio_get_value() sleep, I need it to avoid race condition.
Race condition with what though?
>
> >> +static int as5011_i2c_write(struct i2c_client *client,
> >> + uint8_t aRegAddr,
> >> + uint8_t aValue)
> >> +{
> >> + int ret;
> >> + uint8_t data[2] = { aRegAddr, aValue };
> >
> > No CamelCases please. Please run scripts/checkpatch.pl on your patch before submission.
>
> I had no warning for CamelCases name.
This goes wihtout saying ;)
>
> >> +static int __devinit as5011_probe(struct i2c_client *client,
> >> + const struct i2c_device_id *id)
> >> +{
> >> + struct as5011_platform_data *plat_dat = client->dev.platform_data;
> >> + int retval = 0;
> >> +
> >> + plat_dat->num = g_num;
> >> + g_num++;
> >
> > What is g_num++ and why it has to be global?
>
> It's for interruptions name, if several as5011 joystick I set a number different for each joystick :
>
> scnprintf(plat_dat->button_irq_name,
> SIZE_NAME,
> "as5011_%d_button",
> plat_dat->num);
Right, but who cares about having different names? Just mark all
interrupts as5011_button and as5011_joystick or even simply use "as5011"
for everything and call it a day.
--
Dmitry
next prev parent reply other threads:[~2011-01-02 8:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-30 10:37 [PATCH] input: joystick: Adding Austria Microsystem AS5011 joystick driver (second version) Fabien Marteau
2010-12-31 10:14 ` Trilok Soni
2010-12-31 11:38 ` Fabien Marteau
2011-01-02 7:41 ` Dmitry Torokhov [this message]
2011-01-02 7:58 ` 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=20110102074139.GA5429@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=fabien.marteau@armadeus.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oreaus@gmail.com \
--cc=tsoni@codeaurora.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).