[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdaN5G4ephY+6BPLRF+aUrO4-sPa+2erRYrwTGwPBwu8fw@mail.gmail.com>
Date: Mon, 1 Oct 2018 23:20:21 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
Cc: timur@...nel.org, jhugo@...eaurora.org,
Stephen Boyd <swboyd@...omium.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v2] gpiolib: Show correct direction from the beginning
On Mon, Oct 1, 2018 at 3:36 PM Ricardo Ribalda Delgado
<ricardo.ribalda@...il.com> wrote:
> On Mon, Oct 1, 2018 at 1:54 PM Linus Walleij <linus.walleij@...aro.org> wrote:
> > On Fri, Sep 28, 2018 at 9:30 PM Ricardo Ribalda Delgado
> > <ricardo.ribalda@...il.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
Powered by blists - more mailing lists