component: move check for unbound master into try_to_bring_up_masters()
[deliverable/linux.git] / drivers / base / component.c
index f748430bb654154918ae67984405021835f44ec8..cd70b68d978013c16378ee2f3ff3f2328da0c2eb 100644 (file)
@@ -84,7 +84,7 @@ static void component_detach_master(struct master *master, struct component *c)
  * function and compare data.  This is safe to call for duplicate matches
  * and will not result in the same component being added multiple times.
  */
-int component_master_add_child(struct master *master,
+static int component_master_add_child(struct master *master,
        int (*compare)(struct device *, void *), void *compare_data)
 {
        struct component *c;
@@ -104,7 +104,6 @@ int component_master_add_child(struct master *master,
 
        return ret;
 }
-EXPORT_SYMBOL_GPL(component_master_add_child);
 
 static int find_components(struct master *master)
 {
@@ -112,14 +111,6 @@ static int find_components(struct master *master)
        size_t i;
        int ret = 0;
 
-       if (!match) {
-               /*
-                * Search the list of components, looking for components that
-                * belong to this master, and attach them to the master.
-                */
-               return master->ops->add_components(master->dev, master);
-       }
-
        /*
         * Scan the array of match functions and attach
         * any components which are found to this master.
@@ -159,13 +150,6 @@ static int try_to_bring_up_master(struct master *master,
 {
        int ret;
 
-       if (master->bound)
-               return 0;
-
-       /*
-        * Search the list of components, looking for components that
-        * belong to this master, and attach them to the master.
-        */
        if (find_components(master)) {
                /* Failed to find all components */
                ret = 0;
@@ -205,9 +189,11 @@ static int try_to_bring_up_masters(struct component *component)
        int ret = 0;
 
        list_for_each_entry(m, &masters, node) {
-               ret = try_to_bring_up_master(m, component);
-               if (ret != 0)
-                       break;
+               if (!m->bound) {
+                       ret = try_to_bring_up_master(m, component);
+                       if (ret != 0)
+                               break;
+               }
        }
 
        return ret;
@@ -290,15 +276,10 @@ int component_master_add_with_match(struct device *dev,
        struct master *master;
        int ret;
 
-       if (ops->add_components && match)
-               return -EINVAL;
-
-       if (match) {
-               /* Reallocate the match array for its true size */
-               match = component_match_realloc(dev, match, match->num);
-               if (IS_ERR(match))
-                       return PTR_ERR(match);
-       }
+       /* Reallocate the match array for its true size */
+       match = component_match_realloc(dev, match, match->num);
+       if (IS_ERR(match))
+               return PTR_ERR(match);
 
        master = kzalloc(sizeof(*master), GFP_KERNEL);
        if (!master)
@@ -326,13 +307,6 @@ int component_master_add_with_match(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(component_master_add_with_match);
 
-int component_master_add(struct device *dev,
-       const struct component_master_ops *ops)
-{
-       return component_master_add_with_match(dev, ops, NULL);
-}
-EXPORT_SYMBOL_GPL(component_master_add);
-
 void component_master_del(struct device *dev,
        const struct component_master_ops *ops)
 {
This page took 0.025016 seconds and 5 git commands to generate.