Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp998611ybt; Fri, 19 Jun 2020 21:05:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuO9WYTzgAuS77i/a9xBlUYz2MaawIV6ipV9USYpMBaZMVxRaPaQDrdVP1C8kBZeKXzmRD X-Received: by 2002:a17:906:af62:: with SMTP id os2mr6365780ejb.345.1592625943864; Fri, 19 Jun 2020 21:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592625943; cv=none; d=google.com; s=arc-20160816; b=FzjHmWvmcnHduvUP5ANFPUq3OGhsVJ0B/uCzT+lM3EY7W6LED7e4E85liFiHmukzYG P/Y7eAy66y/NqyzDSDbkvqO4LNQ8aawEdpJmpQlU9rH8tFtOJ7EwvGvZr5EPU/0UGI9+ F6Qs3bFIQR+HCor2dlVeBa6bGuzXXcyAI8Kt7k+XvC/iIw3cB0rIyP4pQY9jcHc3gGDg RB3q2ITSDnKIqhj8uj3aFGiTNoKlt6gN2Q2fDVFT57olzSMpMKb27083IVtstyHgLqaA FToIpCqo+LbSzgMMziG6Toc/YlAV3suWngEMNaOKJaO0SqYYXeOf6g7A7Zxj6jkzgaJ4 ZK/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TWKdJrIcbcHjWhTTVoB4mkXYw3slpqAyhgPs1kVbm0k=; b=hMa2nga1kxKTBoK2/W8aGOgscdi2bwafQmZhjRjes1X3WLEG2k5tZAyqeRaF+72Z/t K0mp2A7TmoLIsU4P5RYet9A39iBAxDnbSSAH5kpRvQ6lScDvzEUZMJWNrnr8FNpT0Eqv ZGUzVQR6uNntUHybtYN5ob43Km2jCIytBkGzMxXv90zv7WqXh8bgZxAQbHq0iT0n+PJ7 R9rKCz0MCeL1GNTg+yzvPJIj+TwOYPby1dm6pvH8EBwA9e0tjqBwqLwqLUvzNLpizIlB jS7SI6TPIVOHNL6EklOOAlQT8BE2n81fPyGRmU08rDUg0eAb3twa5pZbxoBkGkBvuUrp yzXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1D8NxPH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si5792722edn.383.2020.06.19.21.05.22; Fri, 19 Jun 2020 21:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1D8NxPH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395480AbgFSQo1 (ORCPT + 99 others); Fri, 19 Jun 2020 12:44:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:34248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388446AbgFSOnN (ORCPT ); Fri, 19 Jun 2020 10:43:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4814C2166E; Fri, 19 Jun 2020 14:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577792; bh=f1V455MIpPmgMu8VkJ6CW9z6ZykWPwkYorbzYRpxZvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1D8NxPH4k7GqzRZxb8VbpiIcyPsYSVb2K77lTQrnu6JwVf05oSpvAhnRP8KYJlQ32 nx81RWc225zUSbdlMiVIqE80xVjlW6QHQWzMIptOnLubbfN0m8cd75ZBqAawK9vyR4 IGP7RHPsRqbSz7XhtwcmBYYvpwAz0jIG1J4wmiVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Alexey Malahov , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Alessandro Zummo , Alexandre Belloni , Arnd Bergmann , Rob Herring , linux-mips@vger.kernel.org, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, Daniel Lezcano , Sasha Levin Subject: [PATCH 4.9 062/128] clocksource: dw_apb_timer_of: Fix missing clockevent timers Date: Fri, 19 Jun 2020 16:32:36 +0200 Message-Id: <20200619141623.495923419@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141620.148019466@linuxfoundation.org> References: <20200619141620.148019466@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin [ Upstream commit 6d2e16a3181bafb77b535095c39ad1c8b9558c8c ] Commit 100214889973 ("clocksource: dw_apb_timer_of: use clocksource_of_init") replaced a publicly available driver initialization method with one called by the timer_probe() method available after CLKSRC_OF. In current implementation it traverses all the timers available in the system and calls their initialization methods if corresponding devices were either in dtb or in acpi. But if before the commit any number of available timers would be installed as clockevent and clocksource devices, after that there would be at most two. The rest are just ignored since default case branch doesn't do anything. I don't see a reason of such behaviour, neither the commit message explains it. Moreover this might be wrong if on some platforms these timers might be used for different purpose, as virtually CPU-local clockevent timers and as an independent broadcast timer. So in order to keep the compatibility with the platforms where the order of the timers detection has some meaning, lets add the secondly discovered timer to be of clocksource/sched_clock type, while the very first and the others would provide the clockevents service. Fixes: 100214889973 ("clocksource: dw_apb_timer_of: use clocksource_of_init") Signed-off-by: Serge Semin Cc: Alexey Malahov Cc: Thomas Bogendoerfer Cc: Paul Burton Cc: Ralf Baechle Cc: Alessandro Zummo Cc: Alexandre Belloni Cc: Arnd Bergmann Cc: Rob Herring Cc: linux-mips@vger.kernel.org Cc: linux-rtc@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200521204818.25436-7-Sergey.Semin@baikalelectronics.ru Signed-off-by: Sasha Levin --- drivers/clocksource/dw_apb_timer_of.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c index aee6c0d39a7c..024e6cc5025b 100644 --- a/drivers/clocksource/dw_apb_timer_of.c +++ b/drivers/clocksource/dw_apb_timer_of.c @@ -146,10 +146,6 @@ static int num_called; static int __init dw_apb_timer_init(struct device_node *timer) { switch (num_called) { - case 0: - pr_debug("%s: found clockevent timer\n", __func__); - add_clockevent(timer); - break; case 1: pr_debug("%s: found clocksource timer\n", __func__); add_clocksource(timer); @@ -160,6 +156,8 @@ static int __init dw_apb_timer_init(struct device_node *timer) #endif break; default: + pr_debug("%s: found clockevent timer\n", __func__); + add_clockevent(timer); break; } -- 2.25.1