]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/hwspinlock.git/commit
clk: keystone: sci-clk: Fix sci_clk_get
authorTero Kristo <t-kristo@ti.com>
Wed, 2 Aug 2017 18:32:13 +0000 (21:32 +0300)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 3 Aug 2017 01:37:26 +0000 (18:37 -0700)
commitf54d2cd3c1a231e00732442fca329341d4f4250b
tree0ae71b439ea33367eb09bb2f6606c4a384969076
parent5c0858f12bbdbc9c69fc36ce7b509596df145600
clk: keystone: sci-clk: Fix sci_clk_get

Currently a bug in the sci_clk_get implementation causes it to always
return a clock belonging to the last device in the static list of clock
data. This is due to a bug in the init code that causes the array
used by sci_clk_get to only be populated with the clocks for the last
device, as each device overwrites the entire array with its own clocks.

Fix this by calculating the actual number of clocks for the SoC, and
allocating the whole array in one go. Also, we don't need the handle
to the init data array anymore after doing this, instead we can
just compare the dev_id / clk_id against the registered clocks and
use binary search for speed.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reported-by: Dave Gerlach <d-gerlach@ti.com>
Fixes: b745c0794e2f ("clk: keystone: Add sci-clk driver support")
Cc: Nishanth Menon <nm@ti.com>
Tested-by: Franklin Cooper <fcooper@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/keystone/sci-clk.c