If the user did not pass a parent in the struct gpio_chip
then use the device used for devres as parent.
This is quite intuitive and can help avoiding having to
assign parent explicitly in every driver using devres
to add the gpiochip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patch.msgid.link/20260427-gpio-mmio-more-v3-1-fe1882351424@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
{
int ret;
+ /*
+ * We are passing the devres device here so if the user did not pass
+ * another parent, it's this one.
+ */
+ if (!gc->parent)
+ gc->parent = dev;
+
ret = gpiochip_add_data_with_key(gc, data, lock_key, request_key);
if (ret < 0)
return ret;