clk: rockchip: fix deadlock possibility in cpuclk
authorHeiko Stübner <heiko@sntech.de>
Fri, 16 Jan 2015 16:52:44 +0000 (17:52 +0100)
committerMichael Turquette <mturquette@linaro.org>
Sat, 17 Jan 2015 19:22:39 +0000 (11:22 -0800)
commita5e1baf7dca10f8cf945394034013260297bc416
treef0c356cefcfa6d70d450323b56f46d20f88790c9
parentb71e8ecd57c8aae5b1815782c47b74ffe3efc09a
clk: rockchip: fix deadlock possibility in cpuclk

Lockdep reported a possible deadlock between the cpuclk lock and for example
the i2c driver.

       CPU0                    CPU1
       ----                    ----
  lock(clk_lock);
                               local_irq_disable();
                               lock(&(&i2c->lock)->rlock);
                               lock(clk_lock);
  <Interrupt>
    lock(&(&i2c->lock)->rlock);

 *** DEADLOCK ***

The generic clock-types of the core ccf already use spin_lock_irqsave when
touching clock registers, so do the same for the cpuclk.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
[mturquette@linaro.org: removed initialization of "flags"]
drivers/clk/rockchip/clk-cpu.c