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

clk: shmobile: div6: Make clock-output-names optional

Renesas DIV6 clocks provide a single clock output. Hence make the
"clock-output-names" DT property optional instead of mandatory. In case
the DT property is omitted the DT node name will be used.

Rename the variable "name" to "clk_name" to make the code more similar
with fixed-factor-clock.c, and to avoid a conflict with a nested local
variable while we're at it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

+7 -10
+4
Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
··· 20 20 clocks must be specified. For clocks with multiple parents, invalid 21 21 settings must be specified as "<0>". 22 22 - #clock-cells: Must be 0 23 + 24 + 25 + Optional Properties: 26 + 23 27 - clock-output-names: The name of the clock as a free-form string 24 28 25 29
+3 -10
drivers/clk/shmobile/clk-div6.c
··· 178 178 const char **parent_names; 179 179 struct clk_init_data init; 180 180 struct div6_clock *clock; 181 - const char *name; 181 + const char *clk_name = np->name; 182 182 struct clk *clk; 183 183 unsigned int i; 184 - int ret; 185 184 186 185 clock = kzalloc(sizeof(*clock), GFP_KERNEL); 187 186 if (!clock) ··· 214 215 clock->div = (clk_readl(clock->reg) & CPG_DIV6_DIV_MASK) + 1; 215 216 216 217 /* Parse the DT properties. */ 217 - ret = of_property_read_string(np, "clock-output-names", &name); 218 - if (ret < 0) { 219 - pr_err("%s: failed to get %s DIV6 clock output name\n", 220 - __func__, np->name); 221 - goto error; 222 - } 223 - 218 + of_property_read_string(np, "clock-output-names", &clk_name); 224 219 225 220 for (i = 0, valid_parents = 0; i < num_parents; i++) { 226 221 const char *name = of_clk_get_parent_name(np, i); ··· 248 255 } 249 256 250 257 /* Register the clock. */ 251 - init.name = name; 258 + init.name = clk_name; 252 259 init.ops = &cpg_div6_clock_ops; 253 260 init.flags = CLK_IS_BASIC; 254 261 init.parent_names = parent_names;