From: Fabien Marteau <fabien.marteau@armadeus.com>
To: Anirudh Ghayal <anirudhghayal@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
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
Date: Thu, 25 Nov 2010 11:32:23 +0100 [thread overview]
Message-ID: <4CEE3B37.6030801@armadeus.com> (raw)
In-Reply-To: <AANLkTi=UNGfPxp+7-cCu8U=g2CyEQJ5npjJjzEbYCO84@mail.gmail.com>
Hi Anirudh,
Thanks for your code review.
>> +static void as5011_update_axes(struct work_struct *work)
>> +{
>> + struct as5011_platform_data *plat_dat =
>> + container_of(work,
>> + struct as5011_platform_data,
>> + update_axes_work);
>> + signed char x, y;
>> +
>> + x = as5011_i2c_read(plat_dat->i2c_client, AS5011_X_RES_INT);
>> + y = as5011_i2c_read(plat_dat->i2c_client, AS5011_Y_RES_INT);
>
> What if the read call returns an error ?
It's a problem yes. But I don't know how to manage this error in this context.
>> +static int as5011_probe(struct i2c_client *client,
>> + const struct i2c_device_id *id)
>> +{
>
> __devinit as5011_probe()
Ok, done.
>> + if (request_irq(plat_dat->int_irq, as5011_int_interrupt,
>> + 0, plat_dat->int_irq_name, (void *)plat_dat)) {
>
> How about using request_any_context_irq() ?
Hmm, in fact my platform use a hard IRQ and I used it without question.
I will see how to improve it.
>
>> + dev_err(&client->dev, "as5011: Can't allocate int irq %d\n",
>> + plat_dat->int_irq);
>> + retval = -EBUSY;
>> + goto request_int_irq_error;
>> + }
>> +
>> + retval = input_register_device(plat_dat->input_dev);
>
> Its better to register your device at the end, after all the initialization.
Yes it was a mistake. Done.
>
>> + if (retval) {
>> + dev_err(&client->dev, "as5011: Failed to register device\n");
>> + retval = -EINVAL;
>> + goto input_register_device_error;
>> + }
>> +
>> + retval = plat_dat->init_gpio();
>
> Please check if the function pointer is NULL.
Ok, done.
>> + plat_dat->exit_gpio();
>
> Please check if the function pointer is NULL.
done.
>> + plat_dat->exit_gpio();
>
> Same here.
done.
>> + .remove = as5011_remove,
>
> __devexit_p (as5011_remove)
done.
Thanks.
Fabien
next prev parent reply other threads:[~2010-11-25 10:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 16:36 [PATCH] input: joystick: Adding Austria Microsystem AS5011 joystick driver Fabien Marteau
2010-11-23 17:45 ` Dan Carpenter
2010-11-24 15:29 ` Anirudh Ghayal
2010-11-25 10:32 ` Fabien Marteau [this message]
2010-11-24 19:55 ` Dmitry Torokhov
2010-11-25 10:10 ` Fabien Marteau
2010-11-27 8:19 ` 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=4CEE3B37.6030801@armadeus.com \
--to=fabien.marteau@armadeus.com \
--cc=anirudhghayal@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oreaus@gmail.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