Revert "driver core: Add sync_state driver/bus callback"
This reverts commit 8f8184d6bf
.
Based on a lot of email and in-person discussions, this patch series is
being reworked to address a number of issues that were pointed out that
needed to be taken care of before it should be merged. It will be
resubmitted with those changes hopefully soon.
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -46,8 +46,6 @@ early_param("sysfs.deprecated", sysfs_deprecated_setup);
|
||||
/* Device links support. */
|
||||
static LIST_HEAD(wait_for_suppliers);
|
||||
static DEFINE_MUTEX(wfs_lock);
|
||||
static LIST_HEAD(deferred_sync);
|
||||
static unsigned int supplier_sync_state_disabled;
|
||||
|
||||
#ifdef CONFIG_SRCU
|
||||
static DEFINE_MUTEX(device_links_lock);
|
||||
@@ -653,62 +651,6 @@ int device_links_check_suppliers(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __device_links_supplier_sync_state(struct device *dev)
|
||||
{
|
||||
struct device_link *link;
|
||||
|
||||
if (dev->state_synced)
|
||||
return;
|
||||
|
||||
list_for_each_entry(link, &dev->links.consumers, s_node) {
|
||||
if (!(link->flags & DL_FLAG_MANAGED))
|
||||
continue;
|
||||
if (link->status != DL_STATE_ACTIVE)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dev->bus->sync_state)
|
||||
dev->bus->sync_state(dev);
|
||||
else if (dev->driver && dev->driver->sync_state)
|
||||
dev->driver->sync_state(dev);
|
||||
|
||||
dev->state_synced = true;
|
||||
}
|
||||
|
||||
void device_links_supplier_sync_state_pause(void)
|
||||
{
|
||||
device_links_write_lock();
|
||||
supplier_sync_state_disabled++;
|
||||
device_links_write_unlock();
|
||||
}
|
||||
|
||||
void device_links_supplier_sync_state_resume(void)
|
||||
{
|
||||
struct device *dev, *tmp;
|
||||
|
||||
device_links_write_lock();
|
||||
if (!supplier_sync_state_disabled) {
|
||||
WARN(true, "Unmatched sync_state pause/resume!");
|
||||
goto out;
|
||||
}
|
||||
supplier_sync_state_disabled--;
|
||||
if (supplier_sync_state_disabled)
|
||||
goto out;
|
||||
|
||||
list_for_each_entry_safe(dev, tmp, &deferred_sync, links.defer_sync) {
|
||||
__device_links_supplier_sync_state(dev);
|
||||
list_del_init(&dev->links.defer_sync);
|
||||
}
|
||||
out:
|
||||
device_links_write_unlock();
|
||||
}
|
||||
|
||||
static void __device_links_supplier_defer_sync(struct device *sup)
|
||||
{
|
||||
if (list_empty(&sup->links.defer_sync))
|
||||
list_add_tail(&sup->links.defer_sync, &deferred_sync);
|
||||
}
|
||||
|
||||
/**
|
||||
* device_links_driver_bound - Update device links after probing its driver.
|
||||
* @dev: Device to update the links for.
|
||||
@@ -753,11 +695,6 @@ void device_links_driver_bound(struct device *dev)
|
||||
|
||||
WARN_ON(link->status != DL_STATE_CONSUMER_PROBE);
|
||||
WRITE_ONCE(link->status, DL_STATE_ACTIVE);
|
||||
|
||||
if (supplier_sync_state_disabled)
|
||||
__device_links_supplier_defer_sync(link->supplier);
|
||||
else
|
||||
__device_links_supplier_sync_state(link->supplier);
|
||||
}
|
||||
|
||||
dev->links.status = DL_DEV_DRIVER_BOUND;
|
||||
@@ -874,7 +811,6 @@ void device_links_driver_cleanup(struct device *dev)
|
||||
WRITE_ONCE(link->status, DL_STATE_DORMANT);
|
||||
}
|
||||
|
||||
list_del_init(&dev->links.defer_sync);
|
||||
__device_links_no_driver(dev);
|
||||
|
||||
device_links_write_unlock();
|
||||
@@ -1849,7 +1785,6 @@ void device_initialize(struct device *dev)
|
||||
INIT_LIST_HEAD(&dev->links.consumers);
|
||||
INIT_LIST_HEAD(&dev->links.suppliers);
|
||||
INIT_LIST_HEAD(&dev->links.needs_suppliers);
|
||||
INIT_LIST_HEAD(&dev->links.defer_sync);
|
||||
dev->links.status = DL_DEV_NO_DRIVER;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_initialize);
|
||||
|
Reference in New Issue
Block a user