From patchwork Tue May 11 19:32:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thermal-bot for Julien Panis X-Patchwork-Id: 434812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D474DC433ED for ; Tue, 11 May 2021 19:32:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A712260FDB for ; Tue, 11 May 2021 19:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231917AbhEKTdp (ORCPT ); Tue, 11 May 2021 15:33:45 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:46008 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbhEKTdp (ORCPT ); Tue, 11 May 2021 15:33:45 -0400 Date: Tue, 11 May 2021 19:32:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1620761557; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7c/gAvL2OFqWiTz4vBaXOW7xSRuv+onlTRvNRn0sAj8=; b=wLxi9o+hYgWUV0Zda16mkawXm5XOj16AabFEjCKQSNnuMx5fl15jTMU8C8U26W1lDxW43J YGj2eQvilp36GYAJLdFCjwgDqIBSTPq7O2e24aiR0yTNHfa7MHg9J+x8/8VqbVwLKQ/4g0 q+9AOxG7Bn3w4ymMS5sUDQf3/R6aRpUBtAHSNeLWi9GNUunfj3yvP2DkNhUSM4Kqg1b7sX DybOxY0dK4n+I/nVQ5YHvbP60EHUZQYMM0nuAsAIW7uAd2A+Nj83OvRBliAQFenRBBDMX5 Wa/Gj6Pc+dyI1qiwDQgxsvd7ZCc48ZADKGMtagtsJ7QEVvrfb8te+QCMVhIHbw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1620761557; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7c/gAvL2OFqWiTz4vBaXOW7xSRuv+onlTRvNRn0sAj8=; b=2pFXVVI3gxxUaMARldoJlyTpD2rXzHMQ3Fl0LzxnYOmQxG+Sa7RgQaBEvcFw8g4TJlUVmA e5taYIr4xewO9wCA== From: "tip-bot2 for Alexandre Belloni" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/urgent] alarmtimer: Check RTC features instead of ops Cc: Alexandre Belloni , Thomas Gleixner , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210511014516.563031-1-alexandre.belloni@bootlin.com> References: <20210511014516.563031-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Message-ID: <162076155630.29796.6492074988685235162.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The following commit has been merged into the timers/urgent branch of tip: Commit-ID: e09784a8a751e539dffc94d43bc917b0ac1e934a Gitweb: https://git.kernel.org/tip/e09784a8a751e539dffc94d43bc917b0ac1e934a Author: Alexandre Belloni AuthorDate: Tue, 11 May 2021 03:45:16 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 11 May 2021 21:28:04 +02:00 alarmtimer: Check RTC features instead of ops RTC drivers used to leave .set_alarm() NULL in order to signal the RTC device doesn't support alarms. The drivers are now clearing the RTC_FEATURE_ALARM bit for that purpose in order to keep the rtc_class_ops structure const. So now, .set_alarm() is set unconditionally and this possibly causes the alarmtimer code to select an RTC device that doesn't support alarms. Test RTC_FEATURE_ALARM instead of relying on ops->set_alarm to determine whether alarms are available. Fixes: 7ae41220ef58 ("rtc: introduce features bitfield") Signed-off-by: Alexandre Belloni Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210511014516.563031-1-alexandre.belloni@bootlin.com --- kernel/time/alarmtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index bea9d08..5897828 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -92,7 +92,7 @@ static int alarmtimer_rtc_add_device(struct device *dev, if (rtcdev) return -EBUSY; - if (!rtc->ops->set_alarm) + if (!test_bit(RTC_FEATURE_ALARM, rtc->features)) return -1; if (!device_may_wakeup(rtc->dev.parent)) return -1;