[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090123105936.18779.9202.sendpatchset@rx1.opensource.se>
Date: Fri, 23 Jan 2009 19:59:36 +0900
From: Magnus Damm <magnus.damm@...il.com>
To: linux-kernel@...r.kernel.org
Cc: akpm@...ux-foundation.org, johnstul@...ibm.com, gregkh@...e.de,
roel.kluin@...il.com, lethal@...ux-sh.org, tglx@...utronix.de,
mingo@...hat.com, Magnus Damm <magnus.damm@...il.com>
Subject: [PATCH 011/011] sh_cmt: add early platform support
From: Magnus Damm <damm@...l.co.jp>
This adds early platform support to the sh_cmt timer driver.
Signed-off-by: Magnus Damm <damm@...l.co.jp>
---
drivers/clocksource/sh_cmt.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
--- 0016/drivers/clocksource/sh_cmt.c
+++ work/drivers/clocksource/sh_cmt.c 2009-01-22 17:30:35.000000000 +0900
@@ -567,9 +567,19 @@ static int sh_cmt_setup(struct sh_cmt_pr
static int __devinit sh_cmt_probe(struct platform_device *pdev)
{
struct sh_cmt_priv *p = platform_get_drvdata(pdev);
+ struct sh_cmt_config *cfg = pdev->dev.platform_data;
int ret;
- p = kmalloc(sizeof(*p), GFP_KERNEL);
+ if (p) {
+ pr_info("sh_cmt: %s kept as earlytimer\n", cfg->name);
+ return 0;
+ }
+
+ if (is_early_platform_device(pdev))
+ p = alloc_bootmem(sizeof(*p));
+ else
+ p = kmalloc(sizeof(*p), GFP_KERNEL);
+
if (p == NULL) {
dev_err(&pdev->dev, "failed to allocate driver data\n");
return -ENOMEM;
@@ -577,7 +587,10 @@ static int __devinit sh_cmt_probe(struct
ret = sh_cmt_setup(p, pdev);
if (ret) {
- kfree(p);
+ if (is_early_platform_device(pdev))
+ free_bootmem(__pa(p), sizeof(*p));
+ else
+ kfree(p);
platform_set_drvdata(pdev, NULL);
}
@@ -607,6 +620,7 @@ static void __exit sh_cmt_exit(void)
platform_driver_unregister(&sh_cmt_device_driver);
}
+early_platform_init("earlytimer", &sh_cmt_device_driver);
module_init(sh_cmt_init);
module_exit(sh_cmt_exit);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists