linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: timur@kernel.org, jhugo@codeaurora.org,
	Stephen Boyd <swboyd@chromium.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH v2] gpiolib: Show correct direction from the beginning
Date: Mon, 1 Oct 2018 23:20:21 +0200	[thread overview]
Message-ID: <CACRpkdaN5G4ephY+6BPLRF+aUrO4-sPa+2erRYrwTGwPBwu8fw@mail.gmail.com> (raw)
In-Reply-To: <CAPybu_1P-RWCP8yjQKkFYAX11KtYGhAfASY24Q_NZ19PD09gxA@mail.gmail.com>

On Mon, Oct 1, 2018 at 3:36 PM Ricardo Ribalda Delgado
<ricardo.ribalda@gmail.com> wrote:
> On Mon, Oct 1, 2018 at 1:54 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> > On Fri, Sep 28, 2018 at 9:30 PM Ricardo Ribalda Delgado
> > <ricardo.ribalda@gmail.com> wrote:
> >
> > > How do we proceed from here? Can you fix your driver somehow to
> > > init the valid mask before enabling the gpio?
> >
> > Just include a hunk to the qcom driver reordering this call
> > at the same time. No need to make it separate patches,
> > it need to be tested together anyways.
> >
> > I guess just switch the order of these two:
> >
> >         ret = gpiochip_add_data(&pctrl->chip, pctrl);
> >         if (ret) {
> >                 dev_err(pctrl->dev, "Failed register gpiochip\n");
> >                 return ret;
> >         }
> >
> >         ret = msm_gpio_init_valid_mask(chip, pctrl);
> >         if (ret) {
> >                 dev_err(pctrl->dev, "Failed to setup irq valid bits\n");
> >                 gpiochip_remove(&pctrl->chip);
> >                 return ret;
> >         }
> >
>
> the problem is that valid_mask is not a long/integer, is a struct that
> needs to be malloced, and is malloc at gpiochip_add_data :(

I don't get it, but maybe I'm not smart enough.

gpiochip_add_data() doesn't allocate anything, it
just adds a already allocated (or static!) gpio_chip
to the gpiolib subsystem.

In fact I think it is wrong to set up the mask after
calling gpiolob_add_data(), because of exactly the
type of problem you're seeing.

Don't get confused by the &pctrl->chip
vs just chip variables, it's just some sloppiness.

Yours,
Linus Walleij

  parent reply	other threads:[~2018-10-01 21:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-21 10:36 [PATCH] gpiolib: Fix gpio_direction_* for single direction GPIOs Ricardo Ribalda Delgado
2018-09-21 10:36 ` [PATCH v2] gpiolib: Show correct direction from the beginning Ricardo Ribalda Delgado
2018-09-21 12:25   ` Timur Tabi
2018-09-27  6:51   ` Stephen Boyd
2018-09-27 12:19     ` Timur Tabi
2018-09-27 14:04       ` Jeffrey Hugo
2018-09-27 14:19         ` Timur Tabi
2018-09-27 14:34           ` Jeffrey Hugo
2018-09-28 19:14         ` Jeffrey Hugo
2018-09-28 19:22           ` Timur Tabi
2018-09-29  6:23             ` Ricardo Ribalda Delgado
2018-09-29 13:21               ` Timur Tabi
2018-09-29 13:25                 ` Timur Tabi
     [not found]             ` <D3E6F4C4-E1C4-4D88-B118-878576BF5281@gmail.com>
2018-10-01 11:54               ` Linus Walleij
2018-10-01 13:36                 ` Ricardo Ribalda Delgado
2018-10-01 14:27                   ` Jeffrey Hugo
2018-10-01 21:20                   ` Linus Walleij [this message]
2018-10-02  7:15                     ` Ricardo Ribalda Delgado
2018-10-02  7:38                       ` Linus Walleij
2018-10-02 12:26                         ` Timur Tabi
2018-10-02 12:51                           ` Linus Walleij
2018-09-25  7:36 ` [PATCH] gpiolib: Fix gpio_direction_* for single direction GPIOs 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=CACRpkdaN5G4ephY+6BPLRF+aUrO4-sPa+2erRYrwTGwPBwu8fw@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=jhugo@codeaurora.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ricardo.ribalda@gmail.com \
    --cc=swboyd@chromium.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).