aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2006-01-27 17:18:29 -0500
committerLen Brown <len.brown@intel.com>2006-01-27 17:18:29 -0500
commit292dd876ee765c478b27c93cc51e93a558ed58bf (patch)
tree5b740e93253295baee2a9c414a6c66d03d44a9ef /drivers/base
parentd4ec6c7cc9a15a7a529719bc3b84f46812f9842e (diff)
parent9fdb62af92c741addbea15545f214a6e89460865 (diff)
Pull release into acpica branch
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c4
-rw-r--r--drivers/base/cpu.c30
-rw-r--r--drivers/base/dd.c12
-rw-r--r--drivers/base/driver.c5
-rw-r--r--drivers/base/firmware_class.c3
-rw-r--r--drivers/base/memory.c2
-rw-r--r--drivers/base/platform.c2
-rw-r--r--drivers/base/power/shutdown.c9
8 files changed, 57 insertions, 10 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index fd8059920dbf..6b355bd7816d 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -161,8 +161,8 @@ static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
161 return count; 161 return count;
162} 162}
163 163
164/** 164/*
165 * device_subsys - structure to be registered with kobject core. 165 * devices_subsys - structure to be registered with kobject core.
166 */ 166 */
167 167
168decl_subsys(devices, &ktype_device, &device_uevent_ops); 168decl_subsys(devices, &ktype_device, &device_uevent_ops);
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 281d26784d25..07a7f97e1de9 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -83,6 +83,31 @@ static inline void register_cpu_control(struct cpu *cpu)
83} 83}
84#endif /* CONFIG_HOTPLUG_CPU */ 84#endif /* CONFIG_HOTPLUG_CPU */
85 85
86#ifdef CONFIG_KEXEC
87#include <linux/kexec.h>
88
89static ssize_t show_crash_notes(struct sys_device *dev, char *buf)
90{
91 struct cpu *cpu = container_of(dev, struct cpu, sysdev);
92 ssize_t rc;
93 unsigned long long addr;
94 int cpunum;
95
96 cpunum = cpu->sysdev.id;
97
98 /*
99 * Might be reading other cpu's data based on which cpu read thread
100 * has been scheduled. But cpu data (memory) is allocated once during
101 * boot up and this data does not change there after. Hence this
102 * operation should be safe. No locking required.
103 */
104 addr = __pa(per_cpu_ptr(crash_notes, cpunum));
105 rc = sprintf(buf, "%Lx\n", addr);
106 return rc;
107}
108static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL);
109#endif
110
86/* 111/*
87 * register_cpu - Setup a driverfs device for a CPU. 112 * register_cpu - Setup a driverfs device for a CPU.
88 * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to 113 * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to
@@ -108,6 +133,11 @@ int __devinit register_cpu(struct cpu *cpu, int num, struct node *root)
108 register_cpu_control(cpu); 133 register_cpu_control(cpu);
109 if (!error) 134 if (!error)
110 cpu_sys_devices[num] = &cpu->sysdev; 135 cpu_sys_devices[num] = &cpu->sysdev;
136
137#ifdef CONFIG_KEXEC
138 if (!error)
139 error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes);
140#endif
111 return error; 141 return error;
112} 142}
113 143
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 2b905016664d..730a9ce0a14a 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -78,7 +78,13 @@ int driver_probe_device(struct device_driver * drv, struct device * dev)
78 pr_debug("%s: Matched Device %s with Driver %s\n", 78 pr_debug("%s: Matched Device %s with Driver %s\n",
79 drv->bus->name, dev->bus_id, drv->name); 79 drv->bus->name, dev->bus_id, drv->name);
80 dev->driver = drv; 80 dev->driver = drv;
81 if (drv->probe) { 81 if (dev->bus->probe) {
82 ret = dev->bus->probe(dev);
83 if (ret) {
84 dev->driver = NULL;
85 goto ProbeFailed;
86 }
87 } else if (drv->probe) {
82 ret = drv->probe(dev); 88 ret = drv->probe(dev);
83 if (ret) { 89 if (ret) {
84 dev->driver = NULL; 90 dev->driver = NULL;
@@ -203,7 +209,9 @@ static void __device_release_driver(struct device * dev)
203 sysfs_remove_link(&dev->kobj, "driver"); 209 sysfs_remove_link(&dev->kobj, "driver");
204 klist_remove(&dev->knode_driver); 210 klist_remove(&dev->knode_driver);
205 211
206 if (drv->remove) 212 if (dev->bus->remove)
213 dev->bus->remove(dev);
214 else if (drv->remove)
207 drv->remove(dev); 215 drv->remove(dev);
208 dev->driver = NULL; 216 dev->driver = NULL;
209 put_driver(drv); 217 put_driver(drv);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 161f3a390d90..b400314e1c62 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -171,6 +171,11 @@ static void klist_devices_put(struct klist_node *n)
171 */ 171 */
172int driver_register(struct device_driver * drv) 172int driver_register(struct device_driver * drv)
173{ 173{
174 if ((drv->bus->probe && drv->probe) ||
175 (drv->bus->remove && drv->remove) ||
176 (drv->bus->shutdown && drv->shutdown)) {
177 printk(KERN_WARNING "Driver '%s' needs updating - please use bus_type methods\n", drv->name);
178 }
174 klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put); 179 klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put);
175 init_completion(&drv->unloaded); 180 init_completion(&drv->unloaded);
176 return bus_add_driver(drv); 181 return bus_add_driver(drv);
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 5b3d5e9ddcb6..e97e911ebf7a 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -7,6 +7,7 @@
7 * 7 *
8 */ 8 */
9 9
10#include <linux/capability.h>
10#include <linux/device.h> 11#include <linux/device.h>
11#include <linux/module.h> 12#include <linux/module.h>
12#include <linux/init.h> 13#include <linux/init.h>
@@ -47,7 +48,7 @@ struct firmware_priv {
47 struct timer_list timeout; 48 struct timer_list timeout;
48}; 49};
49 50
50static inline void 51static void
51fw_load_abort(struct firmware_priv *fw_priv) 52fw_load_abort(struct firmware_priv *fw_priv)
52{ 53{
53 set_bit(FW_STATUS_ABORT, &fw_priv->status); 54 set_bit(FW_STATUS_ABORT, &fw_priv->status);
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 58801d718cc2..d1a05224627e 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -13,8 +13,8 @@
13#include <linux/sysdev.h> 13#include <linux/sysdev.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/sched.h> /* capable() */
17#include <linux/topology.h> 16#include <linux/topology.h>
17#include <linux/capability.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/memory.h> 19#include <linux/memory.h>
20#include <linux/kobject.h> 20#include <linux/kobject.h>
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 0f81731bdfa8..461554a02517 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -327,7 +327,7 @@ EXPORT_SYMBOL_GPL(platform_device_register);
327 * @pdev: platform device we're unregistering 327 * @pdev: platform device we're unregistering
328 * 328 *
329 * Unregistration is done in 2 steps. Fisrt we release all resources 329 * Unregistration is done in 2 steps. Fisrt we release all resources
330 * and remove it from the sybsystem, then we drop reference count by 330 * and remove it from the subsystem, then we drop reference count by
331 * calling platform_device_put(). 331 * calling platform_device_put().
332 */ 332 */
333void platform_device_unregister(struct platform_device * pdev) 333void platform_device_unregister(struct platform_device * pdev)
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index f50a08be424b..c2475f3134ea 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -35,12 +35,15 @@ extern int sysdev_shutdown(void);
35 */ 35 */
36void device_shutdown(void) 36void device_shutdown(void)
37{ 37{
38 struct device * dev; 38 struct device * dev, *devn;
39 39
40 down_write(&devices_subsys.rwsem); 40 down_write(&devices_subsys.rwsem);
41 list_for_each_entry_reverse(dev, &devices_subsys.kset.list, 41 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list,
42 kobj.entry) { 42 kobj.entry) {
43 if (dev->driver && dev->driver->shutdown) { 43 if (dev->bus && dev->bus->shutdown) {
44 dev_dbg(dev, "shutdown\n");
45 dev->bus->shutdown(dev);
46 } else if (dev->driver && dev->driver->shutdown) {
44 dev_dbg(dev, "shutdown\n"); 47 dev_dbg(dev, "shutdown\n");
45 dev->driver->shutdown(dev); 48 dev->driver->shutdown(dev);
46 } 49 }