public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] <linux/sysdev.h> needs to include <linux/module.h>
@ 2007-02-24 12:22 Ralf Baechle
  2007-03-01  0:59 ` Andrew Morton
  2007-03-02  6:15 ` Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: Ralf Baechle @ 2007-02-24 12:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

sysdev.h uses THIS_MODULE so should include <linux/module.h>.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index 389ccf8..e699ab2 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -22,6 +22,7 @@
 #define _SYSDEV_H_
 
 #include <linux/kobject.h>
+#include <linux/module.h>
 #include <linux/pm.h>
 
 

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

* Re: [PATCH] <linux/sysdev.h> needs to include <linux/module.h>
  2007-02-24 12:22 [PATCH] <linux/sysdev.h> needs to include <linux/module.h> Ralf Baechle
@ 2007-03-01  0:59 ` Andrew Morton
  2007-03-02  6:15 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2007-03-01  0:59 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-kernel

On Sat, 24 Feb 2007 12:22:11 +0000
Ralf Baechle <ralf@linux-mips.org> wrote:

> sysdev.h uses THIS_MODULE so should include <linux/module.h>.
> 
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> 
> diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
> index 389ccf8..e699ab2 100644
> --- a/include/linux/sysdev.h
> +++ b/include/linux/sysdev.h
> @@ -22,6 +22,7 @@
>  #define _SYSDEV_H_
>  
>  #include <linux/kobject.h>
> +#include <linux/module.h>
>  #include <linux/pm.h>
>  

This causes an x86_64 trainwreck:

akpm2:/usr/src/25> xb arch/x86_64/ia32/ia32_binfmt.o
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CC      arch/x86_64/kernel/asm-offsets.s
  GEN     include/asm-x86_64/asm-offsets.h
  CC      arch/x86_64/ia32/ia32_binfmt.o
arch/x86_64/ia32/ia32_binfmt.c:48:1: warning: "ELF_ET_DYN_BASE" redefined
In file included from include/linux/elf.h:7,
                 from include/linux/module.h:15,
                 from include/linux/sysdev.h:25,
                 from include/linux/sched.h:1645,
                 from arch/x86_64/ia32/ia32_binfmt.c:11:
include/asm/elf.h:93:1: warning: this is the location of the previous definition
arch/x86_64/ia32/ia32_binfmt.c:58:1: warning: "USE_ELF_CORE_DUMP" redefined
include/asm/elf.h:85:1: warning: this is the location of the previous definition
arch/x86_64/ia32/ia32_binfmt.c:62: error: conflicting types for 'elf_greg_t'
include/asm/elf.h:32: error: previous declaration of 'elf_greg_t' was here
arch/x86_64/ia32/ia32_binfmt.c:64:1: warning: "ELF_NGREG" redefined
include/asm/elf.h:34:1: warning: this is the location of the previous definition
arch/x86_64/ia32/ia32_binfmt.c:65: error: conflicting types for 'elf_gregset_t'
include/asm/elf.h:35: error: previous declaration of 'elf_gregset_t' was here
arch/x86_64/ia32/ia32_binfmt.c:118:1: warning: "ELF_CORE_COPY_REGS" redefined
include/asm/elf.h:99:1: warning: this is the location of the previous definition
arch/x86_64/ia32/ia32_binfmt.c:139:1: warning: "__ASM_X86_64_ELF_H" redefined
include/asm/elf.h:2:1: warning: this is the location of the previous definition
arch/x86_64/ia32/ia32_binfmt.c:144: error: conflicting types for 'elf_fpregset_t'
include/asm/elf.h:37: error: previous declaration of 'elf_fpregset_t' was here

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

* Re: [PATCH] <linux/sysdev.h> needs to include <linux/module.h>
  2007-02-24 12:22 [PATCH] <linux/sysdev.h> needs to include <linux/module.h> Ralf Baechle
  2007-03-01  0:59 ` Andrew Morton
@ 2007-03-02  6:15 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2007-03-02  6:15 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-kernel

On Sat, 24 Feb 2007 12:22:11 +0000 Ralf Baechle <ralf@linux-mips.org> wrote:

> sysdev.h uses THIS_MODULE so should include <linux/module.h>.
> 
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> 
> diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
> index 389ccf8..e699ab2 100644
> --- a/include/linux/sysdev.h
> +++ b/include/linux/sysdev.h
> @@ -22,6 +22,7 @@
>  #define _SYSDEV_H_
>  
>  #include <linux/kobject.h>
> +#include <linux/module.h>
>  #include <linux/pm.h>
>  


You can't just make changes like this without a lot of compile testing, I'm
afraid.

This causes a recursive inclusion and sched.h blows up:

In file included from include/linux/utsname.h:35,
                 from include/asm/elf.h:12,
                 from include/linux/elf.h:7,
                 from include/linux/module.h:15,
                 from include/linux/sysdev.h:25,
                 from kernel/time/clocksource.c:28:
include/linux/sched.h:1648: warning: 'struct sysdev_class' declared inside parameter list
include/linux/sched.h:1648: warning: its scope is only this definition or declaration, which is probably not what you want


I think we can fix that by moving the declarations into cpu.h and getting
that unpleasant include out of sched.h.

Of course, this will probably make other things blow up and additional
sysdev.h includes will now be needed.  We'll see..





diff -puN include/linux/cpu.h~linux-sysdevh-needs-to-include-linux-moduleh-up-fix include/linux/cpu.h
--- a/include/linux/cpu.h~linux-sysdevh-needs-to-include-linux-moduleh-up-fix
+++ a/include/linux/cpu.h
@@ -41,6 +41,9 @@ extern void cpu_remove_sysdev_attr(struc
 extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs);
 extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs);
 
+extern struct sysdev_attribute attr_sched_mc_power_savings;
+extern struct sysdev_attribute attr_sched_smt_power_savings;
+extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
 
 #ifdef CONFIG_HOTPLUG_CPU
 extern void unregister_cpu(struct cpu *cpu);
diff -puN include/linux/sched.h~linux-sysdevh-needs-to-include-linux-moduleh-up-fix include/linux/sched.h
--- a/include/linux/sched.h~linux-sysdevh-needs-to-include-linux-moduleh-up-fix
+++ a/include/linux/sched.h
@@ -1642,10 +1642,7 @@ static inline void arch_pick_mmap_layout
 extern long sched_setaffinity(pid_t pid, cpumask_t new_mask);
 extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
 
-#include <linux/sysdev.h>
 extern int sched_mc_power_savings, sched_smt_power_savings;
-extern struct sysdev_attribute attr_sched_mc_power_savings, attr_sched_smt_power_savings;
-extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
 
 extern void normalize_rt_tasks(void);
 
_


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

end of thread, other threads:[~2007-03-02  6:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-24 12:22 [PATCH] <linux/sysdev.h> needs to include <linux/module.h> Ralf Baechle
2007-03-01  0:59 ` Andrew Morton
2007-03-02  6:15 ` Andrew Morton

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