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

clk: nomadik: Migrate to clk_hw based OF and registration APIs

Now that we have clk_hw based provider APIs to register clks, we
can get rid of struct clk pointers while registering clks in
these drivers, allowing us to move closer to a clear split of
consumer and provider clk APIs.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Stephen Boyd and committed by
Stephen Boyd
7b38d1b2 8e66cc05

+26 -22
+26 -22
drivers/clk/clk-nomadik.c
··· 253 253 .recalc_rate = pll_clk_recalc_rate, 254 254 }; 255 255 256 - static struct clk * __init 256 + static struct clk_hw * __init 257 257 pll_clk_register(struct device *dev, const char *name, 258 258 const char *parent_name, u32 id) 259 259 { 260 - struct clk *clk; 260 + int ret; 261 261 struct clk_pll *pll; 262 262 struct clk_init_data init; 263 263 ··· 281 281 282 282 pr_debug("register PLL1 clock \"%s\"\n", name); 283 283 284 - clk = clk_register(dev, &pll->hw); 285 - if (IS_ERR(clk)) 284 + ret = clk_hw_register(dev, &pll->hw); 285 + if (ret) { 286 286 kfree(pll); 287 + return ERR_PTR(ret); 288 + } 287 289 288 - return clk; 290 + return &pll->hw; 289 291 } 290 292 291 293 /* ··· 347 345 .recalc_rate = src_clk_recalc_rate, 348 346 }; 349 347 350 - static struct clk * __init 348 + static struct clk_hw * __init 351 349 src_clk_register(struct device *dev, const char *name, 352 350 const char *parent_name, u8 id) 353 351 { 354 - struct clk *clk; 352 + int ret; 355 353 struct clk_src *sclk; 356 354 struct clk_init_data init; 357 355 ··· 378 376 pr_debug("register clock \"%s\" ID: %d group: %d bits: %08x\n", 379 377 name, id, sclk->group1, sclk->clkbit); 380 378 381 - clk = clk_register(dev, &sclk->hw); 382 - if (IS_ERR(clk)) 379 + ret = clk_hw_register(dev, &sclk->hw); 380 + if (ret) { 383 381 kfree(sclk); 382 + return ERR_PTR(ret); 383 + } 384 384 385 - return clk; 385 + return &sclk->hw; 386 386 } 387 387 388 388 #ifdef CONFIG_DEBUG_FS ··· 512 508 513 509 static void __init of_nomadik_pll_setup(struct device_node *np) 514 510 { 515 - struct clk *clk = ERR_PTR(-EINVAL); 511 + struct clk_hw *hw; 516 512 const char *clk_name = np->name; 517 513 const char *parent_name; 518 514 u32 pll_id; ··· 526 522 return; 527 523 } 528 524 parent_name = of_clk_get_parent_name(np, 0); 529 - clk = pll_clk_register(NULL, clk_name, parent_name, pll_id); 530 - if (!IS_ERR(clk)) 531 - of_clk_add_provider(np, of_clk_src_simple_get, clk); 525 + hw = pll_clk_register(NULL, clk_name, parent_name, pll_id); 526 + if (!IS_ERR(hw)) 527 + of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); 532 528 } 533 529 CLK_OF_DECLARE(nomadik_pll_clk, 534 530 "st,nomadik-pll-clock", of_nomadik_pll_setup); 535 531 536 532 static void __init of_nomadik_hclk_setup(struct device_node *np) 537 533 { 538 - struct clk *clk = ERR_PTR(-EINVAL); 534 + struct clk_hw *hw; 539 535 const char *clk_name = np->name; 540 536 const char *parent_name; 541 537 ··· 546 542 /* 547 543 * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4. 548 544 */ 549 - clk = clk_register_divider(NULL, clk_name, parent_name, 545 + hw = clk_hw_register_divider(NULL, clk_name, parent_name, 550 546 0, src_base + SRC_CR, 551 547 13, 2, 552 548 CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, 553 549 &src_lock); 554 - if (!IS_ERR(clk)) 555 - of_clk_add_provider(np, of_clk_src_simple_get, clk); 550 + if (!IS_ERR(hw)) 551 + of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); 556 552 } 557 553 CLK_OF_DECLARE(nomadik_hclk_clk, 558 554 "st,nomadik-hclk-clock", of_nomadik_hclk_setup); 559 555 560 556 static void __init of_nomadik_src_clk_setup(struct device_node *np) 561 557 { 562 - struct clk *clk = ERR_PTR(-EINVAL); 558 + struct clk_hw *hw; 563 559 const char *clk_name = np->name; 564 560 const char *parent_name; 565 561 u32 clk_id; ··· 573 569 return; 574 570 } 575 571 parent_name = of_clk_get_parent_name(np, 0); 576 - clk = src_clk_register(NULL, clk_name, parent_name, clk_id); 577 - if (!IS_ERR(clk)) 578 - of_clk_add_provider(np, of_clk_src_simple_get, clk); 572 + hw = src_clk_register(NULL, clk_name, parent_name, clk_id); 573 + if (!IS_ERR(hw)) 574 + of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); 579 575 } 580 576 CLK_OF_DECLARE(nomadik_src_clk, 581 577 "st,nomadik-src-clock", of_nomadik_src_clk_setup);