Re: [PATCH 3/8] gpiolib: remove asm-generic/gpio.h

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

 



On Thu, Jan 26, 2023 at 02:27:56PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
> 
> The asm-generic/gpio.h file is now always included when
> using gpiolib, so just move its contents into linux/gpio.h
> with a few minor simplifications.

Thanks! Very appreciated, my comments below.

...

> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -7,6 +7,7 @@
>   */

>  #include <linux/gpio/driver.h>


> +#include <linux/gpio.h>

I believe the driver does not need this.

I have briefly checked all gpio_ places in it and found nothing that requires
this inclusion to be done.

>  #include <linux/errno.h>
>  #include <linux/kernel.h>
>  #include <linux/clk.h>
> @@ -24,8 +25,6 @@
>  #include <linux/spinlock.h>
>  #include <linux/pm_runtime.h>
>  
> -#include <asm-generic/gpio.h>
> -
>  #define MAX_REGS_BANKS 5
>  #define MAX_INT_PER_BANK 32

Thanks for this, that was a PITA!

...

> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -30,7 +30,7 @@
>  
>  #ifdef CONFIG_GPIOLIB
>  #include "../gpio/gpiolib.h"
> -#include <asm-generic/gpio.h>
> +#include <linux/gpio.h>

Can we actually swap them?

#include <linux/gpio.h>
#include "../gpio/gpiolib.h"

But hold on, why do we even need gpio.h here?!

>  #endif
>  
>  #include "core.h"

...

> --- a/include/linux/gpio.h
> +++ b/include/linux/gpio.h
> @@ -54,26 +54,101 @@ struct gpio {
>  };
>  
>  #ifdef CONFIG_GPIOLIB
> -#include <asm-generic/gpio.h>
> +#include <linux/compiler.h>

> +#include <linux/gpio/driver.h>
> +#include <linux/gpio/consumer.h>

#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>

...

> +/*
> + * "valid" GPIO numbers are nonnegative and may be passed to
> + * setup routines like gpio_request().  only some valid numbers

While at it, '.  only' --> '. Only'.

> + * can successfully be requested and used.
> + *
> + * Invalid GPIO numbers are useful for indicating no-such-GPIO in
> + * platform data and other tables.
> + */

...

> +extern int gpio_request(unsigned gpio, const char *label);
> +extern void gpio_free(unsigned gpio);

While at it, s/extern//.

...

> +extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
> +extern int gpio_request_array(const struct gpio *array, size_t num);
> +extern void gpio_free_array(const struct gpio *array, size_t num);

Ditto.

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