clk: rockchip: simplify rockchip_clk_add_lookup
authorSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 18 Oct 2022 15:14:05 +0000 (17:14 +0200)
committerHeiko Stuebner <heiko@sntech.de>
Mon, 14 Nov 2022 14:35:07 +0000 (15:35 +0100)
commitff94c8660dac444081f2f650fae36a283c55b117
tree1a66a57f9ac73520ad7d2560e981f417014d2bc4
parent2004b7b1803719eaaaee5fa6b089b1699a65d31d
clk: rockchip: simplify rockchip_clk_add_lookup

rockchip_clk_add_lookup is only called from within the file,
so it can be made static. The additional checks are removed
with the following reasoning:

1. The data structure is initialized by rockchip_clk_init(),
   which is called by all rockchip platforms before the clocks
   are registered. Not doing so would result in an incomplete
   clock tree at the moment, which is a fatal error. In other
   parts of the kernel these kind of checks are usually
   omitted, so this was done here. The alternative is adding
   a pr_err to inform the kernel programmer adding a new platform
   about his incorrect code. Apart from that we are also not
   checking if the clock id is within the array boundings.

2. While not used so far by any rockchip platform, 0 is a valid
   clock identifier. To align rockchip closer to other ARM
   platforms we will start using it with rk3588.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20221018151407.63395-8-sebastian.reichel@collabora.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
drivers/clk/rockchip/clk.c
drivers/clk/rockchip/clk.h