From patchwork Tue Jun 18 15:20:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2742961 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1B3E59F39E for ; Tue, 18 Jun 2013 15:26:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4F9A204AF for ; Tue, 18 Jun 2013 15:26:04 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1B393204AC for ; Tue, 18 Jun 2013 15:26:03 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoxkQ-0003Kr-1e; Tue, 18 Jun 2013 15:23:07 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uoxjj-0003Hw-Pm; Tue, 18 Jun 2013 15:22:23 +0000 Received: from mail-pb0-x229.google.com ([2607:f8b0:400e:c01::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uoxj9-0003B3-VR for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2013 15:21:49 +0000 Received: by mail-pb0-f41.google.com with SMTP id rp16so4047342pbb.28 for ; Tue, 18 Jun 2013 08:21:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=kZbtdDk6Yw0qo/TkRKfHb1WrE+/NQBwSny/SvjAYUss=; b=VIRvr/evEmgJywJGlktd5TEDko8spJtv3Mm1JSMcs0AXsCvQB+kzLPx/tYRH+hxaLa Bjh9Ri4a5tvI9VL1HOzmpOjhN1OCyng2EGJQ2pYR+dtFbEdN6lydlCtIMM9HD9qBjM+q JPR3GOJ6vUtyp2BsVfsYNEZjRJNxLGsCCP01qkM1cOcuWy9ZauadGO5hokOE7Jnev/nF Nb9g0TwAKs+b1P5gWl5Li+8Ok5J/QAnqimThk8qec04BjTtbtWv6ZQM4YcJ1AqwDiC9f VJVCwXTxCBMQKNP5/0sOsEU/tYIQyti5ljiXAUNSnrFq82S5zS/vL55qHh2gRzNx/J4v cMeg== X-Received: by 10.68.48.197 with SMTP id o5mr18053896pbn.184.1371568885415; Tue, 18 Jun 2013 08:21:25 -0700 (PDT) Received: from localhost ([122.167.240.191]) by mx.google.com with ESMTPSA id ty8sm20110098pac.8.2013.06.18.08.21.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 18 Jun 2013 08:21:24 -0700 (PDT) From: Viresh Kumar To: wim@iguana.be Subject: [PATCH V3 05/14] watchdog/mpcore_wdt: Set default heartbeat in probe instead of init Date: Tue, 18 Jun 2013 20:50:29 +0530 Message-Id: <683596e050b7fe09ab0c473db1648b0269ee6671.1371535242.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQkbGDdN51Sy4KG/pLNO2q87nUHX55YM9wCVSz0K6J56jvFhuKN0XnnjqaneS6qI2dKZJ+TR X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130618_112148_167520_C3381F30 X-CRM114-Status: GOOD ( 13.37 ) X-Spam-Score: -1.9 (-) Cc: marc.zyngier@arm.com, Viresh Kumar , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently mpcore_margin is handled in mpcore_wdt_init routine, which will be called even if we haven't added any device for watchdog. This patch moves this code into probe routine, so that it only gets hit once we add device for this driver. This also uses dev_info() style print statements instead of printk() Signed-off-by: Viresh Kumar --- drivers/watchdog/mpcore_wdt.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c index ca9afa7..b699df4 100644 --- a/drivers/watchdog/mpcore_wdt.c +++ b/drivers/watchdog/mpcore_wdt.c @@ -224,6 +224,21 @@ static int mpcore_wdt_probe(struct platform_device *pdev) goto err_register; } + /* + * Check that the mpcore_margin value is within it's range; if not reset + * to the default + */ + if (mpcore_margin < MIN_TIME || mpcore_margin > MAX_TIME) { + mpcore_margin = TIMER_MARGIN; + dev_info(wdt->dev, "mpcore_margin value must be 0 < mpcore_margin < 65536, using %d\n", + TIMER_MARGIN); + } + + mpcore_wdt_set_heartbeat(NULL, mpcore_margin); + dev_info(wdt->dev, "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d " + "mpcore_margin=%d sec (nowayout= %d)\n", mpcore_noboot, + mpcore_margin, nowayout); + return 0; err_register: @@ -281,20 +296,6 @@ static struct platform_driver mpcore_wdt_driver = { static int __init mpcore_wdt_init(void) { - /* - * Check that the mpcore_margin value is within it's range; - * if not reset to the default - */ - if (mpcore_margin < MIN_TIME || mpcore_margin > MAX_TIME) { - mpcore_margin = TIMER_MARGIN; - pr_info("mpcore_margin value must be 0 < mpcore_margin < 65536, using %d\n", - TIMER_MARGIN); - } - - mpcore_wdt_set_heartbeat(NULL, mpcore_margin); - pr_info("MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n", - mpcore_noboot, mpcore_margin, nowayout); - return platform_driver_register(&mpcore_wdt_driver); }