From patchwork Wed Sep 24 16:23:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 37844 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DCC04202FD for ; Wed, 24 Sep 2014 16:23:47 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id a1sf3751910wgh.5 for ; Wed, 24 Sep 2014 09:23:46 -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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=eSmZw/ynSRb15UtY+lBppJM/dx7jzMlMy7LXqx/vBFM=; b=ZYazXa9A2Vv6KtRK9cVhiyg516PaWZ3UnUOhSy8fFM3wdbZ5Izh2mnEAOaiRaXPMli OpcR+bxaykraebX+KO9dMS/FzFvvwAfX4GzPzAteQuUp/CCWuY4N9BfkAyLpTlvNKR4i +RXsHC+rB1R3ekkQ2JRdv+byjnii9MetrvQMwlwBBJphSwHL0L53ZG+/qSKJbA5iIOZH 0IG6UquQnCNiX4Mm28JU3ldB8Z8qn0dQm/vuvO5UsECl5iRkwzLZnMi5oncoxz3GnK+9 X/hxKVnofsVXJV7q19DOOoO/7g6iC4ezi7gWSs7xDGB6NX8uTBfubR1gjMPLSEne28aT qgcA== X-Gm-Message-State: ALoCoQmiXqmzsuxDvOH/jER2+0pj089KTJOSzBBIpNw5ju1UgWWb1iN7H+w3AH76MaucjhFDOutU X-Received: by 10.112.149.67 with SMTP id ty3mr1196002lbb.1.1411575826599; Wed, 24 Sep 2014 09:23:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.101 with SMTP id l5ls167851lam.103.gmail; Wed, 24 Sep 2014 09:23:46 -0700 (PDT) X-Received: by 10.152.19.166 with SMTP id g6mr7319003lae.37.1411575826407; Wed, 24 Sep 2014 09:23:46 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) by mx.google.com with ESMTPS id c6si23427753laf.105.2014.09.24.09.23.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 09:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id el20so4566194lab.18 for ; Wed, 24 Sep 2014 09:23:46 -0700 (PDT) X-Received: by 10.152.42.136 with SMTP id o8mr7386376lal.71.1411575826345; Wed, 24 Sep 2014 09:23:46 -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 of9csp611166lbb; Wed, 24 Sep 2014 09:23:45 -0700 (PDT) X-Received: by 10.68.68.238 with SMTP id z14mr10264514pbt.121.1411575824648; Wed, 24 Sep 2014 09:23:44 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay8si9380494pdb.81.2014.09.24.09.23.42 for ; Wed, 24 Sep 2014 09:23:44 -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 S1753528AbaIXQXk (ORCPT + 27 others); Wed, 24 Sep 2014 12:23:40 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:52712 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751551AbaIXQXj (ORCPT ); Wed, 24 Sep 2014 12:23:39 -0400 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.153]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id s8OGN5c6025951; Wed, 24 Sep 2014 17:23:05 +0100 From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Daniel Lezcano Cc: Thomas Gleixner , Sudeep Holla Subject: [PATCH v3] clocksource: arm_arch_timer: discard unavailable timers correctly Date: Wed, 24 Sep 2014 17:23:03 +0100 Message-Id: <1411575783-2960-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410982774-4724-1-git-send-email-sudeep.holla@arm.com> References: <1410982774-4724-1-git-send-email-sudeep.holla@arm.com> 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.215.45 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 cp15 and mem timers are probed if we have both timer device nodes present in the device tree without checking if the device is actually available. If one of the timer device node present is disabled, the system locks up on the boot as no timer gets registered. This patch adds the check for the availability of the timer device so that unavailable timers are discarded correctly. It also adds the missing of_node_put. Signed-off-by: Sudeep Holla Reviewed-by: Stephen Boyd Acked-by: Mark Rutland --- drivers/clocksource/arm_arch_timer.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) Hi Daniel, Can you pick up this fix for v3.18 ? Regards, Sudeep Changes v2->v3: - Minor nit in the commit message - Added acks/review tags Changes v1->v2: - Added missing of_node_put in the original code - Updated the commit log as suggested diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 5163ec13429d..7e267e3990ab 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -616,17 +616,29 @@ static const struct of_device_id arch_timer_mem_of_match[] __initconst = { {}, }; +static bool __init +arch_timer_probed(int type, const struct of_device_id *matches) +{ + struct device_node *dn; + bool probed = false; + + dn = of_find_matching_node(NULL, matches); + if (dn && of_device_is_available(dn) && (arch_timers_present & type)) + probed = true; + of_node_put(dn); + + return probed; +} + static void __init arch_timer_common_init(void) { unsigned mask = ARCH_CP15_TIMER | ARCH_MEM_TIMER; /* 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)) + if (!arch_timer_probed(ARCH_MEM_TIMER, arch_timer_mem_of_match)) return; - if (of_find_matching_node(NULL, arch_timer_of_match) && - !(arch_timers_present & ARCH_CP15_TIMER)) + if (!arch_timer_probed(ARCH_CP15_TIMER, arch_timer_of_match)) return; }