diff options
| author | Patrick Mochel <mochel@osdl.org> | 2002-09-16 22:24:43 -0700 |
|---|---|---|
| committer | Patrick Mochel <mochel@osdl.org> | 2002-09-16 22:24:43 -0700 |
| commit | 00e1d4da7ad40fdf02f01aff4c684babe1e99c61 (patch) | |
| tree | ff742a690100ab2dcb366e54f1ee1dba7c7f4022 /drivers/base | |
| parent | 6b29059af3cb8607e055c5051c608a876572cdf7 (diff) | |
| parent | 9d5f4b16c4f471d91db902d016da7fd4874a40e4 (diff) | |
drivers/base/core.c: merge fixup
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/Makefile | 2 | ||||
| -rw-r--r-- | drivers/base/core.c | 9 | ||||
| -rw-r--r-- | drivers/base/platform.c | 27 | ||||
| -rw-r--r-- | drivers/base/power.c | 6 |
4 files changed, 34 insertions, 10 deletions
diff --git a/drivers/base/Makefile b/drivers/base/Makefile index 03f418c4b046..411b2bf44cfa 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile @@ -1,7 +1,7 @@ # Makefile for the Linux device tree obj-y := core.o sys.o interface.o power.o bus.o \ - driver.o class.o intf.o + driver.o class.o intf.o platform.o obj-y += fs/ diff --git a/drivers/base/core.c b/drivers/base/core.c index 977c4b9fe92a..c7a5756c6d4a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -97,15 +97,10 @@ static int device_attach(struct device * dev) static void device_detach(struct device * dev) { - struct device_driver * drv; + struct device_driver * drv = dev->driver; - if (dev->driver) { + if (drv) { devclass_remove_device(dev); - spin_lock(&device_lock); - drv = dev->driver; - spin_unlock(&device_lock); - - /* detach from driver */ if (drv && drv->remove) drv->remove(dev); diff --git a/drivers/base/platform.c b/drivers/base/platform.c new file mode 100644 index 000000000000..f637a25937cb --- /dev/null +++ b/drivers/base/platform.c @@ -0,0 +1,27 @@ +/* + * platform.c - platform 'psuedo' bus for legacy devices + * + * Please see Documentation/driver-model/platform.txt for more + * information. + */ + +#include <linux/device.h> +#include <linux/module.h> +#include <linux/init.h> + +static int platform_match(struct device * dev, struct device_driver * drv) +{ + return 0; +} + +struct bus_type platform_bus = { + .name = "platform", + .match = platform_match, +}; + +static int __init platform_bus_init(void) +{ + return bus_register(&platform_bus); +} + +postcore_initcall(platform_bus_init); diff --git a/drivers/base/power.c b/drivers/base/power.c index 8dcea4ff85a0..8161725356ca 100644 --- a/drivers/base/power.c +++ b/drivers/base/power.c @@ -92,13 +92,13 @@ void device_resume(u32 level) */ void device_shutdown(void) { - struct list_head * node; + struct list_head * node, * next; struct device * prev = NULL; printk(KERN_EMERG "Shutting down devices\n"); spin_lock(&device_lock); - list_for_each(node,&global_device_list) { + list_for_each_safe(node,next,&global_device_list) { struct device * dev = get_device_locked(to_dev(node)); if (dev) { spin_unlock(&device_lock); @@ -111,6 +111,8 @@ void device_shutdown(void) } } spin_unlock(&device_lock); + if (prev) + put_device(prev); } EXPORT_SYMBOL(device_suspend); |
