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

From: Arnd Bergmann
Date: Thu Jan 26 2023 - 10:44:01 EST


On Thu, Jan 26, 2023, at 14:46, Andy Shevchenko wrote:
> On Thu, Jan 26, 2023 at 02:27:56PM +0100, Arnd Bergmann wrote:

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

ok

>> #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"
>
> ...

I probably did all the above in response to build regressions,
but I'll try to change them based on your suggestion and see
what happens.

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

Done

>> +/*
>> + * "valid" GPIO numbers are nonnegative and may be passed to
>> + * setup routines like gpio_request(). only some valid numbers
>
> While at it, '. only' --> '. Only'.

Done

>> + * 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);

Done

Thanks for the review,

Arnd