From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755082AbaIQABK (ORCPT ); Tue, 16 Sep 2014 20:01:10 -0400 Received: from smtp.codeaurora.org ([198.145.11.231]:47173 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753968AbaIQABG (ORCPT ); Tue, 16 Sep 2014 20:01:06 -0400 Date: Tue, 16 Sep 2014 17:01:04 -0700 From: Stephen Boyd To: Sudeep Holla Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Daniel Lezcano , Thomas Gleixner , Mark Rutland Subject: Re: [PATCH] clocksource: arm_arch_timer: discard unavailable timers correctly Message-ID: <20140917000104.GA10233@codeaurora.org> References: <1410911445-19067-1-git-send-email-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1410911445-19067-1-git-send-email-sudeep.holla@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/17, Sudeep Holla wrote: > Currently we wait until both nodes are probed if we have two timers > without checking if the device is actually available. This might device node is actually available? > 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 > --- Looks mostly ok. Comment below could be a follow up I guess. > 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; Where's the of_node_put()? -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation