linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: Do not include <linux/kernel.h> when not really needed.
@ 2022-11-27 21:52 Christophe JAILLET
  2022-11-27 22:07 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2022-11-27 21:52 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand, Linus Walleij, Bartosz Golaszewski
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-gpio,
	devicetree

<linux/kernel.h> is included only for using container_of().
Include <linux/container_of.h> instead, it is much lighter.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Not sure if the prefix should be gpio or gpiolib.

Let see if build-bots spot something which is inherit via kernel.h
---
 include/linux/of_gpio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index a5166eb93437..6db627257a7b 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -34,7 +34,7 @@ enum of_gpio_flags {
 
 #ifdef CONFIG_OF_GPIO
 
-#include <linux/kernel.h>
+#include <linux/container_of.h>
 
 /*
  * OF GPIO chip for memory mapped banks
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: Do not include <linux/kernel.h> when not really needed.
  2022-11-27 21:52 [PATCH] gpio: Do not include <linux/kernel.h> when not really needed Christophe JAILLET
@ 2022-11-27 22:07 ` Linus Walleij
  2022-11-28 10:14 ` Andy Shevchenko
  2022-11-28 17:58 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2022-11-27 22:07 UTC (permalink / raw)
  To: Christophe JAILLET, Andy Shevchenko
  Cc: Rob Herring, Frank Rowand, Bartosz Golaszewski, linux-kernel,
	kernel-janitors, linux-gpio, devicetree

On Sun, Nov 27, 2022 at 10:52 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:

> <linux/kernel.h> is included only for using container_of().
> Include <linux/container_of.h> instead, it is much lighter.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

This is fine.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

As Andy split out the container_of header file a year ago or
so he certainly want to ACK this too.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: Do not include <linux/kernel.h> when not really needed.
  2022-11-27 21:52 [PATCH] gpio: Do not include <linux/kernel.h> when not really needed Christophe JAILLET
  2022-11-27 22:07 ` Linus Walleij
@ 2022-11-28 10:14 ` Andy Shevchenko
  2022-11-28 17:58 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-11-28 10:14 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Rob Herring, Frank Rowand, Linus Walleij, Bartosz Golaszewski,
	linux-kernel, kernel-janitors, linux-gpio, devicetree

On Sun, Nov 27, 2022 at 10:52:10PM +0100, Christophe JAILLET wrote:
> <linux/kernel.h> is included only for using container_of().
> Include <linux/container_of.h> instead, it is much lighter.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

Thanks for doing this! We really don't want to see kernel.h to be included by
other headers in the include/linux, include/asm, etc.

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Not sure if the prefix should be gpio or gpiolib.

I'm not sure either because this more for the consumers, I would leave gpio.

> Let see if build-bots spot something which is inherit via kernel.h
> ---
>  include/linux/of_gpio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
> index a5166eb93437..6db627257a7b 100644
> --- a/include/linux/of_gpio.h
> +++ b/include/linux/of_gpio.h
> @@ -34,7 +34,7 @@ enum of_gpio_flags {
>  
>  #ifdef CONFIG_OF_GPIO
>  
> -#include <linux/kernel.h>
> +#include <linux/container_of.h>
>  
>  /*
>   * OF GPIO chip for memory mapped banks
> -- 
> 2.34.1
> 
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: Do not include <linux/kernel.h> when not really needed.
  2022-11-27 21:52 [PATCH] gpio: Do not include <linux/kernel.h> when not really needed Christophe JAILLET
  2022-11-27 22:07 ` Linus Walleij
  2022-11-28 10:14 ` Andy Shevchenko
@ 2022-11-28 17:58 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2022-11-28 17:58 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Rob Herring, Frank Rowand, Linus Walleij, linux-kernel,
	kernel-janitors, linux-gpio, devicetree

On Sun, Nov 27, 2022 at 10:52 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> <linux/kernel.h> is included only for using container_of().
> Include <linux/container_of.h> instead, it is much lighter.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Not sure if the prefix should be gpio or gpiolib.
>
> Let see if build-bots spot something which is inherit via kernel.h
> ---
>  include/linux/of_gpio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
> index a5166eb93437..6db627257a7b 100644
> --- a/include/linux/of_gpio.h
> +++ b/include/linux/of_gpio.h
> @@ -34,7 +34,7 @@ enum of_gpio_flags {
>
>  #ifdef CONFIG_OF_GPIO
>
> -#include <linux/kernel.h>
> +#include <linux/container_of.h>
>
>  /*
>   * OF GPIO chip for memory mapped banks
> --
> 2.34.1
>

Applied, thanks!

Bartosz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-28 18:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-27 21:52 [PATCH] gpio: Do not include <linux/kernel.h> when not really needed Christophe JAILLET
2022-11-27 22:07 ` Linus Walleij
2022-11-28 10:14 ` Andy Shevchenko
2022-11-28 17:58 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).