aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/dd.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-28 18:59:15 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:35 -0500
commite5dd12784617f0f1fae5f96a7fac1ec4c49fadbe (patch)
treec81e2a2f3aa1c60b92951d398774f1391bdc6a1c /drivers/base/dd.c
parentc63469a3985a9771c18a916b8d42845d044ea0b1 (diff)
Driver core: move the static kobject out of struct driver
This patch removes the kobject, and a few other driver-core-only fields out of struct driver and into the driver core only. Now drivers can be safely create on the stack or statically (like they currently are.) Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/dd.c')
-rw-r--r--drivers/base/dd.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 7bf0e674c975..87a348ce818c 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -11,6 +11,8 @@
11 * 11 *
12 * Copyright (c) 2002-5 Patrick Mochel 12 * Copyright (c) 2002-5 Patrick Mochel
13 * Copyright (c) 2002-3 Open Source Development Labs 13 * Copyright (c) 2002-3 Open Source Development Labs
14 * Copyright (c) 2007 Greg Kroah-Hartman <gregkh@suse.de>
15 * Copyright (c) 2007 Novell Inc.
14 * 16 *
15 * This file is released under the GPLv2 17 * This file is released under the GPLv2
16 */ 18 */
@@ -23,8 +25,6 @@
23#include "base.h" 25#include "base.h"
24#include "power/power.h" 26#include "power/power.h"
25 27
26#define to_drv(node) container_of(node, struct device_driver, kobj.entry)
27
28 28
29static void driver_bound(struct device *dev) 29static void driver_bound(struct device *dev)
30{ 30{
@@ -41,20 +41,20 @@ static void driver_bound(struct device *dev)
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->klist_devices); 44 klist_add_tail(&dev->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)
48{ 48{
49 int ret; 49 int ret;
50 50
51 ret = sysfs_create_link(&dev->driver->kobj, &dev->kobj, 51 ret = sysfs_create_link(&dev->driver->p->kobj, &dev->kobj,
52 kobject_name(&dev->kobj)); 52 kobject_name(&dev->kobj));
53 if (ret == 0) { 53 if (ret == 0) {
54 ret = sysfs_create_link(&dev->kobj, &dev->driver->kobj, 54 ret = sysfs_create_link(&dev->kobj, &dev->driver->p->kobj,
55 "driver"); 55 "driver");
56 if (ret) 56 if (ret)
57 sysfs_remove_link(&dev->driver->kobj, 57 sysfs_remove_link(&dev->driver->p->kobj,
58 kobject_name(&dev->kobj)); 58 kobject_name(&dev->kobj));
59 } 59 }
60 return ret; 60 return ret;
@@ -65,7 +65,7 @@ static void driver_sysfs_remove(struct device *dev)
65 struct device_driver *drv = dev->driver; 65 struct device_driver *drv = dev->driver;
66 66
67 if (drv) { 67 if (drv) {
68 sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); 68 sysfs_remove_link(&drv->p->kobj, kobject_name(&dev->kobj));
69 sysfs_remove_link(&dev->kobj, "driver"); 69 sysfs_remove_link(&dev->kobj, "driver");
70 } 70 }
71} 71}
@@ -339,15 +339,15 @@ void driver_detach(struct device_driver * drv)
339 struct device * dev; 339 struct device * dev;
340 340
341 for (;;) { 341 for (;;) {
342 spin_lock(&drv->klist_devices.k_lock); 342 spin_lock(&drv->p->klist_devices.k_lock);
343 if (list_empty(&drv->klist_devices.k_list)) { 343 if (list_empty(&drv->p->klist_devices.k_list)) {
344 spin_unlock(&drv->klist_devices.k_lock); 344 spin_unlock(&drv->p->klist_devices.k_lock);
345 break; 345 break;
346 } 346 }
347 dev = list_entry(drv->klist_devices.k_list.prev, 347 dev = list_entry(drv->p->klist_devices.k_list.prev,
348 struct device, knode_driver.n_node); 348 struct device, knode_driver.n_node);
349 get_device(dev); 349 get_device(dev);
350 spin_unlock(&drv->klist_devices.k_lock); 350 spin_unlock(&drv->p->klist_devices.k_lock);
351 351
352 if (dev->parent) /* Needed for USB */ 352 if (dev->parent) /* Needed for USB */
353 down(&dev->parent->sem); 353 down(&dev->parent->sem);