omap: clock: Check for enable/disable ops support
authorRajendra Nayak <rnayak@ti.com>
Fri, 25 Feb 2011 22:48:36 +0000 (15:48 -0700)
committerPaul Walmsley <paul@pwsan.com>
Fri, 25 Feb 2011 23:09:52 +0000 (16:09 -0700)
Check if enable/disable operations are supported for a given
clock node before attempting to call them.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
arch/arm/mach-omap2/clock.c

index e9625fc..b187596 100644 (file)
@@ -261,7 +261,8 @@ void omap2_clk_disable(struct clk *clk)
 
        pr_debug("clock: %s: disabling in hardware\n", clk->name);
 
-       clk->ops->disable(clk);
+       if (clk->ops && clk->ops->disable)
+               clk->ops->disable(clk);
 
        if (clk->clkdm)
                clkdm_clk_disable(clk->clkdm, clk);
@@ -312,10 +313,13 @@ int omap2_clk_enable(struct clk *clk)
                }
        }
 
-       ret = clk->ops->enable(clk);
-       if (ret) {
-               WARN(1, "clock: %s: could not enable: %d\n", clk->name, ret);
-               goto oce_err3;
+       if (clk->ops && clk->ops->enable) {
+               ret = clk->ops->enable(clk);
+               if (ret) {
+                       WARN(1, "clock: %s: could not enable: %d\n",
+                            clk->name, ret);
+                       goto oce_err3;
+               }
        }
 
        return 0;