HI Geert, Thanks for the feedback. > -----Original Message----- > From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> > Sent: 04 August 2018 10:25 > To: Biju Das <biju.das@xxxxxxxxxxxxxx> > Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>; open list:GPIO SUBSYSTEM > <linux-gpio@xxxxxxxxxxxxxxx>; Simon Horman <horms@xxxxxxxxxxxx>; > Geert Uytterhoeven <geert+renesas@xxxxxxxxx>; Chris Paterson > <Chris.Paterson2@xxxxxxxxxxx>; Fabrizio Castro > <fabrizio.castro@xxxxxxxxxxxxxx>; Linux-Renesas <linux-renesas- > soc@xxxxxxxxxxxxxxx> > Subject: Re: [PATCH v2 1/5] gpio: rcar: Add GPIO hole support > > > > @@ -471,6 +495,7 @@ static int gpio_rcar_probe(struct > > > > platform_device > > > *pdev) > > > > gpio_chip->owner = THIS_MODULE; > > > > gpio_chip->base = -1; > > > > gpio_chip->ngpio = npins; > > > > + gpio_chip->need_valid_mask = p->bank_info.gpiomsk ? true : > > > > + false; > > > > > > gpiochip_init_valid_mask() already sets gpio_chip->need_valid_mask > > > to true if "gpio-reserved-ranges" is detected. > > > > The plan is to set "of_node" variable in driver. So that > gpiochip_init_valid_mask() sets gpio_chip->need_valid_mask to true. > > What is your opinion on this? > > Sounds fine to me. > > You said on IRC that it currently crashes when "gpio-reserved-ranges" is > used. Yes that is correct. if we add "gpio-reserved-ranges" on device tree without setting "of_node" or " need_valid_mask" in driver, gpiochip_init_valid_mask() won't allocate memory for valid_mask and bitmap_clear() in of_gpiochip_init_valid_mask() crashes. May be we need to modify the code like this to fix the crash. if (chip->valid_mask) bitmap_clear(chip->valid_mask, start, count); else pr_warn("valid_mask is not set "); > IMHO that's something that should be fixed separately, possibly for v4.19. > > Looks like all other Renesas gpio drivers (some combined pinctrl/gpio), > except for gpio-em.c, also fail to set gpio_chip.of_node. Will have a closer > look... Regards, Biju Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.