aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 12:17:22 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 12:17:22 -0800
commitef8a3fd6e5e12e8989dae97ba5491c2e39369af9 (patch)
treef7833cd19e036141d26bd3f3732cd4de7752a161
parentd1c3414c2a9d10ef7f0f7665f5d2947cd088c093 (diff)
downloadkernel_goldelico_gta04-ef8a3fd6e5e12e8989dae97ba5491c2e39369af9.zip
kernel_goldelico_gta04-ef8a3fd6e5e12e8989dae97ba5491c2e39369af9.tar.gz
kernel_goldelico_gta04-ef8a3fd6e5e12e8989dae97ba5491c2e39369af9.tar.bz2
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>
-rw-r--r--drivers/base/base.h5
-rw-r--r--drivers/base/core.c2
-rw-r--r--drivers/base/dd.c18
-rw-r--r--include/linux/device.h5
4 files changed, 16 insertions, 14 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 2c13dea..6ee17bb 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -59,6 +59,10 @@ struct driver_private {
* @knode_parent - node in sibling list
* @knode_driver - node in driver list
* @knode_bus - node in bus list
+ * @deferred_probe - entry in deferred_probe_list which is used to retry the
+ * binding of drivers which were unable to get all the resources needed by
+ * the device; typically because it depends on another driver getting
+ * probed first.
* @driver_data - private pointer for driver specific info. Will turn into a
* list soon.
* @device - pointer back to the struct class that this structure is
@@ -71,6 +75,7 @@ struct device_private {
struct klist_node knode_parent;
struct klist_node knode_driver;
struct klist_node knode_bus;
+ struct list_head deferred_probe;
void *driver_data;
struct device *device;
};
diff --git a/drivers/base/core.c b/drivers/base/core.c
index d4ff7ad..7050a75 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -644,7 +644,6 @@ void device_initialize(struct device *dev)
{
dev->kobj.kset = devices_kset;
kobject_init(&dev->kobj, &device_ktype);
- INIT_LIST_HEAD(&dev->deferred_probe);
INIT_LIST_HEAD(&dev->dma_pools);
mutex_init(&dev->mutex);
lockdep_set_novalidate_class(&dev->mutex);
@@ -922,6 +921,7 @@ int device_private_init(struct device *dev)
dev->p->device = dev;
klist_init(&dev->p->klist_children, klist_children_get,
klist_children_put);
+ INIT_LIST_HEAD(&dev->p->deferred_probe);
return 0;
}
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 442b764..9fa888e 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -45,7 +45,7 @@
* retry them.
*
* The deferred_probe_mutex must be held any time the deferred_probe_*_list
- * of the (struct device*)->deferred_probe pointers are manipulated
+ * of the (struct device*)->p->deferred_probe pointers are manipulated
*/
static DEFINE_MUTEX(deferred_probe_mutex);
static LIST_HEAD(deferred_probe_pending_list);
@@ -58,6 +58,7 @@ static struct workqueue_struct *deferred_wq;
static void deferred_probe_work_func(struct work_struct *work)
{
struct device *dev;
+ struct device_private *private;
/*
* This block processes every device in the deferred 'active' list.
* 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)
*/
mutex_lock(&deferred_probe_mutex);
while (!list_empty(&deferred_probe_active_list)) {
- dev = list_first_entry(&deferred_probe_active_list,
- typeof(*dev), deferred_probe);
- list_del_init(&dev->deferred_probe);
+ private = list_first_entry(&deferred_probe_active_list,
+ typeof(*dev->p), deferred_probe);
+ dev = private->device;
+ list_del_init(&private->deferred_probe);
get_device(dev);
@@ -94,9 +96,9 @@ static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);
static void driver_deferred_probe_add(struct device *dev)
{
mutex_lock(&deferred_probe_mutex);
- if (list_empty(&dev->deferred_probe)) {
+ if (list_empty(&dev->p->deferred_probe)) {
dev_dbg(dev, "Added to deferred list\n");
- list_add(&dev->deferred_probe, &deferred_probe_pending_list);
+ list_add(&dev->p->deferred_probe, &deferred_probe_pending_list);
}
mutex_unlock(&deferred_probe_mutex);
}
@@ -104,9 +106,9 @@ static void driver_deferred_probe_add(struct device *dev)
void driver_deferred_probe_del(struct device *dev)
{
mutex_lock(&deferred_probe_mutex);
- if (!list_empty(&dev->deferred_probe)) {
+ if (!list_empty(&dev->p->deferred_probe)) {
dev_dbg(dev, "Removed from deferred list\n");
- list_del_init(&dev->deferred_probe);
+ list_del_init(&dev->p->deferred_probe);
}
mutex_unlock(&deferred_probe_mutex);
}
diff --git a/include/linux/device.h b/include/linux/device.h
index 22d6938..f62e216 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -585,10 +585,6 @@ struct device_dma_parameters {
* @mutex: Mutex to synchronize calls to its driver.
* @bus: Type of bus device is on.
* @driver: Which driver has allocated this
- * @deferred_probe: entry in deferred_probe_list which is used to retry the
- * binding of drivers which were unable to get all the resources
- * needed by the device; typically because it depends on another
- * driver getting probed first.
* @platform_data: Platform data specific to the device.
* Example: For devices on custom boards, as typical of embedded
* and SOC based hardware, Linux often uses platform_data to point
@@ -648,7 +644,6 @@ struct device {
struct bus_type *bus; /* type of bus device is on */
struct device_driver *driver; /* which driver has allocated this
device */
- struct list_head deferred_probe;
void *platform_data; /* Platform specific data, device
core doesn't touch it */
struct dev_pm_info power;