From patchwork Tue Sep 16 23:50:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 4921681 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0821FBEEA5 for ; Tue, 16 Sep 2014 23:53:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46CDB20160 for ; Tue, 16 Sep 2014 23:53:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69159201CD for ; Tue, 16 Sep 2014 23:53:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XU2Wo-0007LT-DC; Tue, 16 Sep 2014 23:51:22 +0000 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21] helo=cam-smtp0.cambridge.arm.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XU2Wl-0007Hb-Rf for linux-arm-kernel@lists.infradead.org; Tue, 16 Sep 2014 23:51:20 +0000 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.177]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id s8GNohWi026227; Wed, 17 Sep 2014 00:50:43 +0100 From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] clocksource: arm_arch_timer: discard unavailable timers correctly Date: Wed, 17 Sep 2014 00:50:45 +0100 Message-Id: <1410911445-19067-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140916_165120_249626_6234CE15 X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -3.0 (---) Cc: Mark Rutland , Thomas Gleixner , Daniel Lezcano , Stephen Boyd , Sudeep Holla X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 we wait until both nodes are probed if we have two timers without checking if the device is actually available. This might result in non-functional system as no timer gets registered. This patch adds the check for the availablity of the timer device so that unavailable timers are discarded correctly. Cc: Stephen Boyd Cc: Mark Rutland Signed-off-by: Sudeep Holla --- drivers/clocksource/arm_arch_timer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 5163ec1..4d025ad 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -622,11 +622,15 @@ static void __init arch_timer_common_init(void) /* Wait until both nodes are probed if we have two timers */ if ((arch_timers_present & mask) != mask) { - if (of_find_matching_node(NULL, arch_timer_mem_of_match) && - !(arch_timers_present & ARCH_MEM_TIMER)) + struct device_node *dn; + + dn = of_find_matching_node(NULL, arch_timer_mem_of_match); + if (dn && of_device_is_available(dn) && + !(arch_timers_present & ARCH_MEM_TIMER)) return; - if (of_find_matching_node(NULL, arch_timer_of_match) && - !(arch_timers_present & ARCH_CP15_TIMER)) + dn = of_find_matching_node(NULL, arch_timer_of_match); + if (dn && of_device_is_available(dn) && + !(arch_timers_present & ARCH_CP15_TIMER)) return; }