Re: [PATCH 1/2] gpiolib: Add for_each_gpio_suffix() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 08, 2019 at 03:25:42PM +0200, Stefan Roese wrote:
> Add a helper macro to enable the interation over all supported GPIO
> suffixes (currently "gpios" & "gpio"). This will be used by the serial
> mctrl code to check, if a GPIO property exists before requesting it.

Thanks! My comments below.

> +#define for_each_gpio_suffix(idx, suffix)				\
> +	for (idx = 0;							\
> +	     idx < ARRAY_SIZE(gpio_suffixes) &&				\
> +		     (suffix = gpio_suffixes[idx]) != NULL;		\
> +	     idx++)

I think we can use comma here, like

	for (idx = 0; idx < ARRAY_SIZE(...), suffix = ...; idx++;)

however, this needs to be checked, b/c I think the last operation makes a
return code, and probably we have to assign suffix first.

(and perhaps switch to one letter for idx makes it fit one line)

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux