linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Grzeschik <mgr@pengutronix.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH] pcf8574_keypad: use request_devm_threaded_irq
Date: Tue, 23 Jun 2015 08:42:38 +0200	[thread overview]
Message-ID: <20150623064238.GD19386@pengutronix.de> (raw)
In-Reply-To: <20150622205552.GB2350@dtor-ws>

On Mon, Jun 22, 2015 at 01:55:52PM -0700, Dmitry Torokhov wrote:
> On Fri, Jun 19, 2015 at 12:35:54PM +0200, Michael Grzeschik wrote:
> > We can use the devres API here. Remove the extra cleanup codepath.
> 
> We could, but not like that (hint: what is the order of releasing
> resources with your patch?). Also, calling free_irq() on IRQ requested
> by devm_* is not quite valid. Did you test the patch, especially the
> remove portion?

Doh, thanks for the hints. I will send v2.

Michael

> 
> > 
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> >  drivers/input/misc/pcf8574_keypad.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c
> > index 97f711a..62fcf36 100644
> > --- a/drivers/input/misc/pcf8574_keypad.c
> > +++ b/drivers/input/misc/pcf8574_keypad.c
> > @@ -131,7 +131,8 @@ static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_i
> >  
> >  	lp->laststate = read_state(lp);
> >  
> > -	ret = request_threaded_irq(client->irq, NULL, pcf8574_kp_irq_handler,
> > +	ret = devm_request_threaded_irq(&client->dev, client->irq,
> > +				   NULL, pcf8574_kp_irq_handler,
> >  				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> >  				   DRV_NAME, lp);
> >  	if (ret) {
> > @@ -142,14 +143,12 @@ static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_i
> >  	ret = input_register_device(idev);
> >  	if (ret) {
> >  		dev_err(&client->dev, "input_register_device() failed\n");
> > -		goto fail_free_irq;
> > +		goto fail_free_device;
> >  	}
> >  
> >  	i2c_set_clientdata(client, lp);
> >  	return 0;
> >  
> > - fail_free_irq:
> > -	free_irq(client->irq, lp);
> >   fail_free_device:
> >  	input_free_device(idev);
> >   fail_allocate:
> > -- 
> > 2.1.4
> > 
> 
> Thanks.
> 
> -- 
> Dmitry
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in

      reply	other threads:[~2015-06-23  6:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 10:35 [PATCH] pcf8574_keypad: use request_devm_threaded_irq Michael Grzeschik
2015-06-22 20:55 ` Dmitry Torokhov
2015-06-23  6:42   ` Michael Grzeschik [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=20150623064238.GD19386@pengutronix.de \
    --to=mgr@pengutronix.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.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).