Skip to content

Commit a4c7836

Browse files
Sam Protsenkokrzk
authored andcommitted
clk: samsung: Set dev in samsung_clk_init()
Some drivers set dev to context in order to implement PM. Make that part of samsung_clk_init() instead of assigning `ctx->dev = dev' separately. No functional change. Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Link: https://lore.kernel.org/r/20230223041938.22732-4-semen.protsenko@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
1 parent 65bf1fb commit a4c7836

File tree

8 files changed

+24
-13
lines changed

8 files changed

+24
-13
lines changed

drivers/clk/samsung/clk-exynos4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ static void __init exynos4_clk_init(struct device_node *np,
12511251
if (!reg_base)
12521252
panic("%s: failed to map registers\n", __func__);
12531253

1254-
ctx = samsung_clk_init(reg_base, CLK_NR_CLKS);
1254+
ctx = samsung_clk_init(NULL, reg_base, CLK_NR_CLKS);
12551255
hws = ctx->clk_data.hws;
12561256

12571257
samsung_clk_of_register_fixed_ext(ctx, exynos4_fixed_rate_ext_clks,

drivers/clk/samsung/clk-exynos4412-isp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ static int __init exynos4x12_isp_clk_probe(struct platform_device *pdev)
121121
if (!exynos4x12_save_isp)
122122
return -ENOMEM;
123123

124-
ctx = samsung_clk_init(reg_base, CLK_NR_ISP_CLKS);
125-
ctx->dev = dev;
124+
ctx = samsung_clk_init(dev, reg_base, CLK_NR_ISP_CLKS);
126125

127126
platform_set_drvdata(pdev, ctx);
128127

drivers/clk/samsung/clk-exynos5250.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ static void __init exynos5250_clk_init(struct device_node *np)
797797
panic("%s: unable to determine soc\n", __func__);
798798
}
799799

800-
ctx = samsung_clk_init(reg_base, CLK_NR_CLKS);
800+
ctx = samsung_clk_init(NULL, reg_base, CLK_NR_CLKS);
801801
hws = ctx->clk_data.hws;
802802

803803
samsung_clk_of_register_fixed_ext(ctx, exynos5250_fixed_rate_ext_clks,

drivers/clk/samsung/clk-exynos5420.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ static void __init exynos5x_clk_init(struct device_node *np,
15871587

15881588
exynos5x_soc = soc;
15891589

1590-
ctx = samsung_clk_init(reg_base, CLK_NR_CLKS);
1590+
ctx = samsung_clk_init(NULL, reg_base, CLK_NR_CLKS);
15911591
hws = ctx->clk_data.hws;
15921592

15931593
samsung_clk_of_register_fixed_ext(ctx, exynos5x_fixed_rate_ext_clks,

drivers/clk/samsung/clk-s3c64xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
405405
panic("%s: failed to map registers\n", __func__);
406406
}
407407

408-
ctx = samsung_clk_init(reg_base, NR_CLKS);
408+
ctx = samsung_clk_init(NULL, reg_base, NR_CLKS);
409409
hws = ctx->clk_data.hws;
410410

411411
/* Register external clocks. */

drivers/clk/samsung/clk-s5pv210.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ static void __init __s5pv210_clk_init(struct device_node *np,
743743
struct samsung_clk_provider *ctx;
744744
struct clk_hw **hws;
745745

746-
ctx = samsung_clk_init(reg_base, NR_CLKS);
746+
ctx = samsung_clk_init(NULL, reg_base, NR_CLKS);
747747
hws = ctx->clk_data.hws;
748748

749749
samsung_clk_register_mux(ctx, early_mux_clks,

drivers/clk/samsung/clk.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,19 @@ struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
5353
return rd;
5454
}
5555

56-
/* setup the essentials required to support clock lookup using ccf */
57-
struct samsung_clk_provider * __init samsung_clk_init(void __iomem *base,
58-
unsigned long nr_clks)
56+
/**
57+
* samsung_clk_init() - Create and initialize a clock provider object
58+
* @dev: CMU device to enable runtime PM, or NULL if RPM is not needed
59+
* @base: Start address (mapped) of CMU registers
60+
* @nr_clks: Total clock count to allocate in clock provider object
61+
*
62+
* Setup the essentials required to support clock lookup using Common Clock
63+
* Framework.
64+
*
65+
* Return: Allocated and initialized clock provider object.
66+
*/
67+
struct samsung_clk_provider * __init samsung_clk_init(struct device *dev,
68+
void __iomem *base, unsigned long nr_clks)
5969
{
6070
struct samsung_clk_provider *ctx;
6171
int i;
@@ -67,6 +77,7 @@ struct samsung_clk_provider * __init samsung_clk_init(void __iomem *base,
6777
for (i = 0; i < nr_clks; ++i)
6878
ctx->clk_data.hws[i] = ERR_PTR(-ENOENT);
6979

80+
ctx->dev = dev;
7081
ctx->reg_base = base;
7182
ctx->clk_data.num = nr_clks;
7283
spin_lock_init(&ctx->lock);
@@ -341,7 +352,7 @@ struct samsung_clk_provider * __init samsung_cmu_register_one(
341352
return NULL;
342353
}
343354

344-
ctx = samsung_clk_init(reg_base, cmu->nr_clk_ids);
355+
ctx = samsung_clk_init(NULL, reg_base, cmu->nr_clk_ids);
345356

346357
if (cmu->pll_clks)
347358
samsung_clk_register_pll(ctx, cmu->pll_clks, cmu->nr_pll_clks);

drivers/clk/samsung/clk.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/**
1717
* struct samsung_clk_provider: information about clock provider
1818
* @reg_base: virtual address for the register base.
19+
* @dev: clock provider device needed for runtime PM.
1920
* @lock: maintains exclusion between callbacks for a given clock-provider.
2021
* @clk_data: holds clock related data like clk_hw* and number of clocks.
2122
*/
@@ -337,8 +338,8 @@ struct samsung_cmu_info {
337338
const char *clk_name;
338339
};
339340

340-
struct samsung_clk_provider *samsung_clk_init(void __iomem *base,
341-
unsigned long nr_clks);
341+
struct samsung_clk_provider *samsung_clk_init(struct device *dev,
342+
void __iomem *base, unsigned long nr_clks);
342343
void samsung_clk_of_add_provider(struct device_node *np,
343344
struct samsung_clk_provider *ctx);
344345
void samsung_clk_of_register_fixed_ext(

0 commit comments

Comments
 (0)