Hi On Mon, Oct 1, 2018 at 11:20 PM Linus Walleij <linus.wall...@linaro.org> wrote: > > On Mon, Oct 1, 2018 at 3:36 PM Ricardo Ribalda Delgado > <ricardo.riba...@gmail.com> wrote: > > On Mon, Oct 1, 2018 at 1:54 PM Linus Walleij <linus.wall...@linaro.org> > > wrote: > > > On Fri, Sep 28, 2018 at 9:30 PM Ricardo Ribalda Delgado > > > <ricardo.riba...@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.
Dont take my job, I am the not smart of the conversation :P > > gpiochip_add_data() doesn't allocate anything, it > just adds a already allocated (or static!) gpio_chip > to the gpiolib subsystem. > Take a look to gpiochip_add_data_with_key() ->gpiochip_init_valid_mask() -> gpiochip->valid_mask = gpiochip_allocate_mask(gpiochip); > 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. I agree, and I believe that the cleaner way would be to add a function pointer that replaces: gpiochip_allocate_mask() bitmap_fill(p, chip->ngpio); with a proper initalization from the driver But as today the only driver that seems to be using valid_mask is msm, so perhaps a hack is something better and then when we have a second driver that requires it we figure out the real requirements. But it is definately your decision ;) > > Don't get confused by the &pctrl->chip > vs just chip variables, it's just some sloppiness. > > Yours, > Linus Walleij Thanks! -- Ricardo Ribalda