Skip to contentSkip to conversation

drivers/base/: proper prototypes

PATCH In review Adrian Bunk 2 participants 7 messages Jan 19, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/base/: proper prototypes

This patch contains the following changes:
- move prototypes to base.h
- sys.c should #include "base.h" for getting the prototype of it's global function system_bus_init()

Note that hidden in this patch there's a bugfix:

Caller and callee disagreed regarding the return type of sysdev_shutdown().

---

 drivers/base/base.h           |    6 ++++++
 drivers/base/power/resume.c   |    3 +--
 drivers/base/power/shutdown.c |    2 +-
 drivers/base/power/suspend.c  |    3 +--
 drivers/base/sys.c            |    2 ++
 5 files changed, 11 insertions(+), 5 deletions(-)
drivers/base/base.h renamed from drivers/base/base.h.old +6 -0
@@ -1,6 +1,8 @@
 
 /* initialisation functions */
 
+#include <linux/device.h>
+
 extern int devices_init(void);
 extern int buses_init(void);
 extern int classes_init(void);
@@ -19,6 +21,10 @@
 extern void driver_detach(struct device_driver * drv);
 extern int driver_probe_device(struct device_driver *, struct device *);
 
+extern void sysdev_shutdown(void);
+extern int sysdev_suspend(pm_message_t state);
+extern int sysdev_resume(void);
+
 static inline struct class_device *to_class_dev(struct kobject *obj)
 {
 	return container_of(obj, struct class_device, kobj);
drivers/base/sys.c renamed from drivers/base/sys.c.old +2 -0
@@ -23,6 +23,8 @@
 #include <linux/pm.h>
 #include <asm/semaphore.h>
 
+#include "base.h"
+
 extern struct subsystem devices_subsys;
 
 #define to_sysdev(k) container_of(k, struct sys_device, kobj)
drivers/base/power/shutdown.c renamed from drivers/base/power/shutdown.c.old +1 -1
@@ -12,6 +12,7 @@
 #include <linux/device.h>
 #include <asm/semaphore.h>
 
+#include "../base.h"
 #include "power.h"
 
 #define to_dev(node) container_of(node, struct device, kobj.entry)
@@ -28,7 +29,6 @@
  * they only get one called once when interrupts are disabled.
  */
 
-extern int sysdev_shutdown(void);
 
 /**
  * device_shutdown - call ->shutdown() on each device to shutdown.
drivers/base/power/suspend.c renamed from drivers/base/power/suspend.c.old +1 -2
@@ -9,10 +9,9 @@
  */
 
 #include <linux/device.h>
+#include "../base.h"
 #include "power.h"
 
-extern int sysdev_suspend(pm_message_t state);
-
 /*
  * The entries in the dpm_active list are in a depth first order, simply
  * because children are guaranteed to be discovered after parents, and
drivers/base/power/resume.c renamed from drivers/base/power/resume.c.old +1 -2
@@ -9,10 +9,9 @@
  */
 
 #include <linux/device.h>
+#include "../base.h"
 #include "power.h"
 
-extern int sysdev_resume(void);
-
 
 /**
  *	resume_device - Restore state for one device.
#1 lore raw
Quoted 25 lines · Adrian Bunk

This patch contains the following changes:
- move prototypes to base.h
- sys.c should #include "base.h" for getting the prototype of it's global function system_bus_init()

Note that hidden in this patch there's a bugfix:

Caller and callee disagreed regarding the return type of sysdev_shutdown().

---

 drivers/base/base.h           |    6 ++++++
 drivers/base/power/resume.c   |    3 +--
 drivers/base/power/shutdown.c |    2 +-
 drivers/base/power/suspend.c  |    3 +--
 drivers/base/sys.c            |    2 ++
 5 files changed, 11 insertions(+), 5 deletions(-)

drivers/base/base.h line 5

Quoted 5 lines
drivers/base/base.h renamed from drivers/base/base.h.old +2 -0
@@ -1,6 +1,8 @@
 
 /* initialisation functions */
 
+#include <linux/device.h>
+

Why is this extra #include needed? It shouldn't be.

thanks,

greg k-h

#2 lore raw
Quoted 27 lines · Greg KH
Quoted 26 lines · Adrian Bunk

This patch contains the following changes:
- move prototypes to base.h
- sys.c should #include "base.h" for getting the prototype of it's global function system_bus_init()

Note that hidden in this patch there's a bugfix:

Caller and callee disagreed regarding the return type of sysdev_shutdown().

---

 drivers/base/base.h           |    6 ++++++
 drivers/base/power/resume.c   |    3 +--
 drivers/base/power/shutdown.c |    2 +-
 drivers/base/power/suspend.c  |    3 +--
 drivers/base/sys.c            |    2 ++
 5 files changed, 11 insertions(+), 5 deletions(-)
drivers/base/base.h renamed from drivers/base/base.h.old +0 -0
@@ -1,6 +1,8 @@
 
Quoted 6 lines

drivers/base/base.h line 5

Quoted 4 lines
drivers/base/base.h renamed from drivers/base/base.h.old +2 -0
 /* initialisation functions */
 
+#include <linux/device.h>
+

Why is this extra #include needed? It shouldn't be.

struct class_device and struct class_device_attribute are needed since they are used in base.h .

Quoted 3 lines

thanks,

greg k-h

cu
Adrian

Signature · 4 lines
       "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
#3 lore raw
Quoted 30 lines · Adrian Bunk
Quoted 29 lines · Greg KH
Quoted 28 lines · Adrian Bunk

This patch contains the following changes:
- move prototypes to base.h
- sys.c should #include "base.h" for getting the prototype of it's global function system_bus_init()

Note that hidden in this patch there's a bugfix:

Caller and callee disagreed regarding the return type of sysdev_shutdown().

---

 drivers/base/base.h           |    6 ++++++
 drivers/base/power/resume.c   |    3 +--
 drivers/base/power/shutdown.c |    2 +-
 drivers/base/power/suspend.c  |    3 +--
 drivers/base/sys.c            |    2 ++
 5 files changed, 11 insertions(+), 5 deletions(-)
drivers/base/base.h renamed from drivers/base/base.h.old +0 -0
@@ -1,6 +1,8 @@
 
 /* initialisation functions */
 
Quoted 7 lines
Quoted 4 lines

drivers/base/base.h line 5

Quoted 2 lines
drivers/base/base.h renamed from drivers/base/base.h.old +2 -0
+#include <linux/device.h>
+

Why is this extra #include needed? It shouldn't be.

struct class_device and struct class_device_attribute are needed since they are used in base.h .

But anyone who includes base.h will have already included this header file, right? That was my point.

thanks,

greg k-h

#4 lore raw
Quoted 36 lines · Greg KH
Quoted 35 lines · Adrian Bunk
Quoted 33 lines · Greg KH
Quoted 25 lines · Adrian Bunk

This patch contains the following changes:
- move prototypes to base.h
- sys.c should #include "base.h" for getting the prototype of it's global function system_bus_init()

Note that hidden in this patch there's a bugfix:

Caller and callee disagreed regarding the return type of sysdev_shutdown().

---

 drivers/base/base.h           |    6 ++++++
 drivers/base/power/resume.c   |    3 +--
 drivers/base/power/shutdown.c |    2 +-
 drivers/base/power/suspend.c  |    3 +--
 drivers/base/sys.c            |    2 ++
 5 files changed, 11 insertions(+), 5 deletions(-)

drivers/base/base.h line 5

Quoted 5 lines
drivers/base/base.h renamed from drivers/base/base.h.old +2 -0
@@ -1,6 +1,8 @@
 
 /* initialisation functions */
 
+#include <linux/device.h>
+

Why is this extra #include needed? It shouldn't be.

Quoted 5 lines
Quoted 2 lines

struct class_device and struct class_device_attribute are needed since they are used in base.h .

But anyone who includes base.h will have already included this header file, right? That was my point.

drivers/base/sys.c doesn't (this is why I noticed it).

Quoted 3 lines

thanks,

greg k-h

cu
Adrian

Signature · 4 lines
       "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
#5 lore raw
Quoted 37 lines · Adrian Bunk
Quoted 36 lines · Greg KH
Quoted 35 lines · Adrian Bunk
Quoted 33 lines · Greg KH
Quoted 25 lines · Adrian Bunk

This patch contains the following changes:
- move prototypes to base.h
- sys.c should #include "base.h" for getting the prototype of it's global function system_bus_init()

Note that hidden in this patch there's a bugfix:

Caller and callee disagreed regarding the return type of sysdev_shutdown().

---

 drivers/base/base.h           |    6 ++++++
 drivers/base/power/resume.c   |    3 +--
 drivers/base/power/shutdown.c |    2 +-
 drivers/base/power/suspend.c  |    3 +--
 drivers/base/sys.c            |    2 ++
 5 files changed, 11 insertions(+), 5 deletions(-)

drivers/base/base.h line 5

Quoted 5 lines
drivers/base/base.h renamed from drivers/base/base.h.old +2 -0
@@ -1,6 +1,8 @@
 
 /* initialisation functions */
 
+#include <linux/device.h>
+

Why is this extra #include needed? It shouldn't be.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

struct class_device and struct class_device_attribute are needed since they are used in base.h .

But anyone who includes base.h will have already included this header file, right? That was my point.

drivers/base/sys.c doesn't (this is why I noticed it).

Then it would be easier to add it there, if needed, than adding it to base.h where it will tried to be included twice for all of the other driver core files :)

Care to redo it?

thanks,

greg k-h

#6 lore raw

PATCH 1/1 drivers/base/: proper prototypes

Quoted 9 lines · Greg KH
Quoted 2 lines · Adrian Bunk

drivers/base/sys.c doesn't (this is why I noticed it).

Then it would be easier to add it there, if needed, than adding it to base.h where it will tried to be included twice for all of the other driver core files :)

Care to redo it?

Updated patch below.

Quoted 3 lines

thanks,

greg k-h

cu
Adrian

<-- snip -->

This patch contains the following changes:
- move prototypes to base.h
- sys.c should #include "base.h" for getting the prototype of it's global function system_bus_init()

Note that hidden in this patch there's a bugfix:

Caller and callee disagreed regarding the return type of sysdev_shutdown().

---

 drivers/base/base.h           |    4 ++++
 drivers/base/power/resume.c   |    3 +--
 drivers/base/power/shutdown.c |    2 +-
 drivers/base/power/suspend.c  |    3 +--
 drivers/base/sys.c            |    3 +++
 5 files changed, 10 insertions(+), 5 deletions(-)
drivers/base/base.h renamed from drivers/base/base.h.old +4 -0
@@ -19,6 +19,10 @@
 extern void driver_detach(struct device_driver * drv);
 extern int driver_probe_device(struct device_driver *, struct device *);
 
+extern void sysdev_shutdown(void);
+extern int sysdev_suspend(pm_message_t state);
+extern int sysdev_resume(void);
+
 static inline struct class_device *to_class_dev(struct kobject *obj)
 {
 	return container_of(obj, struct class_device, kobj);
drivers/base/sys.c renamed from drivers/base/sys.c.old +3 -0
@@ -21,8 +21,11 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/pm.h>
+#include <linux/device.h>
 #include <asm/semaphore.h>
 
+#include "base.h"
+
 extern struct subsystem devices_subsys;
 
 #define to_sysdev(k) container_of(k, struct sys_device, kobj)
drivers/base/power/shutdown.c renamed from drivers/base/power/shutdown.c.old +1 -1
@@ -12,6 +12,7 @@
 #include <linux/device.h>
 #include <asm/semaphore.h>
 
+#include "../base.h"
 #include "power.h"
 
 #define to_dev(node) container_of(node, struct device, kobj.entry)
@@ -28,7 +29,6 @@
  * they only get one called once when interrupts are disabled.
  */
 
-extern int sysdev_shutdown(void);
 
 /**
  * device_shutdown - call ->shutdown() on each device to shutdown.
drivers/base/power/suspend.c renamed from drivers/base/power/suspend.c.old +1 -2
@@ -9,10 +9,9 @@
  */
 
 #include <linux/device.h>
+#include "../base.h"
 #include "power.h"
 
-extern int sysdev_suspend(pm_message_t state);
-
 /*
  * The entries in the dpm_active list are in a depth first order, simply
  * because children are guaranteed to be discovered after parents, and
drivers/base/power/resume.c renamed from drivers/base/power/resume.c.old +1 -2
@@ -9,10 +9,9 @@
  */
 
 #include <linux/device.h>
+#include "../base.h"
 #include "power.h"
 
-extern int sysdev_resume(void);
-
 
 /**
  *	resume_device - Restore state for one device.