linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] clk: samsung: Move struct samsung_cmu_info to init section
@ 2016-08-22  2:49 Chanwoo Choi
  2016-08-22  2:49 ` [PATCH 1/2] clk: samsung: exynos5260: " Chanwoo Choi
  2016-08-22  2:49 ` [PATCH 2/2] clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code Chanwoo Choi
  0 siblings, 2 replies; 13+ messages in thread
From: Chanwoo Choi @ 2016-08-22  2:49 UTC (permalink / raw)
  To: s.nawrocki, tomasz.figa
  Cc: mturquette, sboyd, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel,
	Chanwoo Choi

This patchset moves the struct samsung_cmu_info to init section for
exynos5260/5410 because they are used only in initconst section.

Chanwoo Choi (2):
  clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code

 drivers/clk/samsung/clk-exynos5260.c | 350 +++++++++++++++++------------------
 drivers/clk/samsung/clk-exynos5410.c |  33 ++--
 2 files changed, 188 insertions(+), 195 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-22  2:49 [PATCH 0/2] clk: samsung: Move struct samsung_cmu_info to init section Chanwoo Choi
@ 2016-08-22  2:49 ` Chanwoo Choi
  2016-08-23  0:55   ` Stephen Boyd
  2016-09-01 17:06   ` Sylwester Nawrocki
  2016-08-22  2:49 ` [PATCH 2/2] clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code Chanwoo Choi
  1 sibling, 2 replies; 13+ messages in thread
From: Chanwoo Choi @ 2016-08-22  2:49 UTC (permalink / raw)
  To: s.nawrocki, tomasz.figa
  Cc: mturquette, sboyd, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel,
	Chanwoo Choi

This patch moves the all samsung_cmu_info struct to initconst section
because they are used only in initconst section.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/clk/samsung/clk-exynos5260.c | 350 +++++++++++++++++------------------
 1 file changed, 175 insertions(+), 175 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5260.c b/drivers/clk/samsung/clk-exynos5260.c
index a43642c36039..fd1d9bfc151b 100644
--- a/drivers/clk/samsung/clk-exynos5260.c
+++ b/drivers/clk/samsung/clk-exynos5260.c
@@ -131,21 +131,21 @@ static const struct samsung_gate_clock aud_gate_clks[] __initconst = {
 			EN_IP_AUD, 4, 0, 0),
 };
 
+static const struct samsung_cmu_info aud_cmu __initconst = {
+	.mux_clks	= aud_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(aud_mux_clks),
+	.div_clks	= aud_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(aud_div_clks),
+	.gate_clks	= aud_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(aud_gate_clks),
+	.nr_clk_ids	= AUD_NR_CLK,
+	.clk_regs	= aud_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(aud_clk_regs),
+};
+
 static void __init exynos5260_clk_aud_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.mux_clks = aud_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(aud_mux_clks);
-	cmu.div_clks = aud_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(aud_div_clks);
-	cmu.gate_clks = aud_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(aud_gate_clks);
-	cmu.nr_clk_ids = AUD_NR_CLK;
-	cmu.clk_regs = aud_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(aud_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &aud_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_aud, "samsung,exynos5260-clock-aud",
@@ -321,21 +321,21 @@ static const struct samsung_gate_clock disp_gate_clks[] __initconst = {
 			EN_IP_DISP, 25, 0, 0),
 };
 
+static const struct samsung_cmu_info disp_cmu __initconst = {
+	.mux_clks	= disp_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(disp_mux_clks),
+	.div_clks	= disp_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(disp_div_clks),
+	.gate_clks	= disp_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(disp_gate_clks),
+	.nr_clk_ids	= DISP_NR_CLK,
+	.clk_regs	= disp_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(disp_clk_regs),
+};
+
 static void __init exynos5260_clk_disp_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.mux_clks = disp_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(disp_mux_clks);
-	cmu.div_clks = disp_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(disp_div_clks);
-	cmu.gate_clks = disp_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(disp_gate_clks);
-	cmu.nr_clk_ids = DISP_NR_CLK;
-	cmu.clk_regs = disp_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(disp_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &disp_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_disp, "samsung,exynos5260-clock-disp",
@@ -385,21 +385,21 @@ static const struct samsung_pll_clock egl_pll_clks[] __initconst = {
 		pll2550_24mhz_tbl),
 };
 
+static const struct samsung_cmu_info egl_cmu __initconst = {
+	.pll_clks	= egl_pll_clks,
+	.nr_pll_clks	= ARRAY_SIZE(egl_pll_clks),
+	.mux_clks	= egl_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(egl_mux_clks),
+	.div_clks	= egl_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(egl_div_clks),
+	.nr_clk_ids	= EGL_NR_CLK,
+	.clk_regs	= egl_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(egl_clk_regs),
+};
+
 static void __init exynos5260_clk_egl_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.pll_clks = egl_pll_clks;
-	cmu.nr_pll_clks =  ARRAY_SIZE(egl_pll_clks);
-	cmu.mux_clks = egl_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(egl_mux_clks);
-	cmu.div_clks = egl_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(egl_div_clks);
-	cmu.nr_clk_ids = EGL_NR_CLK;
-	cmu.clk_regs = egl_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(egl_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &egl_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_egl, "samsung,exynos5260-clock-egl",
@@ -487,19 +487,19 @@ static const struct samsung_gate_clock fsys_gate_clks[] __initconst = {
 			EN_IP_FSYS_SECURE_SMMU_RTIC, 12, 0, 0),
 };
 
+static const struct samsung_cmu_info fsys_cmu __initconst = {
+	.mux_clks	= fsys_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(fsys_mux_clks),
+	.gate_clks	= fsys_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(fsys_gate_clks),
+	.nr_clk_ids	= FSYS_NR_CLK,
+	.clk_regs	= fsys_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(fsys_clk_regs),
+};
+
 static void __init exynos5260_clk_fsys_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.mux_clks = fsys_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(fsys_mux_clks);
-	cmu.gate_clks = fsys_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(fsys_gate_clks);
-	cmu.nr_clk_ids = FSYS_NR_CLK;
-	cmu.clk_regs = fsys_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(fsys_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &fsys_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_fsys, "samsung,exynos5260-clock-fsys",
@@ -576,21 +576,21 @@ static const struct samsung_gate_clock g2d_gate_clks[] __initconst = {
 			EN_IP_G2D_SECURE_SMMU_G2D, 15, 0, 0),
 };
 
+static const struct samsung_cmu_info g2d_cmu __initconst = {
+	.mux_clks	= g2d_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(g2d_mux_clks),
+	.div_clks	= g2d_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(g2d_div_clks),
+	.gate_clks	= g2d_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(g2d_gate_clks),
+	.nr_clk_ids	= G2D_NR_CLK,
+	.clk_regs	= g2d_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(g2d_clk_regs),
+};
+
 static void __init exynos5260_clk_g2d_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.mux_clks = g2d_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(g2d_mux_clks);
-	cmu.div_clks = g2d_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(g2d_div_clks);
-	cmu.gate_clks = g2d_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(g2d_gate_clks);
-	cmu.nr_clk_ids = G2D_NR_CLK;
-	cmu.clk_regs = g2d_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(g2d_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &g2d_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_g2d, "samsung,exynos5260-clock-g2d",
@@ -637,23 +637,23 @@ static const struct samsung_pll_clock g3d_pll_clks[] __initconst = {
 		pll2550_24mhz_tbl),
 };
 
+static const struct samsung_cmu_info g3d_cmu __initconst = {
+	.pll_clks	= g3d_pll_clks,
+	.nr_pll_clks	= ARRAY_SIZE(g3d_pll_clks),
+	.mux_clks	= g3d_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(g3d_mux_clks),
+	.div_clks	= g3d_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(g3d_div_clks),
+	.gate_clks	= g3d_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(g3d_gate_clks),
+	.nr_clk_ids	= G3D_NR_CLK,
+	.clk_regs	= g3d_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(g3d_clk_regs),
+};
+
 static void __init exynos5260_clk_g3d_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.pll_clks = g3d_pll_clks;
-	cmu.nr_pll_clks =  ARRAY_SIZE(g3d_pll_clks);
-	cmu.mux_clks = g3d_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(g3d_mux_clks);
-	cmu.div_clks = g3d_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(g3d_div_clks);
-	cmu.gate_clks = g3d_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(g3d_gate_clks);
-	cmu.nr_clk_ids = G3D_NR_CLK;
-	cmu.clk_regs = g3d_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(g3d_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &g3d_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_g3d, "samsung,exynos5260-clock-g3d",
@@ -772,21 +772,21 @@ static const struct samsung_gate_clock gscl_gate_clks[] __initconst = {
 			EN_IP_GSCL_SECURE_SMMU_MSCL1, 20, 0, 0),
 };
 
+static const struct samsung_cmu_info gscl_cmu __initconst = {
+	.mux_clks	= gscl_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(gscl_mux_clks),
+	.div_clks	= gscl_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(gscl_div_clks),
+	.gate_clks	= gscl_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(gscl_gate_clks),
+	.nr_clk_ids	= GSCL_NR_CLK,
+	.clk_regs	= gscl_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(gscl_clk_regs),
+};
+
 static void __init exynos5260_clk_gscl_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.mux_clks = gscl_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(gscl_mux_clks);
-	cmu.div_clks = gscl_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(gscl_div_clks);
-	cmu.gate_clks = gscl_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(gscl_gate_clks);
-	cmu.nr_clk_ids = GSCL_NR_CLK;
-	cmu.clk_regs = gscl_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(gscl_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &gscl_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_gscl, "samsung,exynos5260-clock-gscl",
@@ -891,21 +891,21 @@ static const struct samsung_gate_clock isp_gate_clks[] __initconst = {
 			EN_SCLK_ISP, 9, CLK_SET_RATE_PARENT, 0),
 };
 
+static const struct samsung_cmu_info isp_cmu __initconst = {
+	.mux_clks	= isp_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(isp_mux_clks),
+	.div_clks	= isp_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(isp_div_clks),
+	.gate_clks	= isp_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(isp_gate_clks),
+	.nr_clk_ids	= ISP_NR_CLK,
+	.clk_regs	= isp_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(isp_clk_regs),
+};
+
 static void __init exynos5260_clk_isp_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.mux_clks = isp_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(isp_mux_clks);
-	cmu.div_clks = isp_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(isp_div_clks);
-	cmu.gate_clks = isp_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(isp_gate_clks);
-	cmu.nr_clk_ids = ISP_NR_CLK;
-	cmu.clk_regs = isp_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(isp_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &isp_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_isp, "samsung,exynos5260-clock-isp",
@@ -955,21 +955,21 @@ static const struct samsung_pll_clock kfc_pll_clks[] __initconst = {
 		pll2550_24mhz_tbl),
 };
 
+static const struct samsung_cmu_info kfc_cmu __initconst = {
+	.pll_clks	= kfc_pll_clks,
+	.nr_pll_clks	= ARRAY_SIZE(kfc_pll_clks),
+	.mux_clks	= kfc_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(kfc_mux_clks),
+	.div_clks	= kfc_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(kfc_div_clks),
+	.nr_clk_ids	= KFC_NR_CLK,
+	.clk_regs	= kfc_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(kfc_clk_regs),
+};
+
 static void __init exynos5260_clk_kfc_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.pll_clks = kfc_pll_clks;
-	cmu.nr_pll_clks =  ARRAY_SIZE(kfc_pll_clks);
-	cmu.mux_clks = kfc_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(kfc_mux_clks);
-	cmu.div_clks = kfc_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(kfc_div_clks);
-	cmu.nr_clk_ids = KFC_NR_CLK;
-	cmu.clk_regs = kfc_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(kfc_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &kfc_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_kfc, "samsung,exynos5260-clock-kfc",
@@ -1011,21 +1011,21 @@ static const struct samsung_gate_clock mfc_gate_clks[] __initconst = {
 			EN_IP_MFC_SECURE_SMMU2_MFC, 7, 0, 0),
 };
 
+static const struct samsung_cmu_info mfc_cmu __initconst = {
+	.mux_clks	= mfc_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(mfc_mux_clks),
+	.div_clks	= mfc_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(mfc_div_clks),
+	.gate_clks	= mfc_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(mfc_gate_clks),
+	.nr_clk_ids	= MFC_NR_CLK,
+	.clk_regs	= mfc_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(mfc_clk_regs),
+};
+
 static void __init exynos5260_clk_mfc_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.mux_clks = mfc_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(mfc_mux_clks);
-	cmu.div_clks = mfc_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(mfc_div_clks);
-	cmu.gate_clks = mfc_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(mfc_gate_clks);
-	cmu.nr_clk_ids = MFC_NR_CLK;
-	cmu.clk_regs = mfc_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(mfc_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &mfc_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_mfc, "samsung,exynos5260-clock-mfc",
@@ -1158,23 +1158,23 @@ static const struct samsung_pll_clock mif_pll_clks[] __initconst = {
 		pll2550_24mhz_tbl),
 };
 
+static const struct samsung_cmu_info mif_cmu __initconst = {
+	.pll_clks	= mif_pll_clks,
+	.nr_pll_clks	= ARRAY_SIZE(mif_pll_clks),
+	.mux_clks	= mif_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(mif_mux_clks),
+	.div_clks	= mif_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(mif_div_clks),
+	.gate_clks	= mif_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(mif_gate_clks),
+	.nr_clk_ids	= MIF_NR_CLK,
+	.clk_regs	= mif_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(mif_clk_regs),
+};
+
 static void __init exynos5260_clk_mif_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.pll_clks = mif_pll_clks;
-	cmu.nr_pll_clks =  ARRAY_SIZE(mif_pll_clks);
-	cmu.mux_clks = mif_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(mif_mux_clks);
-	cmu.div_clks = mif_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(mif_div_clks);
-	cmu.gate_clks = mif_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(mif_gate_clks);
-	cmu.nr_clk_ids = MIF_NR_CLK;
-	cmu.clk_regs = mif_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(mif_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &mif_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_mif, "samsung,exynos5260-clock-mif",
@@ -1366,21 +1366,21 @@ static const struct samsung_gate_clock peri_gate_clks[] __initconst = {
 		EN_IP_PERI_SECURE_TZPC, 20, 0, 0),
 };
 
+static const struct samsung_cmu_info peri_cmu __initconst = {
+	.mux_clks	= peri_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(peri_mux_clks),
+	.div_clks	= peri_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(peri_div_clks),
+	.gate_clks	= peri_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(peri_gate_clks),
+	.nr_clk_ids	= PERI_NR_CLK,
+	.clk_regs	= peri_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(peri_clk_regs),
+};
+
 static void __init exynos5260_clk_peri_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.mux_clks = peri_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(peri_mux_clks);
-	cmu.div_clks = peri_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(peri_div_clks);
-	cmu.gate_clks = peri_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(peri_gate_clks);
-	cmu.nr_clk_ids = PERI_NR_CLK;
-	cmu.clk_regs = peri_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(peri_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &peri_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_peri, "samsung,exynos5260-clock-peri",
@@ -1818,25 +1818,25 @@ static const struct samsung_pll_clock top_pll_clks[] __initconst = {
 		pll2650_24mhz_tbl),
 };
 
+static const struct samsung_cmu_info top_cmu __initconst = {
+	.pll_clks	= top_pll_clks,
+	.nr_pll_clks	= ARRAY_SIZE(top_pll_clks),
+	.mux_clks	= top_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(top_mux_clks),
+	.div_clks	= top_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(top_div_clks),
+	.gate_clks	= top_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(top_gate_clks),
+	.fixed_clks	= fixed_rate_clks,
+	.nr_fixed_clks	= ARRAY_SIZE(fixed_rate_clks),
+	.nr_clk_ids	= TOP_NR_CLK,
+	.clk_regs	= top_clk_regs,
+	.nr_clk_regs	= ARRAY_SIZE(top_clk_regs),
+};
+
 static void __init exynos5260_clk_top_init(struct device_node *np)
 {
-	struct samsung_cmu_info cmu = { NULL };
-
-	cmu.pll_clks = top_pll_clks;
-	cmu.nr_pll_clks =  ARRAY_SIZE(top_pll_clks);
-	cmu.mux_clks = top_mux_clks;
-	cmu.nr_mux_clks = ARRAY_SIZE(top_mux_clks);
-	cmu.div_clks = top_div_clks;
-	cmu.nr_div_clks = ARRAY_SIZE(top_div_clks);
-	cmu.gate_clks = top_gate_clks;
-	cmu.nr_gate_clks = ARRAY_SIZE(top_gate_clks);
-	cmu.fixed_clks = fixed_rate_clks;
-	cmu.nr_fixed_clks = ARRAY_SIZE(fixed_rate_clks);
-	cmu.nr_clk_ids = TOP_NR_CLK;
-	cmu.clk_regs = top_clk_regs;
-	cmu.nr_clk_regs = ARRAY_SIZE(top_clk_regs);
-
-	samsung_cmu_register_one(np, &cmu);
+	samsung_cmu_register_one(np, &top_cmu);
 }
 
 CLK_OF_DECLARE(exynos5260_clk_top, "samsung,exynos5260-clock-top",
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code
  2016-08-22  2:49 [PATCH 0/2] clk: samsung: Move struct samsung_cmu_info to init section Chanwoo Choi
  2016-08-22  2:49 ` [PATCH 1/2] clk: samsung: exynos5260: " Chanwoo Choi
@ 2016-08-22  2:49 ` Chanwoo Choi
  2016-09-01 17:07   ` Sylwester Nawrocki
  1 sibling, 1 reply; 13+ messages in thread
From: Chanwoo Choi @ 2016-08-22  2:49 UTC (permalink / raw)
  To: s.nawrocki, tomasz.figa
  Cc: mturquette, sboyd, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel,
	Chanwoo Choi

This patch uses the samsung_cmu_register_one() to simplify code
and move the pll/mux/div/gate data to initconst section.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/clk/samsung/clk-exynos5410.c | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c
index 54ec486a5e45..5488a4460c15 100644
--- a/drivers/clk/samsung/clk-exynos5410.c
+++ b/drivers/clk/samsung/clk-exynos5410.c
@@ -230,29 +230,22 @@ static const struct samsung_pll_clock exynos5410_plls[nr_plls] __initconst = {
 		KPLL_CON0, NULL),
 };
 
+static const struct samsung_cmu_info cmu __initconst = {
+	.pll_clks	= exynos5410_plls,
+	.nr_pll_clks	= ARRAY_SIZE(exynos5410_plls),
+	.mux_clks	= exynos5410_mux_clks,
+	.nr_mux_clks	= ARRAY_SIZE(exynos5410_mux_clks),
+	.div_clks	= exynos5410_div_clks,
+	.nr_div_clks	= ARRAY_SIZE(exynos5410_div_clks),
+	.gate_clks	= exynos5410_gate_clks,
+	.nr_gate_clks	= ARRAY_SIZE(exynos5410_gate_clks),
+	.nr_clk_ids	= CLK_NR_CLKS,
+};
+
 /* register exynos5410 clocks */
 static void __init exynos5410_clk_init(struct device_node *np)
 {
-	struct samsung_clk_provider *ctx;
-	void __iomem *reg_base;
-
-	reg_base = of_iomap(np, 0);
-	if (!reg_base)
-		panic("%s: failed to map registers\n", __func__);
-
-	ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS);
-
-	samsung_clk_register_pll(ctx, exynos5410_plls,
-			ARRAY_SIZE(exynos5410_plls), reg_base);
-
-	samsung_clk_register_mux(ctx, exynos5410_mux_clks,
-			ARRAY_SIZE(exynos5410_mux_clks));
-	samsung_clk_register_div(ctx, exynos5410_div_clks,
-			ARRAY_SIZE(exynos5410_div_clks));
-	samsung_clk_register_gate(ctx, exynos5410_gate_clks,
-			ARRAY_SIZE(exynos5410_gate_clks));
-
-	samsung_clk_of_add_provider(np, ctx);
+	samsung_cmu_register_one(np, &cmu);
 
 	pr_debug("Exynos5410: clock setup completed.\n");
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-22  2:49 ` [PATCH 1/2] clk: samsung: exynos5260: " Chanwoo Choi
@ 2016-08-23  0:55   ` Stephen Boyd
  2016-08-23  2:35     ` Chanwoo Choi
  2016-09-01 17:06   ` Sylwester Nawrocki
  1 sibling, 1 reply; 13+ messages in thread
From: Stephen Boyd @ 2016-08-23  0:55 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: s.nawrocki, tomasz.figa, mturquette, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel

On 08/22, Chanwoo Choi wrote:
> This patch moves the all samsung_cmu_info struct to initconst section
> because they are used only in initconst section.
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/clk/samsung/clk-exynos5260.c | 350 +++++++++++++++++------------------
>  1 file changed, 175 insertions(+), 175 deletions(-)
> 
> diff --git a/drivers/clk/samsung/clk-exynos5260.c b/drivers/clk/samsung/clk-exynos5260.c
> index a43642c36039..fd1d9bfc151b 100644
> --- a/drivers/clk/samsung/clk-exynos5260.c
> +++ b/drivers/clk/samsung/clk-exynos5260.c
> @@ -131,21 +131,21 @@ static const struct samsung_gate_clock aud_gate_clks[] __initconst = {
>  			EN_IP_AUD, 4, 0, 0),
>  };
>  
> +static const struct samsung_cmu_info aud_cmu __initconst = {
> +	.mux_clks	= aud_mux_clks,
> +	.nr_mux_clks	= ARRAY_SIZE(aud_mux_clks),
> +	.div_clks	= aud_div_clks,
> +	.nr_div_clks	= ARRAY_SIZE(aud_div_clks),
> +	.gate_clks	= aud_gate_clks,
> +	.nr_gate_clks	= ARRAY_SIZE(aud_gate_clks),
> +	.nr_clk_ids	= AUD_NR_CLK,
> +	.clk_regs	= aud_clk_regs,
> +	.nr_clk_regs	= ARRAY_SIZE(aud_clk_regs),
> +};
> +
>  static void __init exynos5260_clk_aud_init(struct device_node *np)
>  {
> -	struct samsung_cmu_info cmu = { NULL };
> -

I presume this was done this way to save some initdata space by
only allocating the array that's needed at runtime? I would
expect to see some more kernel image bloat from this change but
runtime memory usage would stay the same. Is there any real
benefit from this patch though?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-23  0:55   ` Stephen Boyd
@ 2016-08-23  2:35     ` Chanwoo Choi
  2016-08-23 10:07       ` Sylwester Nawrocki
  0 siblings, 1 reply; 13+ messages in thread
From: Chanwoo Choi @ 2016-08-23  2:35 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: s.nawrocki, tomasz.figa, mturquette, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel

Hi Stephen,

On 2016년 08월 23일 09:55, Stephen Boyd wrote:
> On 08/22, Chanwoo Choi wrote:
>> This patch moves the all samsung_cmu_info struct to initconst section
>> because they are used only in initconst section.
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>>  drivers/clk/samsung/clk-exynos5260.c | 350 +++++++++++++++++------------------
>>  1 file changed, 175 insertions(+), 175 deletions(-)
>>
>> diff --git a/drivers/clk/samsung/clk-exynos5260.c b/drivers/clk/samsung/clk-exynos5260.c
>> index a43642c36039..fd1d9bfc151b 100644
>> --- a/drivers/clk/samsung/clk-exynos5260.c
>> +++ b/drivers/clk/samsung/clk-exynos5260.c
>> @@ -131,21 +131,21 @@ static const struct samsung_gate_clock aud_gate_clks[] __initconst = {
>>  			EN_IP_AUD, 4, 0, 0),
>>  };
>>  
>> +static const struct samsung_cmu_info aud_cmu __initconst = {
>> +	.mux_clks	= aud_mux_clks,
>> +	.nr_mux_clks	= ARRAY_SIZE(aud_mux_clks),
>> +	.div_clks	= aud_div_clks,
>> +	.nr_div_clks	= ARRAY_SIZE(aud_div_clks),
>> +	.gate_clks	= aud_gate_clks,
>> +	.nr_gate_clks	= ARRAY_SIZE(aud_gate_clks),
>> +	.nr_clk_ids	= AUD_NR_CLK,
>> +	.clk_regs	= aud_clk_regs,
>> +	.nr_clk_regs	= ARRAY_SIZE(aud_clk_regs),
>> +};
>> +
>>  static void __init exynos5260_clk_aud_init(struct device_node *np)
>>  {
>> -	struct samsung_cmu_info cmu = { NULL };
>> -
> 
> I presume this was done this way to save some initdata space by
> only allocating the array that's needed at runtime? I would
> expect to see some more kernel image bloat from this change but
> runtime memory usage would stay the same. Is there any real
> benefit from this patch though?
> 

After this patch, 'struct samsung_cmu_info' size should be added
to kernel image and then the size of deleted code should be removed
from kernel image. I think that it is not bloating.
(struct samsung_cmu_info includes the pointer and integer value.)

This patch make the code more simple and improve the readability.
And, the samsung_cmu_register_on() requires the 'const' type
argument for 'struct samsung_cmu_info'.

Regards,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-23  2:35     ` Chanwoo Choi
@ 2016-08-23 10:07       ` Sylwester Nawrocki
  2016-08-24  4:43         ` Stephen Boyd
  0 siblings, 1 reply; 13+ messages in thread
From: Sylwester Nawrocki @ 2016-08-23 10:07 UTC (permalink / raw)
  To: Chanwoo Choi, Stephen Boyd
  Cc: tomasz.figa, mturquette, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel

On 08/23/2016 04:35 AM, Chanwoo Choi wrote:
>>>  
>>> +static const struct samsung_cmu_info aud_cmu __initconst = {
>>> +	.mux_clks	= aud_mux_clks,
>>> +	.nr_mux_clks	= ARRAY_SIZE(aud_mux_clks),
>>> +	.div_clks	= aud_div_clks,
>>> +	.nr_div_clks	= ARRAY_SIZE(aud_div_clks),
>>> +	.gate_clks	= aud_gate_clks,
>>> +	.nr_gate_clks	= ARRAY_SIZE(aud_gate_clks),
>>> +	.nr_clk_ids	= AUD_NR_CLK,
>>> +	.clk_regs	= aud_clk_regs,
>>> +	.nr_clk_regs	= ARRAY_SIZE(aud_clk_regs),
>>> +};
>>> +
>>>  static void __init exynos5260_clk_aud_init(struct device_node *np)
>>>  {
>>> -	struct samsung_cmu_info cmu = { NULL };
>>> -
>>
>> I presume this was done this way to save some initdata space by
>> only allocating the array that's needed at runtime? I would
>> expect to see some more kernel image bloat from this change but
>> runtime memory usage would stay the same. Is there any real
>> benefit from this patch though?
>>
> 
> After this patch, 'struct samsung_cmu_info' size should be added
> to kernel image and then the size of deleted code should be removed
> from kernel image. I think that it is not bloating.
> (struct samsung_cmu_info includes the pointer and integer value.)
> 
> This patch make the code more simple and improve the readability.
> And, the samsung_cmu_register_on() requires the 'const' type
> argument for 'struct samsung_cmu_info'.

I checked stripped object files and it seems with the patch there
is some saving of the kernel image size. Exactly 784 bytes, which
makes zImage smaller by 480 bytes.

The patch increases .init.rodata section size by 780 bytes but 
decreases .init.text section size by 1564 bytes.  Looks like 
a static initializer is cheaper.

$ ls -l  drivers/clk/samsung/clk-exynos5260.o

< -rw-rw-r-- 1 snawrocki snawrocki 29100 Aug 23 11:35 drivers/clk/samsung/clk-exynos5260.o
---
> -rw-rw-r-- 1 snawrocki snawrocki 28316 Aug 23 11:32 drivers/clk/samsung/clk-exynos5260.o


The section size differences are as below:
15c15
<   3 .init.text    000006b8  00000000  00000000  00000034  2**2
---
>   3 .init.text    0000009c  00000000  00000000  00000034  2**2
25c25
<   8 .init.rodata  00003f6c  00000000  00000000  00002f20  2**2
---
>   8 .init.rodata  00004278  00000000  00000000  00002904  2**2

So the saving is rather insignificant but the patch doesn't make
things worse and I'd say it might be worth applying.

--
Thanks, 
Sylwester

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-23 10:07       ` Sylwester Nawrocki
@ 2016-08-24  4:43         ` Stephen Boyd
  2016-08-24  8:38           ` Chanwoo Choi
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Boyd @ 2016-08-24  4:43 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: Chanwoo Choi, tomasz.figa, mturquette, kgene, k.kozlowski,
	chanwoo, linux-samsung-soc, linux-clk, linux-arm-kernel,
	linux-kernel

On 08/23, Sylwester Nawrocki wrote:
> On 08/23/2016 04:35 AM, Chanwoo Choi wrote:
> I checked stripped object files and it seems with the patch there
> is some saving of the kernel image size. Exactly 784 bytes, which
> makes zImage smaller by 480 bytes.
> 
> The patch increases .init.rodata section size by 780 bytes but 
> decreases .init.text section size by 1564 bytes.  Looks like 
> a static initializer is cheaper.
> 
> $ ls -l  drivers/clk/samsung/clk-exynos5260.o
> 
> < -rw-rw-r-- 1 snawrocki snawrocki 29100 Aug 23 11:35 drivers/clk/samsung/clk-exynos5260.o
> ---
> > -rw-rw-r-- 1 snawrocki snawrocki 28316 Aug 23 11:32 drivers/clk/samsung/clk-exynos5260.o
> 
> 
> The section size differences are as below:
> 15c15
> <   3 .init.text    000006b8  00000000  00000000  00000034  2**2
> ---
> >   3 .init.text    0000009c  00000000  00000000  00000034  2**2
> 25c25
> <   8 .init.rodata  00003f6c  00000000  00000000  00002f20  2**2
> ---
> >   8 .init.rodata  00004278  00000000  00000000  00002904  2**2
> 
> So the saving is rather insignificant but the patch doesn't make
> things worse and I'd say it might be worth applying.
> 

Sounds good. This sort of information should be in the commit
text though. Talking about const doesn't make any sense to me.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-24  4:43         ` Stephen Boyd
@ 2016-08-24  8:38           ` Chanwoo Choi
  2016-08-25  0:11             ` Stephen Boyd
  0 siblings, 1 reply; 13+ messages in thread
From: Chanwoo Choi @ 2016-08-24  8:38 UTC (permalink / raw)
  To: Stephen Boyd, Sylwester Nawrocki
  Cc: tomasz.figa, mturquette, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel

On 2016년 08월 24일 13:43, Stephen Boyd wrote:
> On 08/23, Sylwester Nawrocki wrote:
>> On 08/23/2016 04:35 AM, Chanwoo Choi wrote:
>> I checked stripped object files and it seems with the patch there
>> is some saving of the kernel image size. Exactly 784 bytes, which
>> makes zImage smaller by 480 bytes.
>>
>> The patch increases .init.rodata section size by 780 bytes but 
>> decreases .init.text section size by 1564 bytes.  Looks like 
>> a static initializer is cheaper.
>>
>> $ ls -l  drivers/clk/samsung/clk-exynos5260.o
>>
>> < -rw-rw-r-- 1 snawrocki snawrocki 29100 Aug 23 11:35 drivers/clk/samsung/clk-exynos5260.o
>> ---
>>> -rw-rw-r-- 1 snawrocki snawrocki 28316 Aug 23 11:32 drivers/clk/samsung/clk-exynos5260.o
>>
>>
>> The section size differences are as below:
>> 15c15
>> <   3 .init.text    000006b8  00000000  00000000  00000034  2**2
>> ---
>>>   3 .init.text    0000009c  00000000  00000000  00000034  2**2
>> 25c25
>> <   8 .init.rodata  00003f6c  00000000  00000000  00002f20  2**2
>> ---
>>>   8 .init.rodata  00004278  00000000  00000000  00002904  2**2
>>
>> So the saving is rather insignificant but the patch doesn't make
>> things worse and I'd say it might be worth applying.
>>
> 
> Sounds good. This sort of information should be in the commit
> text though. Talking about const doesn't make any sense to me.

Do you mean that 'const' is initconst secion?
If possible, could you explain the anything
why you don't make sense about 'const'?

-- 
Best Regards,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-24  8:38           ` Chanwoo Choi
@ 2016-08-25  0:11             ` Stephen Boyd
  2016-08-25  7:28               ` Chanwoo Choi
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Boyd @ 2016-08-25  0:11 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Sylwester Nawrocki, tomasz.figa, mturquette, kgene, k.kozlowski,
	chanwoo, linux-samsung-soc, linux-clk, linux-arm-kernel,
	linux-kernel

On 08/24, Chanwoo Choi wrote:
> On 2016년 08월 24일 13:43, Stephen Boyd wrote:
> > On 08/23, Sylwester Nawrocki wrote:
> >> So the saving is rather insignificant but the patch doesn't make
> >> things worse and I'd say it might be worth applying.
> >>
> > 
> > Sounds good. This sort of information should be in the commit
> > text though. Talking about const doesn't make any sense to me.
> 
> Do you mean that 'const' is initconst secion?

No. Marking it as initconst in the patch is correct.

> If possible, could you explain the anything
> why you don't make sense about 'const'?
> 

I'm just saying that the reasoning to move it from the text
section to the data section shouldn't be because of const. There
should be better reasons to do this, like size benefits.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-25  0:11             ` Stephen Boyd
@ 2016-08-25  7:28               ` Chanwoo Choi
  2016-08-25 14:43                 ` Tomasz Figa
  0 siblings, 1 reply; 13+ messages in thread
From: Chanwoo Choi @ 2016-08-25  7:28 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Sylwester Nawrocki, tomasz.figa, mturquette, kgene, k.kozlowski,
	chanwoo, linux-samsung-soc, linux-clk, linux-arm-kernel,
	linux-kernel

Hi Stephen,

On 2016년 08월 25일 09:11, Stephen Boyd wrote:
> On 08/24, Chanwoo Choi wrote:
>> On 2016년 08월 24일 13:43, Stephen Boyd wrote:
>>> On 08/23, Sylwester Nawrocki wrote:
>>>> So the saving is rather insignificant but the patch doesn't make
>>>> things worse and I'd say it might be worth applying.
>>>>
>>>
>>> Sounds good. This sort of information should be in the commit
>>> text though. Talking about const doesn't make any sense to me.
>>
>> Do you mean that 'const' is initconst secion?
> 
> No. Marking it as initconst in the patch is correct.

OK.

> 
>> If possible, could you explain the anything
>> why you don't make sense about 'const'?
>>
> 
> I'm just saying that the reasoning to move it from the text
> section to the data section shouldn't be because of const. There
> should be better reasons to do this, like size benefits.
> 

As I already said, the samsung_cmu_register_on() requires
the 'const' type argument for 'struct samsung_cmu_info'.

So, I defined the instance on the out of the exynos5260_clk_aud_init() as following:
	static const struct samsung_cmu_info aud_cmu __initconst = {

How can i add the 'const' keyword and '__initsecion' to the 
"struct samsung_cmu_info aud_cmu" in the "static void __init 
exynos5260_clk_aud_init(struct device_node *np)"?

-- 
Best Regards,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-25  7:28               ` Chanwoo Choi
@ 2016-08-25 14:43                 ` Tomasz Figa
  0 siblings, 0 replies; 13+ messages in thread
From: Tomasz Figa @ 2016-08-25 14:43 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Stephen Boyd, Sylwester Nawrocki, Michael Turquette, Kukjin Kim,
	Krzysztof Kozłowski, chanwoo, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel

2016-08-25 16:28 GMT+09:00 Chanwoo Choi <cw00.choi@samsung.com>:
> Hi Stephen,
>
> On 2016년 08월 25일 09:11, Stephen Boyd wrote:
>> On 08/24, Chanwoo Choi wrote:
>>> On 2016년 08월 24일 13:43, Stephen Boyd wrote:
>>>> On 08/23, Sylwester Nawrocki wrote:
>>>>> So the saving is rather insignificant but the patch doesn't make
>>>>> things worse and I'd say it might be worth applying.
>>>>>
>>>>
>>>> Sounds good. This sort of information should be in the commit
>>>> text though. Talking about const doesn't make any sense to me.
>>>
>>> Do you mean that 'const' is initconst secion?
>>
>> No. Marking it as initconst in the patch is correct.
>
> OK.
>
>>
>>> If possible, could you explain the anything
>>> why you don't make sense about 'const'?
>>>
>>
>> I'm just saying that the reasoning to move it from the text
>> section to the data section shouldn't be because of const. There
>> should be better reasons to do this, like size benefits.
>>
>
> As I already said, the samsung_cmu_register_on() requires
> the 'const' type argument for 'struct samsung_cmu_info'.

If a function takes a const pointer as an argument, then it's
perfectly valid to give a non-const pointer. Casting from non-cost
into const is valid, other way around not.

>
> So, I defined the instance on the out of the exynos5260_clk_aud_init() as following:
>         static const struct samsung_cmu_info aud_cmu __initconst = {
>
> How can i add the 'const' keyword and '__initsecion' to the
> "struct samsung_cmu_info aud_cmu" in the "static void __init
> exynos5260_clk_aud_init(struct device_node *np)"?

Stephen meant that there must be some benefit from a change to make it
worth being included into the kernel.

Best regards,
Tomasz

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  2016-08-22  2:49 ` [PATCH 1/2] clk: samsung: exynos5260: " Chanwoo Choi
  2016-08-23  0:55   ` Stephen Boyd
@ 2016-09-01 17:06   ` Sylwester Nawrocki
  1 sibling, 0 replies; 13+ messages in thread
From: Sylwester Nawrocki @ 2016-09-01 17:06 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: tomasz.figa, mturquette, sboyd, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel

On 08/22/2016 04:49 AM, Chanwoo Choi wrote:
> This patch moves the all samsung_cmu_info struct to initconst section
> because they are used only in initconst section.
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

Applied with the commit message changed as below, thanks.

--------8<--------
clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
    
 This patch moves the samsung_cmu_info struct instances to initconst section,
 this decreases the kernel image size by 784 bytes, which makes zImage smaller
 by 480 bytes.
    
 The patch increases .init.rodata section size by 780 bytes but decreases
 .init.text section size by 1564 bytes.
    
 Size of the drivers/clk/samsung/clk-exynos5260.o object file is 29100 bytes
 without the patch and 28316 after applying the patch.
    
 The section size differences are as below:
 15c15
 <   3 .init.text    000006b8  00000000  00000000  00000034  2**2
 ---
 >   3 .init.text    0000009c  00000000  00000000  00000034  2**2
 25c25
 <   8 .init.rodata  00003f6c  00000000  00000000  00002f20  2**2
 ---
 >   8 .init.rodata  00004278  00000000  00000000  00002904  2**2
    
 Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
 Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
--------8<--------

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code
  2016-08-22  2:49 ` [PATCH 2/2] clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code Chanwoo Choi
@ 2016-09-01 17:07   ` Sylwester Nawrocki
  0 siblings, 0 replies; 13+ messages in thread
From: Sylwester Nawrocki @ 2016-09-01 17:07 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: tomasz.figa, mturquette, sboyd, kgene, k.kozlowski, chanwoo,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel

On 08/22/2016 04:49 AM, Chanwoo Choi wrote:
> This patch uses the samsung_cmu_register_one() to simplify code
> and move the pll/mux/div/gate data to initconst section.
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-09-01 21:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22  2:49 [PATCH 0/2] clk: samsung: Move struct samsung_cmu_info to init section Chanwoo Choi
2016-08-22  2:49 ` [PATCH 1/2] clk: samsung: exynos5260: " Chanwoo Choi
2016-08-23  0:55   ` Stephen Boyd
2016-08-23  2:35     ` Chanwoo Choi
2016-08-23 10:07       ` Sylwester Nawrocki
2016-08-24  4:43         ` Stephen Boyd
2016-08-24  8:38           ` Chanwoo Choi
2016-08-25  0:11             ` Stephen Boyd
2016-08-25  7:28               ` Chanwoo Choi
2016-08-25 14:43                 ` Tomasz Figa
2016-09-01 17:06   ` Sylwester Nawrocki
2016-08-22  2:49 ` [PATCH 2/2] clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code Chanwoo Choi
2016-09-01 17:07   ` Sylwester Nawrocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).