From: Kevin Hao <haokexin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Scott Wood <scottwood@freescale.com>,
Mike Turquette <mturquette@linaro.org>,
Jingchang Lu <jingchang.lu@freescale.com>
Subject: [PATCH 2/2] clk: ppc-corenet: don't use platform_driver to init the clock device
Date: Thu, 16 Oct 2014 19:18:41 +0800 [thread overview]
Message-ID: <1413458321-23880-3-git-send-email-haokexin@gmail.com> (raw)
In-Reply-To: <1413458321-23880-1-git-send-email-haokexin@gmail.com>
In commit da788acb2838 ("clk: ppc-corenet: Fix Section mismatch
warning"), we put the ppc_corenet_clk_driver struct to init section
in order to fix section mismatch warning. This is definitely wrong
because the kernel would free the memories occupied by
ppc_corenet_clk_driver after boot while this driver is still registered
in the driver core. The kernel would panic when accessing this driver
struct. So choose to use CLK_OF_DECLARE to scan and init the clock devices.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/powerpc/platforms/85xx/corenet_generic.c | 7 +++++
drivers/clk/clk-ppc-corenet.c | 43 ++++-----------------------
2 files changed, 13 insertions(+), 37 deletions(-)
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index e56b89a792ed..7677cfecb787 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -16,6 +16,7 @@
#include <linux/kdev_t.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/clk-provider.h>
#include <asm/time.h>
#include <asm/machdep.h>
@@ -188,11 +189,17 @@ static int __init corenet_generic_probe(void)
return 0;
}
+static void __init corenet_gen_init(void)
+{
+ of_clk_init(NULL);
+}
+
define_machine(corenet_generic) {
.name = "CoreNet Generic",
.probe = corenet_generic_probe,
.setup_arch = corenet_gen_setup_arch,
.init_IRQ = corenet_gen_pic_init,
+ .init = corenet_gen_init,
#ifdef CONFIG_PCI
.pcibios_fixup_bus = fsl_pcibios_fixup_bus,
.pcibios_fixup_phb = fsl_pcibios_fixup_phb,
diff --git a/drivers/clk/clk-ppc-corenet.c b/drivers/clk/clk-ppc-corenet.c
index 8e58edfeeb37..bf0fe565ce4e 100644
--- a/drivers/clk/clk-ppc-corenet.c
+++ b/drivers/clk/clk-ppc-corenet.c
@@ -268,40 +268,9 @@ static void __init sysclk_init(struct device_node *node)
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
-static const struct of_device_id clk_match[] __initconst = {
- { .compatible = "fsl,qoriq-sysclk-1.0", .data = sysclk_init, },
- { .compatible = "fsl,qoriq-sysclk-2.0", .data = sysclk_init, },
- { .compatible = "fsl,qoriq-core-pll-1.0", .data = core_pll_init, },
- { .compatible = "fsl,qoriq-core-pll-2.0", .data = core_pll_init, },
- { .compatible = "fsl,qoriq-core-mux-1.0", .data = core_mux_init, },
- { .compatible = "fsl,qoriq-core-mux-2.0", .data = core_mux_init, },
- {}
-};
-
-static int __init ppc_corenet_clk_probe(struct platform_device *pdev)
-{
- of_clk_init(clk_match);
-
- return 0;
-}
-
-static const struct of_device_id ppc_clk_ids[] __initconst = {
- { .compatible = "fsl,qoriq-clockgen-1.0", },
- { .compatible = "fsl,qoriq-clockgen-2.0", },
- {}
-};
-
-static struct platform_driver ppc_corenet_clk_driver __initdata = {
- .driver = {
- .name = "ppc_corenet_clock",
- .owner = THIS_MODULE,
- .of_match_table = ppc_clk_ids,
- },
- .probe = ppc_corenet_clk_probe,
-};
-
-static int __init ppc_corenet_clk_init(void)
-{
- return platform_driver_register(&ppc_corenet_clk_driver);
-}
-subsys_initcall(ppc_corenet_clk_init);
+CLK_OF_DECLARE(qoriq_sysclk_1, "fsl,qoriq-sysclk-1.0", sysclk_init);
+CLK_OF_DECLARE(qoriq_sysclk_2, "fsl,qoriq-sysclk-2.0", sysclk_init);
+CLK_OF_DECLARE(qoriq_core_pll_1, "fsl,qoriq-core-pll-1.0", core_pll_init);
+CLK_OF_DECLARE(qoriq_core_pll_2, "fsl,qoriq-core-pll-2.0", core_pll_init);
+CLK_OF_DECLARE(qoriq_core_mux_1, "fsl,qoriq-core-mux-1.0", core_mux_init);
+CLK_OF_DECLARE(qoriq_core_mux_2, "fsl,qoriq-core-mux-2.0", core_mux_init);
--
1.9.3
next prev parent reply other threads:[~2014-10-16 11:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 11:18 [PATCH 0/2] fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled Kevin Hao
2014-10-16 11:18 ` [PATCH 1/2] powerpc: move ppc_init() to common place Kevin Hao
2014-10-16 21:54 ` Scott Wood
2014-10-16 22:34 ` Kevin Hao
2014-10-16 11:18 ` Kevin Hao [this message]
2014-10-16 21:55 ` [PATCH 2/2] clk: ppc-corenet: don't use platform_driver to init the clock device Scott Wood
2014-10-16 22:55 ` Kevin Hao
2014-10-17 5:58 ` Scott Wood
2014-10-19 5:52 ` Kevin Hao
2014-10-16 21:49 ` [PATCH 0/2] fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled Scott Wood
2014-10-16 22:31 ` Kevin Hao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413458321-23880-3-git-send-email-haokexin@gmail.com \
--to=haokexin@gmail.com \
--cc=jingchang.lu@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mturquette@linaro.org \
--cc=scottwood@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).