mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Alexandre Courbot <gnurou@gmail.com>,
	"Zhu, Lejun" <lejun.zhu@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	jacob.jun.pan@linux.intel.com, bin.yang@intel.com
Subject: Re: [PATCH v4] gpio: Add support for Intel SoC PMIC (Crystal Cove)
Date: Tue, 27 May 2014 18:14:53 +0300	[thread overview]
Message-ID: <20140527151453.GB2067@lahna.fi.intel.com> (raw)
In-Reply-To: <53847F39.2010503@ti.com>

On Tue, May 27, 2014 at 03:04:09PM +0300, Grygorii Strashko wrote:
> Hi Mika,
> 
> On 05/27/2014 11:46 AM, Mika Westerberg wrote:
> > On Tue, May 27, 2014 at 12:24:56PM +0300, Grygorii Strashko wrote:
> >>>> +
> >>>> +       if (retval) {
> >>>> +               dev_warn(&pdev->dev, "request irq failed: %d\n", retval);
> >>>> +               goto out;
> >>>> +       }
> >>>> +
> >>>> +       retval = gpiochip_add(&cg->chip);
> >>>> +       if (retval) {
> >>>> +               dev_warn(&pdev->dev, "add gpio chip error: %d\n", retval);
> >>>> +               goto out_free_irq;
> >>>> +       }
> >>
> >> As to my mind, It'll be better to setup IRQ as last probing step and
> >> free it as the first step of driver removing.
> > 
> > When gpiochip_add() is called the chip is exported to outside world. At
> > that point anyone can start requesting GPIOs and setup GPIO based
> > interrupts. How does that work if you setup the IRQ after you call
> > gpiochip_add()?
> > 
> 
> It's difficult for me to imagine case when GPIO will be accessed
> until GPIO driver's probe is finished.

Once you call gpiochip_add() your driver gets registered to the GPIO
subsystem and advertised outside. It doesn't matter whether your probe
function is finished or not.

> Regarding remove()/suspend() routines, It's like an axiom for me:
> - always disable irq
> - always stop all works/threads created by driver
> - do everything else
> (It's proved by dozens hours of debugging).

That's true for remove and suspend, yes but I'm not talking about them.

> Anyway, above is just my opinion :)
> So, It's up to you, because it's your code :)

No it's not, it's Lejun's driver :)

  reply	other threads:[~2014-05-27 15:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  2:00 Zhu, Lejun
2014-05-27  5:38 ` Alexandre Courbot
2014-05-27  6:15   ` Alexandre Courbot
2014-05-27  6:22   ` Zhu, Lejun
2014-05-27  9:24   ` Grygorii Strashko
2014-05-27  8:46     ` Mika Westerberg
2014-05-27 12:04       ` Grygorii Strashko
2014-05-27 15:14         ` Mika Westerberg [this message]
2014-05-29 13:37         ` Linus Walleij
2014-05-29 15:00           ` Mika Westerberg
2014-05-29 16:03             ` Grygorii Strashko
2014-05-29 15:22               ` Linus Walleij
2014-05-30  8:25                 ` Mika Westerberg
2014-06-03  8:10                   ` Linus Walleij
2014-06-03 10:57                     ` Mika Westerberg
2014-05-30  2:12           ` Zhu, Lejun
2014-06-03  8:08             ` Linus Walleij
2014-05-27  8:56     ` Zhu, Lejun

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=20140527151453.GB2067@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=bin.yang@intel.com \
    --cc=gnurou@gmail.com \
    --cc=grygorii.strashko@ti.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=lejun.zhu@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.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

all inboxes | Powered by JetHome®