]> git.hungrycats.org Git - linux/commit
clk: rockchip: fix deadlock possibility in cpuclk
authorHeiko Stübner <heiko@sntech.de>
Fri, 16 Jan 2015 16:52:44 +0000 (17:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Nov 2018 15:39:17 +0000 (07:39 -0800)
commitdb03188bc33b11d6526526c5af8841e77bc1c16c
treedf1ffd064da13a5a546c9363fb623112d8de0321
parent65afec84308b20f6107e60c3302aae1cdf7f2ee2
clk: rockchip: fix deadlock possibility in cpuclk

[ Upstream commit a5e1baf7dca10f8cf945394034013260297bc416 ]

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"]
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/rockchip/clk-cpu.c