gpio: generic: Don't use 'proxy' headers
PATCH 1/1 gpio: generic: Don't use 'proxy' headers
Update header inclusions to follow IWYU (Include What You Use) principle.
--- drivers/gpio/gpio-mmio.c | 4 +--- include/linux/gpio/generic.h | 8 +++++++- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/gpio/gpio-mmio.c +1 -3
@@ -42,18 +42,16 @@ o ` ~~~~\___/~~~~ ` controller in FPGA is ,.`#include <linux/bitops.h> #include <linux/cleanup.h> -#include <linux/compiler.h> #include <linux/err.h> -#include <linux/init.h> #include <linux/io.h> #include <linux/ioport.h> +#include <linux/limits.h> #include <linux/log2.h> #include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/pinctrl/consumer.h> #include <linux/platform_device.h> #include <linux/property.h> -#include <linux/slab.h> #include <linux/spinlock.h> #include <linux/types.h>
include/linux/gpio/generic.h +7 -1
@@ -3,9 +3,15 @@#ifndef __LINUX_GPIO_GENERIC_H#define __LINUX_GPIO_GENERIC_H +#include <linux/bits.h> +#include <linux/bug.h> #include <linux/cleanup.h> -#include <linux/gpio/driver.h> +#include <linux/container_of.h> +#include <linux/errno.h> #include <linux/spinlock.h> +#include <linux/types.h> + +#include <linux/gpio/driver.h> struct device ;
Signature · 1 line
2.50.1
Bartosz Golaszewski
maintainerQuoted 21 lines · Andy Shevchenko
Update header inclusions to follow IWYU (Include What You Use) principle.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpio/gpio-mmio.c | 4 +--- include/linux/gpio/generic.h | 8 +++++++- 2 files changed, 8 insertions(+), 4 deletions(-)drivers/gpio/gpio-mmio.c +0
-2@@ -42,18 +42,16 @@ o ` ~~~~\___/~~~~ ` controller in FPGA is ,.`#include <linux/bitops.h> #include <linux/cleanup.h> -#include <linux/compiler.h> #include <linux/err.h> -#include <linux/init.h>
drivers/gpio/gpio-mmio.c o ` ~~~~\___/~~~~ ` controller in FPGA is ,.` · line 56
Quoted 10 lines
drivers/gpio/gpio-mmio.c +1
-1#include <linux/io.h> #include <linux/ioport.h> +#include <linux/limits.h> #include <linux/log2.h> #include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/pinctrl/consumer.h> #include <linux/platform_device.h> #include <linux/property.h> -#include <linux/slab.h>
In that case don't we need device.h for devm_kzalloc()?
Bart
Quoted 27 lines
drivers/gpio/gpio-mmio.c +0
-0#include <linux/spinlock.h> #include <linux/types.h> include/linux/gpio/generic.h +7
-2@@ -3,9 +3,15 @@#ifndef __LINUX_GPIO_GENERIC_H#define __LINUX_GPIO_GENERIC_H +#include <linux/bits.h> +#include <linux/bug.h> #include <linux/cleanup.h> -#include <linux/gpio/driver.h> +#include <linux/container_of.h> +#include <linux/errno.h> #include <linux/spinlock.h> +#include <linux/types.h> + +#include <linux/gpio/driver.h> struct device ; --2.50.1
Quoted 2 lines · Bartosz Golaszewski
On Thu, Feb 26, 2026 at 10:20 AM Andy Shevchenko
<[email protected]> wrote:
...
Quoted 9 lines
Quoted 9 lines
#include <
linux/bitops.h>
#include <linux/cleanup.h>drivers/gpio/gpio-mmio.c +1
-2-#include <linux/compiler.h> #include <linux/err.h> -#include <linux/init.h> #include <linux/io.h> #include <linux/ioport.h> +#include <linux/limits.h> #include <linux/log2.h>
Quoted 8 lines
Quoted 6 lines
#include <
linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/property.h>
-#include <linux/slab.h>In that case don't we need
device.hfordevm_kzalloc()?
(It is device/devres.h, but read below)
It comes thru platform_device.h. And if you follow my attempts to split device.h, the state of affairs will look like not much will happen there, so the platform_device.h <- device.h <- devres/device.h is guaranteed.
TL;DR: if we have platform_device.h, it covers everything that device.h provides.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 4 lines · Andy Shevchenko
Update header inclusions to follow IWYU (Include What You Use) principle.
Signed-off-by Andy Shevchenko <[email protected]>
Looks good to me!
Yours,
Linus Walleij
Bartosz Golaszewski
AppliedQuoted 4 lines · Andy Shevchenko
Update header inclusions to follow IWYU (Include What You Use) principle.
Applied, thanks!
[1/1] gpio: generic: Don't use 'proxy' headers
https://git.kernel.org/brgl/c/b2d51bc1601c762c63f19c119589a0a0c44bc8ec
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>