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: 37483 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4FBD920549 for ; Tue, 16 Sep 2014 23:51:37 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e53sf460903eek.10 for ; Tue, 16 Sep 2014 16:51:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=2VqwCTNOsXKGh1pFlbRyEa4NK3RknCp+n4m1nPdmmGg=; b=VZe/QvKj4RHguLGY8dOEbzfVmO+/MVFMqLIGukYeSC/xz2zuTXae+WbPhw8IrCC9RA eSECaY5XKcEydt0fAOz2WyS82Q4rH13UXpfMuuXdFmyYXmjq2mGRE7WUOxjNH6JiZarx j5V8EFkOWjWT2+CRWkhajxK58wpJKYerWiPlFqE4f9wy52v5Jbh2zS3cDAycp2fwPn+A eQ/upxniy0KWrt34KpUsW5VLAWZS74zZ74khPvxkhH9QlUWwSDP1APTYtDbEG8PWDAsw uGEwA/p7tA6JfCcQG21h+WE8J6GIyIG6FPBJ5Bo0O2rTMUyX0r1DKehCgTJEe4mgjrLs Lfug== X-Gm-Message-State: ALoCoQlhi47Lc2P284xhrCttI8OEhrHRF2vyq+BLDaE3JIOzN4Kh0MjkfsdpJm226FcPWMzg07SF X-Received: by 10.152.3.134 with SMTP id c6mr1037248lac.5.1410911496055; Tue, 16 Sep 2014 16:51:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.171 with SMTP id p11ls45755lal.68.gmail; Tue, 16 Sep 2014 16:51:35 -0700 (PDT) X-Received: by 10.112.129.228 with SMTP id nz4mr38191175lbb.9.1410911495570; Tue, 16 Sep 2014 16:51:35 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by mx.google.com with ESMTPS id jo5si26244517lbc.130.2014.09.16.16.51.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 16:51:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id n15so807909lbi.34 for ; Tue, 16 Sep 2014 16:51:35 -0700 (PDT) X-Received: by 10.112.147.74 with SMTP id ti10mr37878752lbb.29.1410911495423; Tue, 16 Sep 2014 16:51:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp488970lbb; Tue, 16 Sep 2014 16:51:34 -0700 (PDT) X-Received: by 10.68.203.5 with SMTP id km5mr54212287pbc.91.1410911493955; Tue, 16 Sep 2014 16:51:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ha11si31944543pbd.198.2014.09.16.16.51.33 for ; Tue, 16 Sep 2014 16:51:33 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754360AbaIPXvX (ORCPT + 27 others); Tue, 16 Sep 2014 19:51:23 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:51301 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754232AbaIPXvW (ORCPT ); Tue, 16 Sep 2014 19:51:22 -0400 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 Cc: Daniel Lezcano , Thomas Gleixner , Sudeep Holla , Stephen Boyd , Mark Rutland 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sudeep.holla@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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; }