Skip to content

Commit ef8a3fd

Browse files
committed
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>
1 parent d1c3414 commit ef8a3fd

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

‎drivers/base/base.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ struct driver_private {
5959
* @knode_parent - node in sibling list
6060
* @knode_driver - node in driver list
6161
* @knode_bus - node in bus list
62+
* @deferred_probe - entry in deferred_probe_list which is used to retry the
63+
* binding of drivers which were unable to get all the resources needed by
64+
* the device; typically because it depends on another driver getting
65+
* probed first.
6266
* @driver_data - private pointer for driver specific info. Will turn into a
6367
* list soon.
6468
* @device - pointer back to the struct class that this structure is
@@ -71,6 +75,7 @@ struct device_private {
7175
struct klist_node knode_parent;
7276
struct klist_node knode_driver;
7377
struct klist_node knode_bus;
78+
struct list_head deferred_probe;
7479
void *driver_data;
7580
struct device *device;
7681
};

‎drivers/base/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ void device_initialize(struct device *dev)
644644
{
645645
dev->kobj.kset = devices_kset;
646646
kobject_init(&dev->kobj, &device_ktype);
647-
INIT_LIST_HEAD(&dev->deferred_probe);
648647
INIT_LIST_HEAD(&dev->dma_pools);
649648
mutex_init(&dev->mutex);
650649
lockdep_set_novalidate_class(&dev->mutex);
@@ -922,6 +921,7 @@ int device_private_init(struct device *dev)
922921
dev->p->device = dev;
923922
klist_init(&dev->p->klist_children, klist_children_get,
924923
klist_children_put);
924+
INIT_LIST_HEAD(&dev->p->deferred_probe);
925925
return 0;
926926
}
927927

‎drivers/base/dd.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
* retry them.
4646
*
4747
* 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
4949
*/
5050
static DEFINE_MUTEX(deferred_probe_mutex);
5151
static LIST_HEAD(deferred_probe_pending_list);
@@ -58,6 +58,7 @@ static struct workqueue_struct *deferred_wq;
5858
static void deferred_probe_work_func(struct work_struct *work)
5959
{
6060
struct device *dev;
61+
struct device_private *private;
6162
/*
6263
* This block processes every device in the deferred 'active' list.
6364
* 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)
7273
*/
7374
mutex_lock(&deferred_probe_mutex);
7475
while (!list_empty(&deferred_probe_active_list)) {
75-
dev = list_first_entry(&deferred_probe_active_list,
76-
typeof(*dev), deferred_probe);
77-
list_del_init(&dev->deferred_probe);
76+
private = list_first_entry(&deferred_probe_active_list,
77+
typeof(*dev->p), deferred_probe);
78+
dev = private->device;
79+
list_del_init(&private->deferred_probe);
7880

7981
get_device(dev);
8082

@@ -94,19 +96,19 @@ static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);
9496
static void driver_deferred_probe_add(struct device *dev)
9597
{
9698
mutex_lock(&deferred_probe_mutex);
97-
if (list_empty(&dev->deferred_probe)) {
99+
if (list_empty(&dev->p->deferred_probe)) {
98100
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);
100102
}
101103
mutex_unlock(&deferred_probe_mutex);
102104
}
103105

104106
void driver_deferred_probe_del(struct device *dev)
105107
{
106108
mutex_lock(&deferred_probe_mutex);
107-
if (!list_empty(&dev->deferred_probe)) {
109+
if (!list_empty(&dev->p->deferred_probe)) {
108110
dev_dbg(dev, "Removed from deferred list\n");
109-
list_del_init(&dev->deferred_probe);
111+
list_del_init(&dev->p->deferred_probe);
110112
}
111113
mutex_unlock(&deferred_probe_mutex);
112114
}

‎include/linux/device.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,6 @@ struct device_dma_parameters {
585585
* @mutex: Mutex to synchronize calls to its driver.
586586
* @bus: Type of bus device is on.
587587
* @driver: Which driver has allocated this
588-
* @deferred_probe: entry in deferred_probe_list which is used to retry the
589-
* binding of drivers which were unable to get all the resources
590-
* needed by the device; typically because it depends on another
591-
* driver getting probed first.
592588
* @platform_data: Platform data specific to the device.
593589
* Example: For devices on custom boards, as typical of embedded
594590
* and SOC based hardware, Linux often uses platform_data to point
@@ -648,7 +644,6 @@ struct device {
648644
struct bus_type *bus; /* type of bus device is on */
649645
struct device_driver *driver; /* which driver has allocated this
650646
device */
651-
struct list_head deferred_probe;
652647
void *platform_data; /* Platform specific data, device
653648
core doesn't touch it */
654649
struct dev_pm_info power;

0 commit comments

Comments
 (0)