2005-10-01 23:34:17

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] kill include/linux/platform.h

On Thu, Sep 29, 2005 at 11:07:18AM -0700, Patrick Mochel wrote:
>
> Sorry about the delay in responding, been traveling.
>
> On Fri, 2 Sep 2005, Adrian Bunk wrote:
>
> > Hi Patrick,
> >
> > it seems that exept for the default_idle() prototype, the complete
> > include/linux/platform.h is obsolete.
> >
> > Is there a reason to keep it, or should we delete this header?
>
> Kill it, it's way old.

Patch below.

> Thanks,
> Patrick

cu
Adrian


<-- snip -->


This patch removes the obsolete include/linux/platform.h header.

This patch was already ACK'ed by Patrick Mochel.


Signed-off-by: Adrian Bunk <[email protected]>

---

arch/i386/mach-visws/reboot.c | 1
arch/ia64/kernel/setup.c | 1
arch/sh/kernel/process.c | 1
include/linux/platform.h | 43 ----------------------------------
4 files changed, 46 deletions(-)

--- linux-2.6.14-rc2-mm2-full/arch/i386/mach-visws/reboot.c.old 2005-10-02 01:08:55.000000000 +0200
+++ linux-2.6.14-rc2-mm2-full/arch/i386/mach-visws/reboot.c 2005-10-02 01:09:00.000000000 +0200
@@ -1,7 +1,6 @@
#include <linux/module.h>
#include <linux/smp.h>
#include <linux/delay.h>
-#include <linux/platform.h>

#include <asm/io.h>
#include "piix4.h"
--- linux-2.6.14-rc2-mm2-full/arch/ia64/kernel/setup.c.old 2005-10-02 01:09:11.000000000 +0200
+++ linux-2.6.14-rc2-mm2-full/arch/ia64/kernel/setup.c 2005-10-02 01:09:15.000000000 +0200
@@ -41,7 +41,6 @@
#include <linux/serial_core.h>
#include <linux/efi.h>
#include <linux/initrd.h>
-#include <linux/platform.h>
#include <linux/pm.h>

#include <asm/ia32.h>
--- linux-2.6.14-rc2-mm2-full/arch/sh/kernel/process.c.old 2005-10-02 01:09:24.000000000 +0200
+++ linux-2.6.14-rc2-mm2-full/arch/sh/kernel/process.c 2005-10-02 01:09:49.000000000 +0200
@@ -18,7 +18,6 @@
#include <linux/slab.h>
#include <linux/a.out.h>
#include <linux/ptrace.h>
-#include <linux/platform.h>
#include <linux/kallsyms.h>

#include <asm/io.h>
--- linux-2.6.14-rc2-mm2-full/include/linux/platform.h 2005-08-29 01:41:01.000000000 +0200
+++ /dev/null 2005-04-28 03:52:17.000000000 +0200
@@ -1,43 +0,0 @@
-/*
- * include/linux/platform.h - platform driver definitions
- *
- * Because of the prolific consumerism of the average American,
- * and the dominant marketing budgets of PC OEMs, we have been
- * blessed with frequent updates of the PC architecture.
- *
- * While most of these calls are singular per architecture, they
- * require an extra layer of abstraction on the x86 so the right
- * subsystem gets the right call.
- *
- * Basically, this consolidates the power off and reboot callbacks
- * into one structure, as well as adding power management hooks.
- *
- * When adding a platform driver, please make sure all callbacks are
- * filled. There are defaults defined below that do nothing; use those
- * if you do not support that callback.
- */
-
-#ifndef _PLATFORM_H_
-#define _PLATFORM_H_
-#ifdef __KERNEL__
-
-#include <linux/types.h>
-
-struct platform_t {
- char * name;
- u32 suspend_states;
- void (*reboot)(char * cmd);
- void (*halt)(void);
- void (*power_off)(void);
- int (*suspend)(int state, int flags);
- void (*idle)(void);
-};
-
-extern struct platform_t * platform;
-extern void default_reboot(char * cmd);
-extern void default_halt(void);
-extern int default_suspend(int state, int flags);
-extern void default_idle(void);
-
-#endif /* __KERNEL__ */
-#endif /* _PLATFORM_H */


2005-10-03 19:01:10

by Tony Luck

[permalink] [raw]
Subject: Re: [2.6 patch] kill include/linux/platform.h

> --- linux-2.6.14-rc2-mm2-full/arch/ia64/kernel/setup.c.old 2005-10-02 01:09:11.000000000 +0200
> +++ linux-2.6.14-rc2-mm2-full/arch/ia64/kernel/setup.c 2005-10-02 01:09:15.000000000 +0200
> @@ -41,7 +41,6 @@
> #include <linux/serial_core.h>
> #include <linux/efi.h>
> #include <linux/initrd.h>
> -#include <linux/platform.h>
> #include <linux/pm.h>
>
> #include <asm/ia32.h>

NAK. Without <linux/platform.h> ia64 doesn't compile:

CC arch/ia64/kernel/setup.o
arch/ia64/kernel/setup.c: In function `cpu_init':
arch/ia64/kernel/setup.c:855: error: `default_idle' undeclared (first
use in this function)
arch/ia64/kernel/setup.c:855: error: (Each undeclared identifier is
reported only once
arch/ia64/kernel/setup.c:855: error: for each function it appears in.)
make[1]: *** [arch/ia64/kernel/setup.o] Error 1
make: *** [arch/ia64/kernel] Error 2

So you will need to add a:

extern void default_idle(void );

some place in setup.c to fix this.

-Tony

2005-10-03 19:03:48

by Adrian Bunk

[permalink] [raw]
Subject: Re: [2.6 patch] kill include/linux/platform.h

On Mon, Oct 03, 2005 at 12:01:08PM -0700, Tony Luck wrote:
> > --- linux-2.6.14-rc2-mm2-full/arch/ia64/kernel/setup.c.old 2005-10-02 01:09:11.000000000 +0200
> > +++ linux-2.6.14-rc2-mm2-full/arch/ia64/kernel/setup.c 2005-10-02 01:09:15.000000000 +0200
> > @@ -41,7 +41,6 @@
> > #include <linux/serial_core.h>
> > #include <linux/efi.h>
> > #include <linux/initrd.h>
> > -#include <linux/platform.h>
> > #include <linux/pm.h>
> >
> > #include <asm/ia32.h>
>
> NAK. Without <linux/platform.h> ia64 doesn't compile:
>
> CC arch/ia64/kernel/setup.o
> arch/ia64/kernel/setup.c: In function `cpu_init':
> arch/ia64/kernel/setup.c:855: error: `default_idle' undeclared (first
> use in this function)
> arch/ia64/kernel/setup.c:855: error: (Each undeclared identifier is
> reported only once
> arch/ia64/kernel/setup.c:855: error: for each function it appears in.)
> make[1]: *** [arch/ia64/kernel/setup.o] Error 1
> make: *** [arch/ia64/kernel] Error 2
>
> So you will need to add a:
>
> extern void default_idle(void );
>
> some place in setup.c to fix this.

The default_idle() prototype should stay inside some header file.

@Patrick:
Any suggestion where it should move to?

> -Tony

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-10-03 21:07:16

by Tony Luck

[permalink] [raw]
Subject: Re: [2.6 patch] kill include/linux/platform.h

> The default_idle() prototype should stay inside some header file.

That would be best, yes.

> @Patrick:
> Any suggestion where it should move to?

Of the include files already included directly by arch/ia64/kernel/setup.c,
<linux/sched.h> looks the most promising. There's lots of .*idle.* things
already in there.

Looking at existing precedent: ppc64 has a definition of default_idle()
in <asm/machdep.h>

i396, cris and um already have gone along the route of adding extern
definitions for default_idle() to ".c" files ... so cleanup creates more
opportunities for cleanup (but you are probably very experienced in
this phenomenom :-)

-Tony

2005-10-03 21:50:58

by Adrian Bunk

[permalink] [raw]
Subject: Re: [2.6 patch] kill include/linux/platform.h

On Mon, Oct 03, 2005 at 02:07:12PM -0700, Tony Luck wrote:
> > The default_idle() prototype should stay inside some header file.
>
> That would be best, yes.
>
> > @Patrick:
> > Any suggestion where it should move to?
>
> Of the include files already included directly by arch/ia64/kernel/setup.c,
> <linux/sched.h> looks the most promising. There's lots of .*idle.* things
> already in there.
>
> Looking at existing precedent: ppc64 has a definition of default_idle()
> in <asm/machdep.h>

The question whether linux/ or asm/ is the best place for the definition
boils down to the question whether it is expected that default_idle() is
present on all architectures or whether it's an architecture-specific
implementation detail.

In the first case, I'm surprised that there is no platform independent
code using it.

In the second case, it seems we can kill the default_idle() functions on
mips (empty) and parisk.

> i396, cris and um already have gone along the route of adding extern
> definitions for default_idle() to ".c" files ... so cleanup creates more
> opportunities for cleanup (but you are probably very experienced in
> this phenomenom :-)

I stumbled across the question whether include/linux/platform.h is still
required by cleaning up warnings with the -Wmissing-prototypes compiler
flag I plan to add to the kernel CFLAGS soon that generates warnings
for such extern constructs...

> -Tony

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-10-10 18:27:29

by Andrew Morton

[permalink] [raw]
Subject: Re: [2.6 patch] kill include/linux/platform.h

Adrian Bunk <[email protected]> wrote:
>
> On Mon, Oct 03, 2005 at 02:07:12PM -0700, Tony Luck wrote:
> > > The default_idle() prototype should stay inside some header file.
> >
> > That would be best, yes.
> >
> > > @Patrick:
> > > Any suggestion where it should move to?
> >
> > Of the include files already included directly by arch/ia64/kernel/setup.c,
> > <linux/sched.h> looks the most promising. There's lots of .*idle.* things
> > already in there.
> >
> > Looking at existing precedent: ppc64 has a definition of default_idle()
> > in <asm/machdep.h>
>
> The question whether linux/ or asm/ is the best place for the definition
> boils down to the question whether it is expected that default_idle() is
> present on all architectures or whether it's an architecture-specific
> implementation detail.

Yes, default_idle() is arch-specific and so its prototype should be in an
arch-specific header.

All the implementations happen to have the same signature, so it's tempting
to put the prototype into some generic header, but given that there's no
non-arch-specific caller, we shouldn't do that.

2005-11-03 18:24:09

by Adrian Bunk

[permalink] [raw]
Subject: Re: [2.6 patch] kill include/linux/platform.h

On Mon, Oct 10, 2005 at 11:23:41AM -0700, Andrew Morton wrote:
> Adrian Bunk <[email protected]> wrote:
> >
> > On Mon, Oct 03, 2005 at 02:07:12PM -0700, Tony Luck wrote:
> > > > The default_idle() prototype should stay inside some header file.
> > >
> > > That would be best, yes.
> > >
> > > > @Patrick:
> > > > Any suggestion where it should move to?
> > >
> > > Of the include files already included directly by arch/ia64/kernel/setup.c,
> > > <linux/sched.h> looks the most promising. There's lots of .*idle.* things
> > > already in there.
> > >
> > > Looking at existing precedent: ppc64 has a definition of default_idle()
> > > in <asm/machdep.h>
> >
> > The question whether linux/ or asm/ is the best place for the definition
> > boils down to the question whether it is expected that default_idle() is
> > present on all architectures or whether it's an architecture-specific
> > implementation detail.
>
> Yes, default_idle() is arch-specific and so its prototype should be in an
> arch-specific header.
>
> All the implementations happen to have the same signature, so it's tempting
> to put the prototype into some generic header, but given that there's no
> non-arch-specific caller, we shouldn't do that.

ppc64 has the prototype in machdep.h.

The only other architectures that seem to require a non-static
default_idle() are cris, i386 and ia64.

Any hint which header file would suit best?

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-11-08 19:46:50

by Patrick Mochel

[permalink] [raw]
Subject: Re: [2.6 patch] kill include/linux/platform.h


On Thu, 3 Nov 2005, Adrian Bunk wrote:

> On Mon, Oct 10, 2005 at 11:23:41AM -0700, Andrew Morton wrote:
> > Adrian Bunk <[email protected]> wrote:
> > >
> > > On Mon, Oct 03, 2005 at 02:07:12PM -0700, Tony Luck wrote:
> > > > > The default_idle() prototype should stay inside some header file.
> > > >
> > > > That would be best, yes.
> > > >
> > > > > @Patrick:
> > > > > Any suggestion where it should move to?
> > > >
> > > > Of the include files already included directly by arch/ia64/kernel/setup.c,
> > > > <linux/sched.h> looks the most promising. There's lots of .*idle.* things
> > > > already in there.
> > > >
> > > > Looking at existing precedent: ppc64 has a definition of default_idle()
> > > > in <asm/machdep.h>
> > >
> > > The question whether linux/ or asm/ is the best place for the definition
> > > boils down to the question whether it is expected that default_idle() is
> > > present on all architectures or whether it's an architecture-specific
> > > implementation detail.
> >
> > Yes, default_idle() is arch-specific and so its prototype should be in an
> > arch-specific header.
> >
> > All the implementations happen to have the same signature, so it's tempting
> > to put the prototype into some generic header, but given that there's no
> > non-arch-specific caller, we shouldn't do that.
>
> ppc64 has the prototype in machdep.h.
>
> The only other architectures that seem to require a non-static
> default_idle() are cris, i386 and ia64.
>
> Any hint which header file would suit best?

It seems that include/asm-{$arch}/idle.h would suffice. Any objections to
that?



Pat