[PATCH v2 2/2] input: Add support for the Semtech SX8634 controller
Thierry Reding
thierry.reding at avionic-design.de
Tue Jul 24 06:15:37 EST 2012
On Mon, Jul 23, 2012 at 09:48:16AM -0700, Dmitry Torokhov wrote:
> Hi Thierry,
>
> On Mon, Jul 23, 2012 at 02:18:47PM +0200, Thierry Reding wrote:
> > +
> > + if (gpio_is_valid(sx->power_gpio)) {
> > + err = gpio_request(sx->power_gpio, "sx8634 power");
> > + if (err < 0) {
> > + dev_err(&client->dev,
> > + "failed to request power GPIO#%u: %d\n",
> > + sx->power_gpio, err);
> > + goto free_input_device;
> > + }
> > +
> > + err = gpio_direction_output(sx->power_gpio, 1);
> > + if (err < 0) {
> > + dev_err(&client->dev, "failed to enable power: %d\n",
> > + err);
> > + goto free_power_gpio;
> > + }
>
> I think there is gpio_request_one() that will take care of tehse 2
> calls.
Right, that shortens this by half.
>
> > +
> > + msleep(150);
> > + }
> > +
> > + err = sx8634_setup(sx, pdata);
> > + if (err < 0)
> > + goto free_power_gpio;
> > +
> > + err = sysfs_create_group(&client->dev.kobj, &sx8634_attr_group);
> > + if (err < 0)
> > + goto free_power_gpio;
> > +
> > + err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
> > + sx8634_irq, IRQF_ONESHOT, "sx8634",
> > + sx);
>
> Please do not use devm_* interface here as it make the driverr bomb in
> remove() where you unregister input device but keep interrupt handler
> active until after remove() finishes.
Okay, will do. There is devm_free_irq() but I guess it isn't worth the
overhead since the only benefit would be that it simplifies the .probe()
error unwinding a bit.
> > +#ifdef CONFIG_PM_SLEEP
> > +static int sx8634_i2c_suspend(struct device *dev)
> > +{
> > + return 0;
> > +}
> > +
> > +static int sx8634_i2c_resume(struct device *dev)
> > +{
> > + return 0;
> > +}
> > +#endif
> > +
> > +static SIMPLE_DEV_PM_OPS(sx8634_i2c_pm, sx8634_i2c_suspend, sx8634_i2c_resume);
>
> Why are these stubs needed?
They're not, I'll drop them.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20120723/095b8697/attachment.sig>
More information about the devicetree-discuss
mailing list