All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-gpio@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v1] pinctrl: intel: Allow to request locked pins
Date: Tue, 6 Aug 2019 14:47:24 +0300	[thread overview]
Message-ID: <20190806114724.GU2548@lahna.fi.intel.com> (raw)
In-Reply-To: <20190806114517.GT23480@smile.fi.intel.com>

On Tue, Aug 06, 2019 at 02:45:17PM +0300, Andy Shevchenko wrote:
> On Tue, Aug 06, 2019 at 02:01:26PM +0300, Mika Westerberg wrote:
> > On Fri, Jul 26, 2019 at 11:08:30PM +0300, Andy Shevchenko wrote:
> > > Some firmwares would like to protect pins from being modified by OS
> > > and at the same time provide them to OS as a resource. So, the driver
> > > in such circumstances may request pin and may not change its state.
> > 
> > This is definitely good idea.
> 
> Thanks for review, my answers below.
> 
> > >  	 * the pad is considered unlocked. Any other case means that it is
> > >  	 * either fully or partially locked and we don't touch it.
> > 
> > I think you should update the above comment as well.
> 
> Will do for v2.
> 
> > >  	raw_spin_lock_irqsave(&pctrl->lock, flags);
> > >  
> > > -	if (!intel_pad_usable(pctrl, pin)) {
> > > +	if (!intel_pad_owned_by_host(pctrl, pin)) {
> > >  		raw_spin_unlock_irqrestore(&pctrl->lock, flags);
> > >  		return -EBUSY;
> > >  	}
> > >  
> > > +	if (!intel_pad_is_unlocked(pctrl, pin)) {
> > > +		raw_spin_unlock_irqrestore(&pctrl->lock, flags);
> > > +		return 0;
> > 
> > Hmm, if I'm reading this right it still does not allow requesting locked
> > pins. What I'm missing here?
> 
> We do not return an error code here, so pin is left requested but pad
> configuration register untouched.

Indeed, now it is clear. Thanks for explaining :)

  reply	other threads:[~2019-08-06 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26 20:08 [PATCH v1] pinctrl: intel: Allow to request locked pins Andy Shevchenko
2019-08-06 11:01 ` Mika Westerberg
2019-08-06 11:45   ` Andy Shevchenko
2019-08-06 11:47     ` Mika Westerberg [this message]
2019-08-06 14:27 ` Linus Walleij

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=20190806114724.GU2548@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.