aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/driver.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-12-16 15:25:49 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:38:25 -0400
commit8940b4f312dced51b45004819b776ec3aa7fcd5d (patch)
treef994df6952a12ad5a3b46762e8a53eaa99f215b6 /drivers/base/driver.c
parentf791b8c836307b58cbf62133a6a772ed1a92fb33 (diff)
driver core: move knode_driver into private structure
Nothing outside of the driver core should ever touch knode_driver, so move it out of the public eye. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/driver.c')
-rw-r--r--drivers/base/driver.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 2889ad57e48b..c51f11bb29ae 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -19,7 +19,14 @@
19static struct device *next_device(struct klist_iter *i) 19static struct device *next_device(struct klist_iter *i)
20{ 20{
21 struct klist_node *n = klist_next(i); 21 struct klist_node *n = klist_next(i);
22 return n ? container_of(n, struct device, knode_driver) : NULL; 22 struct device *dev = NULL;
23 struct device_private *dev_prv;
24
25 if (n) {
26 dev_prv = to_device_private_driver(n);
27 dev = dev_prv->device;
28 }
29 return dev;
23} 30}
24 31
25/** 32/**
@@ -42,7 +49,7 @@ int driver_for_each_device(struct device_driver *drv, struct device *start,
42 return -EINVAL; 49 return -EINVAL;
43 50
44 klist_iter_init_node(&drv->p->klist_devices, &i, 51 klist_iter_init_node(&drv->p->klist_devices, &i,
45 start ? &start->knode_driver : NULL); 52 start ? &start->p->knode_driver : NULL);
46 while ((dev = next_device(&i)) && !error) 53 while ((dev = next_device(&i)) && !error)
47 error = fn(dev, data); 54 error = fn(dev, data);
48 klist_iter_exit(&i); 55 klist_iter_exit(&i);
@@ -76,7 +83,7 @@ struct device *driver_find_device(struct device_driver *drv,
76 return NULL; 83 return NULL;
77 84
78 klist_iter_init_node(&drv->p->klist_devices, &i, 85 klist_iter_init_node(&drv->p->klist_devices, &i,
79 (start ? &start->knode_driver : NULL)); 86 (start ? &start->p->knode_driver : NULL));
80 while ((dev = next_device(&i))) 87 while ((dev = next_device(&i)))
81 if (match(dev, data) && get_device(dev)) 88 if (match(dev, data) && get_device(dev))
82 break; 89 break;