Re: [PATCH v2] gpio: of: Break out OF-only code

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

 



On Wed, Jul 17, 2019 at 09:10:01AM +0200, Linus Walleij wrote:
> The core gpiolib should not contain any OF/device tree-only
> code. Try to break out the main part of it and push it down
> into the optional gpiolib-of.c part of the library.
> 
> Create a local gpiolib-of.h header and move stuff around a
> bit to get a clean cut.

Are you going to split ACPI parts as well (at least to a header)?

One nit to address below (sorry, didn't notice before), and take mine
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

> -static int gpiochip_alloc_valid_mask(struct gpio_chip *gpiochip)
> +static int gpiochip_alloc_valid_mask(struct gpio_chip *gc)
>  {
> -#ifdef CONFIG_OF_GPIO
> -	int size;
> -	struct device_node *np = gpiochip->of_node;
> -
> -	size = of_property_count_u32_elems(np,  "gpio-reserved-ranges");
> -	if (size > 0 && size % 2 == 0)
> -		gpiochip->need_valid_mask = true;
> -#endif
> -
> -	if (!gpiochip->need_valid_mask)
> +	if (IS_ENABLED(CONFIG_OF_GPIO))
> +		gc->need_valid_mask = of_gpio_need_valid_mask(gc);

		gpiochip->need_valid_mask = of_gpio_need_valid_mask(gpiochip);

Even with full name it fits 80.
Can you drop renaming here?

> +	if (!gc->need_valid_mask)
>  		return 0;
>  
> -	gpiochip->valid_mask = gpiochip_allocate_mask(gpiochip);
> -	if (!gpiochip->valid_mask)
> +	gc->valid_mask = gpiochip_allocate_mask(gc);
> +	if (!gc->valid_mask)
>  		return -ENOMEM;

-- 
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