Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp173238pxj; Tue, 18 May 2021 00:16:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRoEocnZcYcP7fkF2ZUUUzcQeco8CRlhhqJyW/iAH6s1SGZCvoDwlmLdAn5TsxzYh9Be4P X-Received: by 2002:a05:6e02:1be8:: with SMTP id y8mr3081508ilv.52.1621322199168; Tue, 18 May 2021 00:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621322199; cv=none; d=google.com; s=arc-20160816; b=pe2yvn1ENEYurXWAGhSvm9FAI2fZ7/Q0fJfpc7dq8LQOcG8s1QTrgEA+tSKMl/X4LS LJJCJFZmqOiBIIEn5AsWaWLghhXdl25ljPNGJTWwdM7Abk02Ce4TlBTE+4a+D4lALq1W u8CU08ZM4TT76s6VzofMBReW057gov6Hv7N9YL44Tx11+DbpL73Ispw3qY1VDSs1HFHJ 5lMt8XrUILboZZU2s9xVfmauJKFWthxtXTNFS7MJ+gsU6gxu/VWwGHSSQZlI75sg5lx0 M2okVL8nmMBNBuqXso+AE3jamG53FY+7ag4BaCw7i1IKemYB1Fp3lQrwVoQ+GPvirMKd k63w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oNu85KUye0vXNXQQXByhrHw1X7vUKMpbR0hRy+8SchU=; b=dZs+sk99XVnneOQH6operP88xaPENSxdsNYTZyJug4zcKtZxVWE6Q2YLma0tOFDTa0 JnJC/fCp9PPTmx8MRdoNqtyMIMXiXGKC/O2G9zsgFFt8v4oORki2ZIxoFaUtNQiqkraG W+2OT1uJ+rISSrdGoIBI14tvh0qqE/++Ij5ONpbDGx6vbyGJ8cXsUZlt6FZ2LFYGn89l f1FLh04gbC4X9ceGD3qfD034YzIM8+Vih1jTCF1HTkKcdzIXa7Sqd1jZSQ5IjXpRbpHe DvbJlvj68WMx1fYd7Cfji/+6Rkgh/t6sGMaV6Eh4U2W37jT/6hymVVg0aN2bPQgx2jbS xQIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RetrOTNw; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j188si23320304jac.58.2021.05.18.00.16.26; Tue, 18 May 2021 00:16:39 -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=@linuxfoundation.org header.s=korg header.b=RetrOTNw; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241748AbhEQOxv (ORCPT + 99 others); Mon, 17 May 2021 10:53:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:54406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241558AbhEQOpM (ORCPT ); Mon, 17 May 2021 10:45:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 859C2613B0; Mon, 17 May 2021 14:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261267; bh=3ryTMeDjAtUSDUejj0cVzdtYD63X9CEyOhQPZ6FCQ34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RetrOTNwI4K9YvwAQ14HfTv96USkYD3AgZBcz/M7pr5IBtKwDsaCfL8thVkoijECK DbeQA16Y7KERa9cmmW/LBzv37OyCFdUgNMgjGxv19acu69uwwgbkTXLVIJ4nN36Meb GlmP/zColEUbU5sTu2ZRZ6TkWftccYQBfEE+1beA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandre Belloni , Thomas Gleixner Subject: [PATCH 5.12 327/363] alarmtimer: Check RTC features instead of ops Date: Mon, 17 May 2021 16:03:13 +0200 Message-Id: <20210517140313.662801818@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexandre Belloni commit e09784a8a751e539dffc94d43bc917b0ac1e934a upstream. 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 Signed-off-by: Greg Kroah-Hartman --- kernel/time/alarmtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -92,7 +92,7 @@ static int alarmtimer_rtc_add_device(str 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;