]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Revert "driver core: Add edit_links() callback for drivers"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Aug 2019 19:41:06 +0000 (21:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Aug 2019 19:41:06 +0000 (21:41 +0200)
This reverts commit 134b23eec9e3a3c795a6ceb0efe2fa63e87983b2.

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>
drivers/base/core.c
drivers/base/dd.c
include/linux/device.h

index de775c7a4d7c10528f9ec1c06ef6432fd638cedc..605905de0ccaae821594dca23a7f5b4eb35605b8 100644 (file)
@@ -439,19 +439,6 @@ static void device_link_wait_for_supplier(struct device *consumer)
        mutex_unlock(&wfs_lock);
 }
 
-/**
- * device_link_remove_from_wfs - Unmark device as waiting for supplier
- * @consumer: Consumer device
- *
- * Unmark the consumer device as waiting for suppliers to become available.
- */
-void device_link_remove_from_wfs(struct device *consumer)
-{
-       mutex_lock(&wfs_lock);
-       list_del_init(&consumer->links.needs_suppliers);
-       mutex_unlock(&wfs_lock);
-}
-
 /**
  * device_link_check_waiting_consumers - Try to unmark waiting consumers
  *
@@ -469,19 +456,12 @@ void device_link_remove_from_wfs(struct device *consumer)
 static void device_link_check_waiting_consumers(void)
 {
        struct device *dev, *tmp;
-       int ret;
 
        mutex_lock(&wfs_lock);
        list_for_each_entry_safe(dev, tmp, &wait_for_suppliers,
-                                links.needs_suppliers) {
-               ret = 0;
-               if (dev->has_edit_links)
-                       ret = driver_edit_links(dev);
-               else if (dev->bus->add_links)
-                       ret = dev->bus->add_links(dev);
-               if (!ret)
+                                links.needs_suppliers)
+               if (!dev->bus->add_links(dev))
                        list_del_init(&dev->links.needs_suppliers);
-       }
        mutex_unlock(&wfs_lock);
 }
 
index 55fbc2467b37509ffb444935691313d84779e17f..d811e60610d33ae952efacc2db3ce9fb47349a5e 100644 (file)
@@ -710,12 +710,6 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
        pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
                 drv->bus->name, __func__, dev_name(dev), drv->name);
 
-       if (drv->edit_links) {
-               if (drv->edit_links(dev))
-                       dev->has_edit_links = true;
-               else
-                       device_link_remove_from_wfs(dev);
-       }
        pm_runtime_get_suppliers(dev);
        if (dev->parent)
                pm_runtime_get_sync(dev->parent);
@@ -804,29 +798,6 @@ struct device_attach_data {
        bool have_async;
 };
 
-static int __driver_edit_links(struct device_driver *drv, void *data)
-{
-       struct device *dev = data;
-
-       if (!drv->edit_links)
-               return 0;
-
-       if (driver_match_device(drv, dev) <= 0)
-               return 0;
-
-       return drv->edit_links(dev);
-}
-
-int driver_edit_links(struct device *dev)
-{
-       int ret;
-
-       device_lock(dev);
-       ret = bus_for_each_drv(dev->bus, NULL, dev, __driver_edit_links);
-       device_unlock(dev);
-       return ret;
-}
-
 static int __device_attach_driver(struct device_driver *drv, void *_data)
 {
        struct device_attach_data *data = _data;
index 90142ec9ce8417686cd1263ec4868bb6d49297e7..73210745cc6b38d6f79feaf1aa63e485e62c82e7 100644 (file)
@@ -349,20 +349,6 @@ enum probe_type {
  * @probe_type:        Type of the probe (synchronous or asynchronous) to use.
  * @of_match_table: The open firmware table.
  * @acpi_match_table: The ACPI match table.
- * @edit_links:        Called to allow a matched driver to edit the device links the
- *             bus might have added incorrectly. This will be useful to handle
- *             cases where the bus incorrectly adds functional dependencies
- *             that aren't true or tries to create cyclic dependencies. But
- *             doesn't correctly handle functional dependencies that are
- *             missed by the bus as the supplier's sync_state might get to
- *             execute before the driver for a missing consumer is loaded and
- *             gets to edit the device links for the consumer.
- *
- *             This function might be called multiple times after a new device
- *             is added.  The function is expected to create all the device
- *             links for the new device and return 0 if it was completed
- *             successfully or return an error if it needs to be reattempted
- *             in the future.
  * @probe:     Called to query the existence of a specific device,
  *             whether this driver can work with it, and bind the driver
  *             to a specific device.
@@ -404,7 +390,6 @@ struct device_driver {
        const struct of_device_id       *of_match_table;
        const struct acpi_device_id     *acpi_match_table;
 
-       int (*edit_links)(struct device *dev);
        int (*probe) (struct device *dev);
        int (*remove) (struct device *dev);
        void (*shutdown) (struct device *dev);
@@ -1240,8 +1225,6 @@ struct dev_links_info {
  * @offline:   Set after successful invocation of bus type's .offline().
  * @of_node_reused: Set if the device-tree node is shared with an ancestor
  *              device.
- * @has_edit_links: This device has a driver than is capable of
- *                 editing the device links created by driver core.
  * @dma_coherent: this particular device is dma coherent, even if the
  *             architecture supports non-coherent devices.
  *
@@ -1338,7 +1321,6 @@ struct device {
        bool                    offline_disabled:1;
        bool                    offline:1;
        bool                    of_node_reused:1;
-       bool                    has_edit_links:1;
 #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
     defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
     defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
@@ -1590,7 +1572,6 @@ extern int  __must_check device_attach(struct device *dev);
 extern int __must_check driver_attach(struct device_driver *drv);
 extern void device_initial_probe(struct device *dev);
 extern int __must_check device_reprobe(struct device *dev);
-extern int driver_edit_links(struct device *dev);
 
 extern bool device_is_bound(struct device *dev);
 
@@ -1682,7 +1663,6 @@ struct device_link *device_link_add(struct device *consumer,
                                    struct device *supplier, u32 flags);
 void device_link_del(struct device_link *link);
 void device_link_remove(void *consumer, struct device *supplier);
-void device_link_remove_from_wfs(struct device *consumer);
 
 #ifndef dev_fmt
 #define dev_fmt(fmt) fmt