clk: mxs: fix clock lookup after freeing init memory

The struct clk_lookup are marked as __initdata, resulting in being
removed from memory after the kernel finished booting. However this
leads to a NULL pointer de-ref if loading a module which uses clk_get.

This patch removes the __initdata from the struct clk_lookup.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
This commit is contained in:
Marc Kleine-Budde 2012-06-21 20:04:25 +02:00 committed by Mike Turquette
parent d6dc55c185
commit d03ac61daa
2 changed files with 20 additions and 20 deletions

View File

@ -71,7 +71,7 @@ static void __init clk_misc_init(void)
__mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC);
} }
static struct clk_lookup uart_lookups[] __initdata = { static struct clk_lookup uart_lookups[] = {
{ .dev_id = "duart", }, { .dev_id = "duart", },
{ .dev_id = "mxs-auart.0", }, { .dev_id = "mxs-auart.0", },
{ .dev_id = "mxs-auart.1", }, { .dev_id = "mxs-auart.1", },
@ -80,31 +80,31 @@ static struct clk_lookup uart_lookups[] __initdata = {
{ .dev_id = "80070000.serial", }, { .dev_id = "80070000.serial", },
}; };
static struct clk_lookup hbus_lookups[] __initdata = { static struct clk_lookup hbus_lookups[] = {
{ .dev_id = "imx23-dma-apbh", }, { .dev_id = "imx23-dma-apbh", },
{ .dev_id = "80004000.dma-apbh", }, { .dev_id = "80004000.dma-apbh", },
}; };
static struct clk_lookup xbus_lookups[] __initdata = { static struct clk_lookup xbus_lookups[] = {
{ .dev_id = "duart", .con_id = "apb_pclk"}, { .dev_id = "duart", .con_id = "apb_pclk"},
{ .dev_id = "80070000.serial", .con_id = "apb_pclk"}, { .dev_id = "80070000.serial", .con_id = "apb_pclk"},
{ .dev_id = "imx23-dma-apbx", }, { .dev_id = "imx23-dma-apbx", },
{ .dev_id = "80024000.dma-apbx", }, { .dev_id = "80024000.dma-apbx", },
}; };
static struct clk_lookup ssp_lookups[] __initdata = { static struct clk_lookup ssp_lookups[] = {
{ .dev_id = "imx23-mmc.0", }, { .dev_id = "imx23-mmc.0", },
{ .dev_id = "imx23-mmc.1", }, { .dev_id = "imx23-mmc.1", },
{ .dev_id = "80010000.ssp", }, { .dev_id = "80010000.ssp", },
{ .dev_id = "80034000.ssp", }, { .dev_id = "80034000.ssp", },
}; };
static struct clk_lookup lcdif_lookups[] __initdata = { static struct clk_lookup lcdif_lookups[] = {
{ .dev_id = "imx23-fb", }, { .dev_id = "imx23-fb", },
{ .dev_id = "80030000.lcdif", }, { .dev_id = "80030000.lcdif", },
}; };
static struct clk_lookup gpmi_lookups[] __initdata = { static struct clk_lookup gpmi_lookups[] = {
{ .dev_id = "imx23-gpmi-nand", }, { .dev_id = "imx23-gpmi-nand", },
{ .dev_id = "8000c000.gpmi", }, { .dev_id = "8000c000.gpmi", },
}; };

View File

@ -120,7 +120,7 @@ static void __init clk_misc_init(void)
writel_relaxed(val, FRAC0); writel_relaxed(val, FRAC0);
} }
static struct clk_lookup uart_lookups[] __initdata = { static struct clk_lookup uart_lookups[] = {
{ .dev_id = "duart", }, { .dev_id = "duart", },
{ .dev_id = "mxs-auart.0", }, { .dev_id = "mxs-auart.0", },
{ .dev_id = "mxs-auart.1", }, { .dev_id = "mxs-auart.1", },
@ -135,71 +135,71 @@ static struct clk_lookup uart_lookups[] __initdata = {
{ .dev_id = "80074000.serial", }, { .dev_id = "80074000.serial", },
}; };
static struct clk_lookup hbus_lookups[] __initdata = { static struct clk_lookup hbus_lookups[] = {
{ .dev_id = "imx28-dma-apbh", }, { .dev_id = "imx28-dma-apbh", },
{ .dev_id = "80004000.dma-apbh", }, { .dev_id = "80004000.dma-apbh", },
}; };
static struct clk_lookup xbus_lookups[] __initdata = { static struct clk_lookup xbus_lookups[] = {
{ .dev_id = "duart", .con_id = "apb_pclk"}, { .dev_id = "duart", .con_id = "apb_pclk"},
{ .dev_id = "80074000.serial", .con_id = "apb_pclk"}, { .dev_id = "80074000.serial", .con_id = "apb_pclk"},
{ .dev_id = "imx28-dma-apbx", }, { .dev_id = "imx28-dma-apbx", },
{ .dev_id = "80024000.dma-apbx", }, { .dev_id = "80024000.dma-apbx", },
}; };
static struct clk_lookup ssp0_lookups[] __initdata = { static struct clk_lookup ssp0_lookups[] = {
{ .dev_id = "imx28-mmc.0", }, { .dev_id = "imx28-mmc.0", },
{ .dev_id = "80010000.ssp", }, { .dev_id = "80010000.ssp", },
}; };
static struct clk_lookup ssp1_lookups[] __initdata = { static struct clk_lookup ssp1_lookups[] = {
{ .dev_id = "imx28-mmc.1", }, { .dev_id = "imx28-mmc.1", },
{ .dev_id = "80012000.ssp", }, { .dev_id = "80012000.ssp", },
}; };
static struct clk_lookup ssp2_lookups[] __initdata = { static struct clk_lookup ssp2_lookups[] = {
{ .dev_id = "imx28-mmc.2", }, { .dev_id = "imx28-mmc.2", },
{ .dev_id = "80014000.ssp", }, { .dev_id = "80014000.ssp", },
}; };
static struct clk_lookup ssp3_lookups[] __initdata = { static struct clk_lookup ssp3_lookups[] = {
{ .dev_id = "imx28-mmc.3", }, { .dev_id = "imx28-mmc.3", },
{ .dev_id = "80016000.ssp", }, { .dev_id = "80016000.ssp", },
}; };
static struct clk_lookup lcdif_lookups[] __initdata = { static struct clk_lookup lcdif_lookups[] = {
{ .dev_id = "imx28-fb", }, { .dev_id = "imx28-fb", },
{ .dev_id = "80030000.lcdif", }, { .dev_id = "80030000.lcdif", },
}; };
static struct clk_lookup gpmi_lookups[] __initdata = { static struct clk_lookup gpmi_lookups[] = {
{ .dev_id = "imx28-gpmi-nand", }, { .dev_id = "imx28-gpmi-nand", },
{ .dev_id = "8000c000.gpmi", }, { .dev_id = "8000c000.gpmi", },
}; };
static struct clk_lookup fec_lookups[] __initdata = { static struct clk_lookup fec_lookups[] = {
{ .dev_id = "imx28-fec.0", }, { .dev_id = "imx28-fec.0", },
{ .dev_id = "imx28-fec.1", }, { .dev_id = "imx28-fec.1", },
{ .dev_id = "800f0000.ethernet", }, { .dev_id = "800f0000.ethernet", },
{ .dev_id = "800f4000.ethernet", }, { .dev_id = "800f4000.ethernet", },
}; };
static struct clk_lookup can0_lookups[] __initdata = { static struct clk_lookup can0_lookups[] = {
{ .dev_id = "flexcan.0", }, { .dev_id = "flexcan.0", },
{ .dev_id = "80032000.can", }, { .dev_id = "80032000.can", },
}; };
static struct clk_lookup can1_lookups[] __initdata = { static struct clk_lookup can1_lookups[] = {
{ .dev_id = "flexcan.1", }, { .dev_id = "flexcan.1", },
{ .dev_id = "80034000.can", }, { .dev_id = "80034000.can", },
}; };
static struct clk_lookup saif0_lookups[] __initdata = { static struct clk_lookup saif0_lookups[] = {
{ .dev_id = "mxs-saif.0", }, { .dev_id = "mxs-saif.0", },
{ .dev_id = "80042000.saif", }, { .dev_id = "80042000.saif", },
}; };
static struct clk_lookup saif1_lookups[] __initdata = { static struct clk_lookup saif1_lookups[] = {
{ .dev_id = "mxs-saif.1", }, { .dev_id = "mxs-saif.1", },
{ .dev_id = "80046000.saif", }, { .dev_id = "80046000.saif", },
}; };