[PATCH RESEND 07/14] gpio: ts4800: use new generic GPIO chip API

Andy Shevchenko andriy.shevchenko at intel.com
Wed Sep 3 08:44:59 PDT 2025


On Mon, Aug 25, 2025 at 11:48:48AM +0200, Bartosz Golaszewski wrote:
> 
> Convert the driver to using the new generic GPIO chip interfaces from
> linux/gpio/generic.h.

...

> +	config = (typeof(config)){

First of all, what's wrong with the pattern used in the kernel when we
explicitly show the compound literal? Also we put a space before {.

> +		.dev = dev,
> +		.sz = 2,
> +		.dat = base_addr + INPUT_REG_OFFSET,
> +		.set = base_addr + OUTPUT_REG_OFFSET,
> +		.dirout = base_addr + DIRECTION_REG_OFFSET,
> +	};
> +
> +	retval = gpio_generic_chip_init(chip, &config);
>  	if (retval)
> -		return dev_err_probe(dev, retval, "bgpio_init failed\n");
> +		return dev_err_probe(dev, retval,
> +				     "failed to initialize the generic GPIO chip\n");

Second, can't it all be hidden in the GPIOLIB just by passing the pointer to
the above initialised structure? Yes, it will take a pointer space in GPIO chip
for all, but I think it will reduce the burden.

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list