> > > > Gpiochip_add_data_with_keys only reads the ngpios property if > > > > (ngpios == 0) which is not the case when bgpio_init is called. bgpio_init > uses "sz" > > > argument to populate the ngpio in bgpio_init, which is not what we want. > > > > > > Maybe bgpio_init() is not a good API for your case? > > > > At the moment, bgpio_init handles all the direction in/out get/set gpio value > for us. > > So I can either remove bgpio_init so that we get the correct ngpios > property, but will have to define get_gpio, set_gpio, dir in and dir out. > > Or I can keep bgpio_init and device_property_read_u32 in the gpio- > mlxbf3.c driver. > > So far it seems the issue is in bgpio_init() that doesn't handle ngpios properly. > Maybe we need to fix this first? Ok I will send a sperate patch shortly addressing this. > Btw, have you considered using the gpio-regmap approach? Thanks! I see examples of drivers already using this (gpio-tn48m.c). Will take a look.