OMAP clock: add omap_clk_get_by_name() for use by OMAP hwmod core code
[pandora-kernel.git] / arch / arm / plat-omap / clock.c
index f244b17..6cc13e7 100644 (file)
@@ -313,6 +313,33 @@ void clk_enable_init_clocks(void)
        }
 }
 
+/**
+ * omap_clk_get_by_name - locate OMAP struct clk by its name
+ * @name: name of the struct clk to locate
+ *
+ * Locate an OMAP struct clk by its name.  Assumes that struct clk
+ * names are unique.  Returns NULL if not found or a pointer to the
+ * struct clk if found.
+ */
+struct clk *omap_clk_get_by_name(const char *name)
+{
+       struct clk *c;
+       struct clk *ret = NULL;
+
+       mutex_lock(&clocks_mutex);
+
+       list_for_each_entry(c, &clocks, node) {
+               if (!strcmp(c->name, name)) {
+                       ret = c;
+                       break;
+               }
+       }
+
+       mutex_unlock(&clocks_mutex);
+
+       return ret;
+}
+
 /*
  * Low level helpers
  */