Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp51660ybg; Mon, 8 Jun 2020 16:11:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTpftV+rdn5Aw8v21BiXH17CA2B6uIRBGpinF6d9rTH6tO/yQp4EtPG4uJ2OiEdA5MW3vi X-Received: by 2002:a17:906:a250:: with SMTP id bi16mr22139915ejb.418.1591657866697; Mon, 08 Jun 2020 16:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591657866; cv=none; d=google.com; s=arc-20160816; b=UFC5wG5sgr5nF4mEcmweIotL09NfsjwTYPVjgjIhVw8gdsHjzLzvDrUUrX/SRi9MC9 7ZVhiBwAKV8HZbEoJVz953/BVUyad38WxWiBywR4GhxcP8iBL8xv9cCw0a6gV1LPWEOe wOcbkc26eb2VQCaJFkhF69hoSywI9nMH9FP139A+sXoGfSHu+h7NlJCVC003NrWOxRv+ p9YmCOfJK6lfwTYHj7/qkpDuPvS0grHiZGH7He8GEb9f7ck2vDHaEMXuiYuRfIcJIGN0 OW22jgBc/Q10Y2IuvuD/G+uUwwQ2JgrG26HTYszXtJAqtzViL4H758c47Ci7Xtpt5CCd Jobw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rind4NsDmsXM+YTnNe8gXNDoVmKXrzmkiC+8CFl/UIU=; b=FgSjdGE+hoDM9HNN3qxZ14mQg00UzdQsSQ/m1yzag0uSCPir7if4yb4ZBQjK2byKsb sa0/H2SLTTTKOEcNK40Mj55g+bohXaUve5Jg6uhSEtT4NgzVwHtVwiCd9cDSEfNATrJS NsSzGmftNWUxgnjgq4m/y583oGM1p1CU2yacxh/YJivWs0Jq9rdWeNWof3IpEd4yd2Rc NKTGmPMrX/DA+Or4psrje4p7LJf4gSv3FAfkp1y7SjlPrrfRqI/mvWpSbSWLVA/cqJbX RGdnBvr3TxdnKQKVhuAGo6w1jHQYtXGANb3Wck8EvxWIDBF33ixAoQ55elZ/hvdnQ3bI w5HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pMsHlDyM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm19si12037245ejc.17.2020.06.08.16.10.44; Mon, 08 Jun 2020 16:11:06 -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=pMsHlDyM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728160AbgFHXIZ (ORCPT + 99 others); Mon, 8 Jun 2020 19:08:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:51900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727921AbgFHXHd (ORCPT ); Mon, 8 Jun 2020 19:07:33 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C3D92085B; Mon, 8 Jun 2020 23:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657652; bh=/wDY0J7ZCbV+kbdSd0PMHEoJW6LCkYfxvOWL2ZHCfxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pMsHlDyMBR+f+Xd+6px2duDUDKYNdoIKJ1qMHdrYmdPfhAemsENyx11G1sEQofb92 cvCImSCl2iKa7Gq0mhZyKzoZjzgD5dP5hrgpJUuyM5ljSunVAWB/OscyELOAjXm57c x/kDYQ1Qb9n8JNU3w5Aj5VgIMMZs4sTqbcSK5Kog= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: 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 AUTOSEL 5.7 065/274] clocksource: dw_apb_timer_of: Fix missing clockevent timers Date: Mon, 8 Jun 2020 19:02:38 -0400 Message-Id: <20200608230607.3361041-65-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 8c28b127759f..6921b91b61ef 100644 --- a/drivers/clocksource/dw_apb_timer_of.c +++ b/drivers/clocksource/dw_apb_timer_of.c @@ -147,10 +147,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); @@ -161,6 +157,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