From patchwork Tue Apr 28 08:19:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 20356 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3S8Mc94017639 for ; Tue, 28 Apr 2009 08:22:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758970AbZD1IWh (ORCPT ); Tue, 28 Apr 2009 04:22:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759661AbZD1IWh (ORCPT ); Tue, 28 Apr 2009 04:22:37 -0400 Received: from wa-out-1112.google.com ([209.85.146.183]:47889 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758970AbZD1IWf (ORCPT ); Tue, 28 Apr 2009 04:22:35 -0400 Received: by wa-out-1112.google.com with SMTP id j5so215499wah.21 for ; Tue, 28 Apr 2009 01:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=tGuBSsp+pgwdQh5uYPkXpcxJgo1C9Fd8wRJAIWOf95E=; b=DvWz/4BrQx2K3UCRZrXaF55SjWjQ/B1uq8yGZXkNk82t8XwgarR34v6KRP22R+sZta DKnKAxsHIVAJBHi5SzLaPCyV0sH6uz2qNmxrQ7Bpv89oGxfDJkx7IPMQUEnPEizYwRt2 rjqpLF9iLlLjZfnz5kP6Ck+pNCE9SmhzU6wRI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=Fv+Itxtp6drwMf+ZyXKCMWisbDsHfqxaDWIzN/H5SjuNk6lkIxXbKCTr8q4fZrho9F vcAfME1yuC0XUSYRH6l+3REpqYbGM8Sxns078svhqiehhnGRnnz8m7z909eyW/cYvbM9 rcDZ8Q3JLmsXuwrTjpHrns0CUTmuImJuxi02Y= Received: by 10.114.37.1 with SMTP id k1mr2923712wak.172.1240906955234; Tue, 28 Apr 2009 01:22:35 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id l37sm3490771waf.5.2009.04.28.01.22.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Apr 2009 01:22:34 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: johnstul@us.ibm.com, Magnus Damm , lethal@linux-sh.org Date: Tue, 28 Apr 2009 17:19:50 +0900 Message-Id: <20090428081950.16616.54750.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh: setup timers in late_time_init() Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm This patch moves the SuperH timer setup code from time_init() to late_time_init(). Good things about this change: - interrupts: they are enabled at late_time_init() - mm: regular kmalloc() can be used at late_time_init() Together with moving to late_time_init() this patch changes the sh_cmt driver to always allocate with kmalloc(). This simplifies the code a bit and also fixes section mismatches. Signed-off-by: Magnus Damm --- arch/sh/kernel/time_32.c | 34 ++++++++++++++++++++-------------- drivers/clocksource/sh_cmt.c | 13 ++----------- 2 files changed, 22 insertions(+), 25 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/sh/kernel/time_32.c +++ work/arch/sh/kernel/time_32.c 2009-04-28 12:56:26.000000000 +0900 @@ -237,21 +237,8 @@ unsigned long long sched_clock(void) } #endif -void __init time_init(void) +static void __init sh_late_time_init(void) { - if (board_time_init) - board_time_init(); - - clk_init(); - - rtc_sh_get_time(&xtime); - set_normalized_timespec(&wall_to_monotonic, - -xtime.tv_sec, -xtime.tv_nsec); - -#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST - local_timer_setup(smp_processor_id()); -#endif - /* * Make sure all compiled-in early timers register themselves. * Run probe() for one "earlytimer" device. @@ -270,3 +257,22 @@ void __init time_init(void) printk(KERN_INFO "Using %s for system timer\n", sys_timer->name); } + +void __init time_init(void) +{ + if (board_time_init) + board_time_init(); + + clk_init(); + + rtc_sh_get_time(&xtime); + set_normalized_timespec(&wall_to_monotonic, + -xtime.tv_sec, -xtime.tv_nsec); + +#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST + local_timer_setup(smp_processor_id()); +#endif + + late_time_init = sh_late_time_init; +} + --- 0003/drivers/clocksource/sh_cmt.c +++ work/drivers/clocksource/sh_cmt.c 2009-04-28 12:41:39.000000000 +0900 @@ -18,7 +18,6 @@ */ #include -#include #include #include #include @@ -645,11 +644,7 @@ static int __devinit sh_cmt_probe(struct return 0; } - if (is_early_platform_device(pdev)) - p = alloc_bootmem(sizeof(*p)); - else - p = kmalloc(sizeof(*p), GFP_KERNEL); - + p = kmalloc(sizeof(*p), GFP_KERNEL); if (p == NULL) { dev_err(&pdev->dev, "failed to allocate driver data\n"); return -ENOMEM; @@ -657,11 +652,7 @@ static int __devinit sh_cmt_probe(struct ret = sh_cmt_setup(p, pdev); if (ret) { - if (is_early_platform_device(pdev)) - free_bootmem(__pa(p), sizeof(*p)); - else - kfree(p); - + kfree(p); platform_set_drvdata(pdev, NULL); } return ret;