aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/dd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:02:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:02:07 -0500
commit40d7ee5d162203b40b5f4fbb312ab016edddb97f (patch)
tree432db33df85f7f244676127a189a828dfbf2877b /drivers/base/dd.c
parent5fec8bdbf9a1c4df4ad3f20e52aa2d8caed490c8 (diff)
parentb8ac9fc0e8cda9f9776019c5b0464b0c6d2d4c90 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (60 commits) uio: make uio_info's name and version const UIO: Documentation for UIO ioport info handling UIO: Pass information about ioports to userspace (V2) UIO: uio_pdrv_genirq: allow custom irq_flags UIO: use pci_ioremap_bar() in drivers/uio arm: struct device - replace bus_id with dev_name(), dev_set_name() libata: struct device - replace bus_id with dev_name(), dev_set_name() avr: struct device - replace bus_id with dev_name(), dev_set_name() block: struct device - replace bus_id with dev_name(), dev_set_name() chris: struct device - replace bus_id with dev_name(), dev_set_name() dmi: struct device - replace bus_id with dev_name(), dev_set_name() gadget: struct device - replace bus_id with dev_name(), dev_set_name() gpio: struct device - replace bus_id with dev_name(), dev_set_name() gpu: struct device - replace bus_id with dev_name(), dev_set_name() hwmon: struct device - replace bus_id with dev_name(), dev_set_name() i2o: struct device - replace bus_id with dev_name(), dev_set_name() IA64: struct device - replace bus_id with dev_name(), dev_set_name() i7300_idle: struct device - replace bus_id with dev_name(), dev_set_name() infiniband: struct device - replace bus_id with dev_name(), dev_set_name() ISDN: struct device - replace bus_id with dev_name(), dev_set_name() ...
Diffstat (limited to 'drivers/base/dd.c')
-rw-r--r--drivers/base/dd.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 20febc00a525..6fdaf76f033f 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -28,20 +28,20 @@
28 28
29static void driver_bound(struct device *dev) 29static void driver_bound(struct device *dev)
30{ 30{
31 if (klist_node_attached(&dev->knode_driver)) { 31 if (klist_node_attached(&dev->p->knode_driver)) {
32 printk(KERN_WARNING "%s: device %s already bound\n", 32 printk(KERN_WARNING "%s: device %s already bound\n",
33 __func__, kobject_name(&dev->kobj)); 33 __func__, kobject_name(&dev->kobj));
34 return; 34 return;
35 } 35 }
36 36
37 pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->bus_id, 37 pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev),
38 __func__, dev->driver->name); 38 __func__, dev->driver->name);
39 39
40 if (dev->bus) 40 if (dev->bus)
41 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 41 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
42 BUS_NOTIFY_BOUND_DRIVER, dev); 42 BUS_NOTIFY_BOUND_DRIVER, dev);
43 43
44 klist_add_tail(&dev->knode_driver, &dev->driver->p->klist_devices); 44 klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
45} 45}
46 46
47static int driver_sysfs_add(struct device *dev) 47static int driver_sysfs_add(struct device *dev)
@@ -104,13 +104,13 @@ static int really_probe(struct device *dev, struct device_driver *drv)
104 104
105 atomic_inc(&probe_count); 105 atomic_inc(&probe_count);
106 pr_debug("bus: '%s': %s: probing driver %s with device %s\n", 106 pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
107 drv->bus->name, __func__, drv->name, dev->bus_id); 107 drv->bus->name, __func__, drv->name, dev_name(dev));
108 WARN_ON(!list_empty(&dev->devres_head)); 108 WARN_ON(!list_empty(&dev->devres_head));
109 109
110 dev->driver = drv; 110 dev->driver = drv;
111 if (driver_sysfs_add(dev)) { 111 if (driver_sysfs_add(dev)) {
112 printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", 112 printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
113 __func__, dev->bus_id); 113 __func__, dev_name(dev));
114 goto probe_failed; 114 goto probe_failed;
115 } 115 }
116 116
@@ -127,7 +127,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
127 driver_bound(dev); 127 driver_bound(dev);
128 ret = 1; 128 ret = 1;
129 pr_debug("bus: '%s': %s: bound device %s to driver %s\n", 129 pr_debug("bus: '%s': %s: bound device %s to driver %s\n",
130 drv->bus->name, __func__, dev->bus_id, drv->name); 130 drv->bus->name, __func__, dev_name(dev), drv->name);
131 goto done; 131 goto done;
132 132
133probe_failed: 133probe_failed:
@@ -139,7 +139,7 @@ probe_failed:
139 /* driver matched but the probe failed */ 139 /* driver matched but the probe failed */
140 printk(KERN_WARNING 140 printk(KERN_WARNING
141 "%s: probe of %s failed with error %d\n", 141 "%s: probe of %s failed with error %d\n",
142 drv->name, dev->bus_id, ret); 142 drv->name, dev_name(dev), ret);
143 } 143 }
144 /* 144 /*
145 * Ignore errors returned by ->probe so that the next driver can try 145 * Ignore errors returned by ->probe so that the next driver can try
@@ -194,7 +194,7 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
194 goto done; 194 goto done;
195 195
196 pr_debug("bus: '%s': %s: matched device %s with driver %s\n", 196 pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
197 drv->bus->name, __func__, dev->bus_id, drv->name); 197 drv->bus->name, __func__, dev_name(dev), drv->name);
198 198
199 ret = really_probe(dev, drv); 199 ret = really_probe(dev, drv);
200 200
@@ -298,7 +298,6 @@ static void __device_release_driver(struct device *dev)
298 drv = dev->driver; 298 drv = dev->driver;
299 if (drv) { 299 if (drv) {
300 driver_sysfs_remove(dev); 300 driver_sysfs_remove(dev);
301 sysfs_remove_link(&dev->kobj, "driver");
302 301
303 if (dev->bus) 302 if (dev->bus)
304 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 303 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
@@ -311,7 +310,7 @@ static void __device_release_driver(struct device *dev)
311 drv->remove(dev); 310 drv->remove(dev);
312 devres_release_all(dev); 311 devres_release_all(dev);
313 dev->driver = NULL; 312 dev->driver = NULL;
314 klist_remove(&dev->knode_driver); 313 klist_remove(&dev->p->knode_driver);
315 } 314 }
316} 315}
317 316
@@ -341,6 +340,7 @@ EXPORT_SYMBOL_GPL(device_release_driver);
341 */ 340 */
342void driver_detach(struct device_driver *drv) 341void driver_detach(struct device_driver *drv)
343{ 342{
343 struct device_private *dev_prv;
344 struct device *dev; 344 struct device *dev;
345 345
346 for (;;) { 346 for (;;) {
@@ -349,8 +349,10 @@ void driver_detach(struct device_driver *drv)
349 spin_unlock(&drv->p->klist_devices.k_lock); 349 spin_unlock(&drv->p->klist_devices.k_lock);
350 break; 350 break;
351 } 351 }
352 dev = list_entry(drv->p->klist_devices.k_list.prev, 352 dev_prv = list_entry(drv->p->klist_devices.k_list.prev,
353 struct device, knode_driver.n_node); 353 struct device_private,
354 knode_driver.n_node);
355 dev = dev_prv->device;
354 get_device(dev); 356 get_device(dev);
355 spin_unlock(&drv->p->klist_devices.k_lock); 357 spin_unlock(&drv->p->klist_devices.k_lock);
356 358