diff mbox

[8/8] gpio: don't include module.h in shared driver header

Message ID 20160912221631.15812-9-paul.gortmaker@windriver.com
State New
Headers show

Commit Message

Paul Gortmaker Sept. 12, 2016, 10:16 p.m. UTC
Most shared headers in include/linux don't need to know what the
internals of a struct module are; all they care about is that it
is a struct and hence they may require a pointer to one.

The advantage in this is that module.h is including a lot of stuff
itself, and an otherwise empty C file that just contains module.h
will result in ~750kB from CPP (compared to say 12kB from init.h)

So we have approximately 50 instances of "struct module;" in the
various include/linux headers already that help us keep module.h
out of other headers; here we do the same for gpio.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 include/linux/gpio/driver.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Sept. 15, 2016, 12:05 p.m. UTC | #1
On Tue, Sep 13, 2016 at 12:16 AM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:

> Most shared headers in include/linux don't need to know what the
> internals of a struct module are; all they care about is that it
> is a struct and hence they may require a pointer to one.
>
> The advantage in this is that module.h is including a lot of stuff
> itself, and an otherwise empty C file that just contains module.h
> will result in ~750kB from CPP (compared to say 12kB from init.h)
>
> So we have approximately 50 instances of "struct module;" in the
> various include/linux headers already that help us keep module.h
> out of other headers; here we do the same for gpio.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Probably my mistake.
Thanks for tidying this up so nicely!

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 50882e09289b..216e6f275aa8 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -3,7 +3,6 @@ 
 
 #include <linux/device.h>
 #include <linux/types.h>
-#include <linux/module.h>
 #include <linux/irq.h>
 #include <linux/irqchip/chained_irq.h>
 #include <linux/irqdomain.h>
@@ -16,6 +15,7 @@  struct of_phandle_args;
 struct device_node;
 struct seq_file;
 struct gpio_device;
+struct module;
 
 #ifdef CONFIG_GPIOLIB