Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: divider: fix initialization with parent_hw

If a driver registers a divider clock with a parent_hw instead of the
parent_name, the parent_hw is ignored and the clock does not have a
parent.

Fix this by initializing the parents the same way they are initialized
for clock gates.

Fixes: ff258817137a ("clk: divider: Add support for specifying parents via DT/pointers")
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/20210121071659.1226489-3-m.tretter@pengutronix.de
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Michael Tretter and committed by
Stephen Boyd
0225daea bc6b9dc7

+7 -2
+7 -2
drivers/clk/clk-divider.c
··· 494 494 else 495 495 init.ops = &clk_divider_ops; 496 496 init.flags = flags; 497 - init.parent_names = (parent_name ? &parent_name: NULL); 498 - init.num_parents = (parent_name ? 1 : 0); 497 + init.parent_names = parent_name ? &parent_name : NULL; 498 + init.parent_hws = parent_hw ? &parent_hw : NULL; 499 + init.parent_data = parent_data; 500 + if (parent_name || parent_hw || parent_data) 501 + init.num_parents = 1; 502 + else 503 + init.num_parents = 0; 499 504 500 505 /* struct clk_divider assignments */ 501 506 div->reg = reg;