On Tue, Feb 18, 2025 at 02:24:32PM GMT, Geert Uytterhoeven wrote: > Hi Den-san, > > On Mon, 17 Feb 2025 at 15:28, Koichiro Den <koichiro.den@xxxxxxxxxxxxx> wrote: > > Both gpio-sim and gpio-virtuser share a mechanism to instantiate a > > platform device and wait synchronously for probe completion. > > With gpio-aggregator adopting the same approach in a later commit for > > its configfs interface, it's time to factor out the common code. > > > > Add gpio-pseudo.[ch] to house helper functions used by all the pseudo > > GPIO device implementations. > > > > No functional change. > > > > Signed-off-by: Koichiro Den <koichiro.den@xxxxxxxxxxxxx> > > Thanks for your patch! > > > --- /dev/null > > +++ b/drivers/gpio/gpio-pseudo.c > > > +int pseudo_gpio_register(struct pseudo_gpio_common *common, > > + struct platform_device_info *pdevinfo) > > +{ > > + struct platform_device *pdev; > > + char *name; > > + > > + name = kasprintf(GFP_KERNEL, "%s.%u", pdevinfo->name, pdevinfo->id); > > + if (!name) > > + return -ENOMEM; > > + > > + common->driver_bound = false; > > + common->name = name; > > + reinit_completion(&common->probe_completion); > > + bus_register_notifier(&platform_bus_type, &common->bus_notifier); > > + > > + pdev = platform_device_register_full(pdevinfo); > > + if (IS_ERR(pdev)) { > > + bus_unregister_notifier(&platform_bus_type, &common->bus_notifier); > > + kfree(common->name); > > On arm32: > error: implicit declaration of function ‘kfree’ > > Adding #include <linux/slab.h> fixes that. > Probably you want to include a few more, to avoid relying on > implicit includes. Thank you for pointing that out! Koichiro > > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds