On Mon, Jul 4, 2022 at 3:06 PM Henning Schild <henning.schild@xxxxxxxxxxx> wrote: > > This patch adds gpio support for several Nuvoton NCTXXX chips. These GPIO s/This patch adds/Add/ > Super-I/O chips offer multiple functions of which several already have > drivers in the kernel, i.e. hwmon and watchdog. Seems better, my comments below. ... > +#include <linux/gpio/driver.h> > +#include <linux/init.h> > +#include <linux/io.h> > +#include <linux/module.h> > +#include <linux/platform_device.h> At least types.h and bits.h are missed here. ... > +#define gpio_dir(base) ((base) + 0) > +#define gpio_data(base) ((base) + 1) Can you prefix them? gpio_ namespace is not owned by this driver and may collide with something in the future. ... > + if (dir & 1 << offset) Missed BIT(offset) ? > + return GPIO_LINE_DIRECTION_OUT; ... > +static int __init > +nct6116d_gpio_device_add(const struct nct6116d_sio *sio) > +{ > + int err; > + > + nct6116d_gpio_pdev = platform_device_alloc(KBUILD_MODNAME, -1); > + if (!nct6116d_gpio_pdev) > + return -ENOMEM; > + > + err = platform_device_add_data(nct6116d_gpio_pdev, sio, sizeof(*sio)); > + if (err) { > + pr_err("Platform data allocation failed\n"); > + goto err; > + } > + > + err = platform_device_add(nct6116d_gpio_pdev); > + if (err) { > + pr_err("Device addition failed\n"); > + goto err; > + } > + > + return 0; platform_device_register_full() ? Yeah, just read your other message. Can you drop an excerpt here to see how it looks? > +err: > + platform_device_put(nct6116d_gpio_pdev); > + > + return err; > +} ... > +static int __init nct6116d_gpio_init(void) > +{ > + struct nct6116d_sio sio; > + int err; > + > + if (nct6116d_find(0x2e, &sio) && > + nct6116d_find(0x4e, &sio)) > + return -ENODEV; > + > + err = platform_driver_register(&nct6116d_gpio_driver); > + if (!err) { if (err) return err; > + err = nct6116d_gpio_device_add(&sio); > + if (err) > + platform_driver_unregister(&nct6116d_gpio_driver); > + } > + > + return err; > +} -- With Best Regards, Andy Shevchenko