aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/dd.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 15:17:22 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 15:17:22 -0500
commitef8a3fd6e5e12e8989dae97ba5491c2e39369af9 (patch)
treef7833cd19e036141d26bd3f3732cd4de7752a161 /drivers/base/dd.c
parentd1c3414c2a9d10ef7f0f7665f5d2947cd088c093 (diff)
driver core: move the deferred probe pointer into the private area
Nothing outside of the driver core needs to get to the deferred probe pointer, so move it inside the private area of 'struct device' so no one tries to mess around with it. Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/dd.c')
-rw-r--r--drivers/base/dd.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 442b7641a086..9fa888e08059 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -45,7 +45,7 @@
45 * retry them. 45 * retry them.
46 * 46 *
47 * The deferred_probe_mutex must be held any time the deferred_probe_*_list 47 * The deferred_probe_mutex must be held any time the deferred_probe_*_list
48 * of the (struct device*)->deferred_probe pointers are manipulated 48 * of the (struct device*)->p->deferred_probe pointers are manipulated
49 */ 49 */
50static DEFINE_MUTEX(deferred_probe_mutex); 50static DEFINE_MUTEX(deferred_probe_mutex);
51static LIST_HEAD(deferred_probe_pending_list); 51static LIST_HEAD(deferred_probe_pending_list);
@@ -58,6 +58,7 @@ static struct workqueue_struct *deferred_wq;
58static void deferred_probe_work_func(struct work_struct *work) 58static void deferred_probe_work_func(struct work_struct *work)
59{ 59{
60 struct device *dev; 60 struct device *dev;
61 struct device_private *private;
61 /* 62 /*
62 * This block processes every device in the deferred 'active' list. 63 * This block processes every device in the deferred 'active' list.
63 * Each device is removed from the active list and passed to 64 * Each device is removed from the active list and passed to
@@ -72,9 +73,10 @@ static void deferred_probe_work_func(struct work_struct *work)
72 */ 73 */
73 mutex_lock(&deferred_probe_mutex); 74 mutex_lock(&deferred_probe_mutex);
74 while (!list_empty(&deferred_probe_active_list)) { 75 while (!list_empty(&deferred_probe_active_list)) {
75 dev = list_first_entry(&deferred_probe_active_list, 76 private = list_first_entry(&deferred_probe_active_list,
76 typeof(*dev), deferred_probe); 77 typeof(*dev->p), deferred_probe);
77 list_del_init(&dev->deferred_probe); 78 dev = private->device;
79 list_del_init(&private->deferred_probe);
78 80
79 get_device(dev); 81 get_device(dev);
80 82
@@ -94,9 +96,9 @@ static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);
94static void driver_deferred_probe_add(struct device *dev) 96static void driver_deferred_probe_add(struct device *dev)
95{ 97{
96 mutex_lock(&deferred_probe_mutex); 98 mutex_lock(&deferred_probe_mutex);
97 if (list_empty(&dev->deferred_probe)) { 99 if (list_empty(&dev->p->deferred_probe)) {
98 dev_dbg(dev, "Added to deferred list\n"); 100 dev_dbg(dev, "Added to deferred list\n");
99 list_add(&dev->deferred_probe, &deferred_probe_pending_list); 101 list_add(&dev->p->deferred_probe, &deferred_probe_pending_list);
100 } 102 }
101 mutex_unlock(&deferred_probe_mutex); 103 mutex_unlock(&deferred_probe_mutex);
102} 104}
@@ -104,9 +106,9 @@ static void driver_deferred_probe_add(struct device *dev)
104void driver_deferred_probe_del(struct device *dev) 106void driver_deferred_probe_del(struct device *dev)
105{ 107{
106 mutex_lock(&deferred_probe_mutex); 108 mutex_lock(&deferred_probe_mutex);
107 if (!list_empty(&dev->deferred_probe)) { 109 if (!list_empty(&dev->p->deferred_probe)) {
108 dev_dbg(dev, "Removed from deferred list\n"); 110 dev_dbg(dev, "Removed from deferred list\n");
109 list_del_init(&dev->deferred_probe); 111 list_del_init(&dev->p->deferred_probe);
110 } 112 }
111 mutex_unlock(&deferred_probe_mutex); 113 mutex_unlock(&deferred_probe_mutex);
112} 114}