public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irq: don't put module.h into irq.h for tracking irqgen modules.
@ 2011-10-01  1:53 Paul Gortmaker
  2011-10-18 17:43 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gortmaker @ 2011-10-01  1:53 UTC (permalink / raw)
  To: sebastian; +Cc: tglx, linux-kernel, Paul Gortmaker

Recent commit "irq: Track the owner of irq descriptor" in
commit ID b6873807a7143b7 placed module.h into linux/irq.h
but we are trying to limit module.h inclusion to just C files
that really need it, due to its size and number of children
includes.  This targets just reversing that include.

Add in the basic "struct module" since that is all we really need
to ensure things compile.  In theory, b687380 should have added the
module.h include to the irqdesc.h header as well, but the implicit
module.h everywhere presence masked this from showing up.  So give
it the "struct module" as well.

As for the C files, irqdesc.c is only using THIS_MODULE, so it
does not need module.h - give it export.h instead.  The C file
irq/manage.c is now (as of b687380) using try_module_get and
module_put and so it needs module.h (which it already has).

Also convert the irq_alloc_descs variants to macros, since all
they really do is is call the __irq_alloc_descs primitive.
This avoids including export.h and no debug info is lost.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

---

[This is a commit I've recently added to the module.h tree,
 since b687380 didn't exist when I'd sent the module.h RFC
 commits a while back.  Sending just for review comments.]

diff --git a/include/linux/irq.h b/include/linux/irq.h
index 5951730..adde1d3 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -23,13 +23,13 @@
 #include <linux/errno.h>
 #include <linux/topology.h>
 #include <linux/wait.h>
-#include <linux/module.h>
 
 #include <asm/irq.h>
 #include <asm/ptrace.h>
 #include <asm/irq_regs.h>
 
 struct seq_file;
+struct module;
 struct irq_desc;
 struct irq_data;
 typedef	void (*irq_flow_handler_t)(unsigned int irq,
@@ -551,29 +551,21 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
 int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
 		struct module *owner);
 
-static inline int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt,
-		int node)
-{
-	return __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE);
-}
+/* use macros to avoid needing export.h for THIS_MODULE */
+#define irq_alloc_descs(irq, from, cnt, node)	\
+	__irq_alloc_descs(irq, from, cnt, node, THIS_MODULE)
 
-void irq_free_descs(unsigned int irq, unsigned int cnt);
-int irq_reserve_irqs(unsigned int from, unsigned int cnt);
+#define irq_alloc_desc(node)			\
+	irq_alloc_descs(-1, 0, 1, node)
 
-static inline int irq_alloc_desc(int node)
-{
-	return irq_alloc_descs(-1, 0, 1, node);
-}
+#define irq_alloc_desc_at(at, node)		\
+	irq_alloc_descs(at, at, 1, node)
 
-static inline int irq_alloc_desc_at(unsigned int at, int node)
-{
-	return irq_alloc_descs(at, at, 1, node);
-}
+#define irq_alloc_desc_from(from, node)		\
+	irq_alloc_descs(-1, from, 1, node)
 
-static inline int irq_alloc_desc_from(unsigned int from, int node)
-{
-	return irq_alloc_descs(-1, from, 1, node);
-}
+void irq_free_descs(unsigned int irq, unsigned int cnt);
+int irq_reserve_irqs(unsigned int from, unsigned int cnt);
 
 static inline void irq_free_desc(unsigned int irq)
 {
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 150134a..d9a9f61 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -11,6 +11,7 @@
 struct irq_affinity_notify;
 struct proc_dir_entry;
 struct timer_rand_state;
+struct module;
 /**
  * struct irq_desc - interrupt descriptor
  * @irq_data:		per irq and chip data passed down to chip functions
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 039b889..9888f7e 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -9,7 +9,7 @@
  */
 #include <linux/irq.h>
 #include <linux/slab.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
 #include <linux/radix-tree.h>
-- 
1.7.6


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

* Re: [PATCH] irq: don't put module.h into irq.h for tracking irqgen modules.
  2011-10-01  1:53 [PATCH] irq: don't put module.h into irq.h for tracking irqgen modules Paul Gortmaker
@ 2011-10-18 17:43 ` Sebastian Andrzej Siewior
  2011-10-18 18:44   ` Paul Gortmaker
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2011-10-18 17:43 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: tglx, linux-kernel

On Fri, Sep 30, 2011 at 09:53:57PM -0400, Paul Gortmaker wrote:
> Recent commit "irq: Track the owner of irq descriptor" in
> commit ID b6873807a7143b7 placed module.h into linux/irq.h
> but we are trying to limit module.h inclusion to just C files
> that really need it, due to its size and number of children
> includes.  This targets just reversing that include.

Sorry for that. This is for "not to re-compile the whole tree once a tiny
header file has changes" right?

> Add in the basic "struct module" since that is all we really need
> to ensure things compile.  In theory, b687380 should have added the
> module.h include to the irqdesc.h header as well, but the implicit
> module.h everywhere presence masked this from showing up.  So give
> it the "struct module" as well.
> 
> As for the C files, irqdesc.c is only using THIS_MODULE, so it
> does not need module.h - give it export.h instead.  The C file

just tried to compile this ontop of the tip tree and it ended with:
|kernel/irq/irqdesc.c:12:26: fatal error: linux/export.h: No such file or directory

I guess your tree provides that file.

> irq/manage.c is now (as of b687380) using try_module_get and
> module_put and so it needs module.h (which it already has).
> 
> Also convert the irq_alloc_descs variants to macros, since all
> they really do is is call the __irq_alloc_descs primitive.
> This avoids including export.h and no debug info is lost.

macros, I see. THIS_MODULE is quite simple. What about moving this part from
module.h which is hidden behind ifdef MODULE and make it avaiable as a separate
headerfile with no children?

Sebastian

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

* Re: [PATCH] irq: don't put module.h into irq.h for tracking irqgen modules.
  2011-10-18 17:43 ` Sebastian Andrzej Siewior
@ 2011-10-18 18:44   ` Paul Gortmaker
  2011-10-25 21:58     ` Olof Johansson
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gortmaker @ 2011-10-18 18:44 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: tglx, linux-kernel

On 11-10-18 01:43 PM, Sebastian Andrzej Siewior wrote:
> On Fri, Sep 30, 2011 at 09:53:57PM -0400, Paul Gortmaker wrote:
>> Recent commit "irq: Track the owner of irq descriptor" in
>> commit ID b6873807a7143b7 placed module.h into linux/irq.h
>> but we are trying to limit module.h inclusion to just C files
>> that really need it, due to its size and number of children
>> includes.  This targets just reversing that include.
> 
> Sorry for that. This is for "not to re-compile the whole tree once a tiny
> header file has changes" right?

Correct.

> 
>> Add in the basic "struct module" since that is all we really need
>> to ensure things compile.  In theory, b687380 should have added the
>> module.h include to the irqdesc.h header as well, but the implicit
>> module.h everywhere presence masked this from showing up.  So give
>> it the "struct module" as well.
>>
>> As for the C files, irqdesc.c is only using THIS_MODULE, so it
>> does not need module.h - give it export.h instead.  The C file
> 
> just tried to compile this ontop of the tip tree and it ended with:
> |kernel/irq/irqdesc.c:12:26: fatal error: linux/export.h: No such file or directory
> 
> I guess your tree provides that file.

Correct.  You need my tree, or the most recent linux-next tree (which
is better, since we are really interested in how my tree interacts
with all the other pending trees.)

> 
>> irq/manage.c is now (as of b687380) using try_module_get and
>> module_put and so it needs module.h (which it already has).
>>
>> Also convert the irq_alloc_descs variants to macros, since all
>> they really do is is call the __irq_alloc_descs primitive.
>> This avoids including export.h and no debug info is lost.
> 
> macros, I see. THIS_MODULE is quite simple. What about moving this part from
> module.h which is hidden behind ifdef MODULE and make it avaiable as a separate
> headerfile with no children?

Already done.  THIS_MODULE, because of its presence everywhere
in non modular code is also in the export.h file.

Paul.

> 
> Sebastian

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

* Re: [PATCH] irq: don't put module.h into irq.h for tracking irqgen modules.
  2011-10-18 18:44   ` Paul Gortmaker
@ 2011-10-25 21:58     ` Olof Johansson
  0 siblings, 0 replies; 4+ messages in thread
From: Olof Johansson @ 2011-10-25 21:58 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Sebastian Andrzej Siewior, tglx, linux-kernel

On Tue, Oct 18, 2011 at 11:44 AM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> On 11-10-18 01:43 PM, Sebastian Andrzej Siewior wrote:
>> On Fri, Sep 30, 2011 at 09:53:57PM -0400, Paul Gortmaker wrote:
>>> irq/manage.c is now (as of b687380) using try_module_get and
>>> module_put and so it needs module.h (which it already has).
>>>
>>> Also convert the irq_alloc_descs variants to macros, since all
>>> they really do is is call the __irq_alloc_descs primitive.
>>> This avoids including export.h and no debug info is lost.
>>
>> macros, I see. THIS_MODULE is quite simple. What about moving this part from
>> module.h which is hidden behind ifdef MODULE and make it avaiable as a separate
>> headerfile with no children?
>
> Already done.  THIS_MODULE, because of its presence everywhere
> in non modular code is also in the export.h file.

As mentioned separately, this broke at least ARM in latest linux-next:
http://lkml.org/lkml/2011/10/25/396


-Olof

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

end of thread, other threads:[~2011-10-25 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-01  1:53 [PATCH] irq: don't put module.h into irq.h for tracking irqgen modules Paul Gortmaker
2011-10-18 17:43 ` Sebastian Andrzej Siewior
2011-10-18 18:44   ` Paul Gortmaker
2011-10-25 21:58     ` Olof Johansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox