linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: timur@kernel.org
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>,
	Timur Tabi <timur@codeaurora.org>,
	Stephen Boyd <swboyd@chromium.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gpiolib: Show correct direction from the beginning
Date: Wed, 19 Sep 2018 22:23:42 -0700	[thread overview]
Message-ID: <CACRpkdYGpEVG9gqPxNaOsD55k9idEfGaxOUrObbN9VZS06x5jw@mail.gmail.com> (raw)
In-Reply-To: <d84ee082-f578-3ed3-32be-dbeb9562980e@kernel.org>

On Wed, Sep 19, 2018 at 4:50 AM Timur Tabi <timur@kernel.org> wrote:
> On 9/18/18 11:04 PM, Ricardo Ribalda Delgado wrote:
> > And should't that be tacked in qcom hardware with something like:
> >
> > if (!priv->initialized)
> >     return INPUT;
> >
> > if you or Timur point me to the harware that was crashing I would not
> > mind looking into that, but the current situations seems to me like a
> > hack.
>
> I'd say the previous code was the hack.  My comment about not touching
> the hardware until it is properly claimed is valid, and it applies to
> all platforms.

I am a bit uncertain, I understand the reasoning that unless a GPIO line
has been "claimed" (i.e. .request() was called on it) then we should not
call any of the gpiochip callbacks.

But this is merely a convention, the gpiochip becomes what we want
it to be and it has the semantics we want it to have.

It also makes sense to inquire the direction initially so we know the
state of the hardware in the library.

I think most gpiochips easily survives calling the .get_direction()
early, Qualcomm's stand out here.

Now that we have .valid_mask in the gpiochip could we simply just
add this back, resepecting valid_mask and avoid checking the
direction of precisely these GPIOs?

Yours,
Linus Walleij

  parent reply	other threads:[~2018-09-20  5:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14  7:08 [RFC] gpiolib: Fix gpio_direction_* for single direction GPIOs Ricardo Ribalda Delgado
2018-09-14  7:08 ` [PATCH] gpiolib: Show correct direction from the beginning Ricardo Ribalda Delgado
2018-09-18 22:40   ` Linus Walleij
2018-09-19  4:04     ` Ricardo Ribalda Delgado
2018-09-19 11:50       ` Timur Tabi
2018-09-19 15:27         ` Ricardo Ribalda Delgado
2018-09-20 12:20           ` Timur Tabi
2018-09-20 14:14             ` Ricardo Ribalda Delgado
2018-09-20 22:43               ` Linus Walleij
2018-09-20 12:25           ` Timur Tabi
2018-09-20  5:23         ` Linus Walleij [this message]
2018-09-20 12:35           ` Timur Tabi
2018-09-20 22:36             ` Linus Walleij
2018-09-21  2:05               ` Timur Tabi
2018-09-21 16:07                 ` 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=CACRpkdYGpEVG9gqPxNaOsD55k9idEfGaxOUrObbN9VZS06x5jw@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ricardo.ribalda@gmail.com \
    --cc=swboyd@chromium.org \
    --cc=timur@codeaurora.org \
    --cc=timur@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).