devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
	Pawel Moll <Pawel.Moll@arm.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"grant.likely@linaro.org" <grant.likely@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rtc-linux@googlegroups.com" <rtc-linux@googlegroups.com>,
	Mike Turquette <mturquette@linaro.org>
Subject: Re: [PATCH 2/2] rtc: add hym8563 rtc-driver
Date: Tue, 26 Nov 2013 00:40:01 +0100	[thread overview]
Message-ID: <201311260040.01716.heiko@sntech.de> (raw)
In-Reply-To: <20131125120125.GD32081@e106331-lin.cambridge.arm.com>

Am Montag, 25. November 2013, 13:01:25 schrieb Mark Rutland:
> [...]
> 
> > +static int hym8563_probe(struct i2c_client *client,
> > +                        const struct i2c_device_id *id)
> > +{
> > +       struct hym8563 *hym8563;
> > +       int ret, gpio_int;
> > +
> > +       hym8563 = devm_kzalloc(&client->dev, sizeof(hym8563),
> > GFP_KERNEL); +       if (!hym8563)
> > +               return -ENOMEM;
> > +
> > +       hym8563->client = client;
> > +       i2c_set_clientdata(client, hym8563);
> > +
> > +       device_set_wakeup_capable(&client->dev, true);
> > +
> > +       gpio_int = of_get_gpio(client->dev.of_node, 0);
> > +       if (!gpio_is_valid(gpio_int)) {
> > +               dev_err(&client->dev, "failed to get interrupt gpio\n");
> > +               return -EINVAL;
> > +       }
> > +
> > +       ret = devm_gpio_request_one(&client->dev, gpio_int,
> > +                                     GPIOF_DIR_IN, "hym8563_int");
> > +       if (ret) {
> > +               dev_err(&client->dev, "request of gpio %d failed, %d\n",
> > +                       gpio_int, ret);
> > +               return ret;
> > +       }
> 
> From here on the gpio is never used or even stashed away anywhere.
> What's the point in requesting it and then leaking it?

As I understand it, requesting gpio also is useful as a mechanism to mark them 
as used and therefore prevent a gpio from wrongly being used multiple times.

So, I guess it would be better to either ignore client->irq and just use 
gpio_to_irq or use client->irq alone, without the gpio-functions at all.

But what would be preferrable?

      reply	other threads:[~2013-11-25 23:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 21:54 [PATCH 0/2] Add support for hym8563 rtcs Heiko Stübner
2013-11-22 21:55 ` [PATCH 1/2] dt-bindings: add hym8563 binding Heiko Stübner
     [not found]   ` <201311222255.03642.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-11-25 11:50     ` Mark Rutland
     [not found] ` <201311222254.07730.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-11-22 21:55   ` [PATCH 2/2] rtc: add hym8563 rtc-driver Heiko Stübner
     [not found]     ` <201311222255.48943.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-11-25 12:01       ` Mark Rutland
2013-11-25 23:40         ` Heiko Stübner [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=201311260040.01716.heiko@sntech.de \
    --to=heiko@sntech.de \
    --cc=Pawel.Moll@arm.com \
    --cc=a.zummo@towertech.it \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@linaro.org \
    --cc=rob.herring@calxeda.com \
    --cc=rtc-linux@googlegroups.com \
    --cc=swarren@wwwdotorg.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).