public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, johnstul@us.ibm.com, gregkh@suse.de,
	roel.kluin@gmail.com, lethal@linux-sh.org, tglx@linutronix.de,
	mingo@redhat.com, Magnus Damm <magnus.damm@gmail.com>
Subject: [PATCH 011/011] sh_cmt: add early platform support
Date: Fri, 23 Jan 2009 19:59:36 +0900	[thread overview]
Message-ID: <20090123105936.18779.9202.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20090123105721.18779.80514.sendpatchset@rx1.opensource.se>

From: Magnus Damm <damm@igel.co.jp>

This adds early platform support to the sh_cmt timer driver.

Signed-off-by: Magnus Damm <damm@igel.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);
 

  parent reply	other threads:[~2009-01-23 11:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23 10:57 [PATCH 000/011] early platform patches Magnus Damm
2009-01-23 10:57 ` [PATCH 001/011] early platform driver V3 Magnus Damm
2009-01-23 10:57 ` [PATCH 002/011] sh: add plat_early_device_setup() function Magnus Damm
2009-01-23 10:58 ` [PATCH 003/011] sh: plat_early_device_setup() for sh2 Magnus Damm
2009-01-23 10:58 ` [PATCH 004/011] sh: plat_early_device_setup() for sh2a Magnus Damm
2009-01-23 10:58 ` [PATCH 005/011] sh: plat_early_device_setup() for sh3 Magnus Damm
2009-01-23 10:58 ` [PATCH 006/011] sh: plat_early_device_setup() for sh4 Magnus Damm
2009-01-23 10:58 ` [PATCH 007/011] sh: plat_early_device_setup() for sh4a Magnus Damm
2009-01-23 10:59 ` [PATCH 008/011] sh: add early platform support for earlyprintk Magnus Damm
2009-01-23 10:59 ` [PATCH 009/011] sh-sci: add early platform support Magnus Damm
2009-01-23 10:59 ` [PATCH 010/011] sh: add early platform support for earlytimer Magnus Damm
2009-01-23 10:59 ` Magnus Damm [this message]
2009-01-29  0:51 ` [PATCH 000/011] early platform patches Andrew Morton

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=20090123105936.18779.9202.sendpatchset@rx1.opensource.se \
    --to=magnus.damm@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=johnstul@us.ibm.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=roel.kluin@gmail.com \
    --cc=tglx@linutronix.de \
    /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