Revert "Revert "driver core: Set fw_devlink=on by default""
[linux-2.6-microblaze.git] / drivers / base / core.c
index f298393..de51817 100644 (file)
@@ -1153,6 +1153,41 @@ static ssize_t waiting_for_supplier_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(waiting_for_supplier);
 
+/**
+ * device_links_force_bind - Prepares device to be force bound
+ * @dev: Consumer device.
+ *
+ * device_bind_driver() force binds a device to a driver without calling any
+ * driver probe functions. So the consumer really isn't going to wait for any
+ * supplier before it's bound to the driver. We still want the device link
+ * states to be sensible when this happens.
+ *
+ * In preparation for device_bind_driver(), this function goes through each
+ * supplier device links and checks if the supplier is bound. If it is, then
+ * the device link status is set to CONSUMER_PROBE. Otherwise, the device link
+ * is dropped. Links without the DL_FLAG_MANAGED flag set are ignored.
+ */
+void device_links_force_bind(struct device *dev)
+{
+       struct device_link *link, *ln;
+
+       device_links_write_lock();
+
+       list_for_each_entry_safe(link, ln, &dev->links.suppliers, c_node) {
+               if (!(link->flags & DL_FLAG_MANAGED))
+                       continue;
+
+               if (link->status != DL_STATE_AVAILABLE) {
+                       device_link_drop_managed(link);
+                       continue;
+               }
+               WRITE_ONCE(link->status, DL_STATE_CONSUMER_PROBE);
+       }
+       dev->links.status = DL_DEV_PROBING;
+
+       device_links_write_unlock();
+}
+
 /**
  * device_links_driver_bound - Update device links after probing its driver.
  * @dev: Device to update the links for.
@@ -1503,7 +1538,7 @@ static void device_links_purge(struct device *dev)
 #define FW_DEVLINK_FLAGS_RPM           (FW_DEVLINK_FLAGS_ON | \
                                         DL_FLAG_PM_RUNTIME)
 
-static u32 fw_devlink_flags = FW_DEVLINK_FLAGS_PERMISSIVE;
+static u32 fw_devlink_flags = FW_DEVLINK_FLAGS_ON;
 static int __init fw_devlink_setup(char *arg)
 {
        if (!arg)