Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3113466pxb; Mon, 18 Oct 2021 08:28:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3x+XOH0sF6lzxETXWr0FjDc58riaqushofnFUIubILiGmqXY7/s2gwD/BQKT04tlM02JT X-Received: by 2002:a7b:c393:: with SMTP id s19mr32039173wmj.13.1634570897432; Mon, 18 Oct 2021 08:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634570897; cv=none; d=google.com; s=arc-20160816; b=TcHJtDpAaQVuj5WW86rm7xMPMQOe3l4xB5I9fiYr498yn3UsTADQIylAvZ2+ELR3MB u6l5q+sRbwUT+mC67PfX4hPoTiiIaPJmgykcbXi1bpH09iLkFq9u49c04usDFTLZBSV7 tyPysqfxBzyYHimMd+s3O3XyXlNO5uw43Z62qCAybgF4H57IYEITzAzHABKlifLeV3B+ VU5fw+GXmQDLK9f1ulMrp+39X75+PP34VSooKwpQE3cdHrvjBG3a0dBypAeGFwAMVLaw fBueF0IksUBSmAaNuy7oEyCdKv+JOIQFCcpQnGXRUUS16XbmIWPjLHzFqDBxJZ8NMv4w fBBA== 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 :message-id:date:subject:cc:to:from; bh=twYCoMCj7eAeiW8FEPgByukTSJpjrzZ/2fCmaTYcSUY=; b=BVLzBqIzvqT9tmbkP2nll0T3gL05iAgDjHu1TvhGj/ixst1d2D7sjxfEaBI8HAqumJ VpNho2fDx7xqnQ08eyrUbGwyc9oBu0QukVWdSzZcS8FSCTmYVw4A/ZZFAbLQItc4tzUy 81wCNlHp2+JoGZhjf9DPqD+FKdZ2o7fe4TdeU85Pz3OtWZfJTtCE+yYLNklWKha2c7Lt PptUmoDDaMgTCkq5CHZUXXhs6DidH9CO/PeSt2mGzByKpBBd7Tb2GjmxN3cNLDpdXEGH aItm8HFL/q7NRlNqKRnlvt9U0iNk2lj61SfO5p+zGBzVwySkZ5N4+gLTSZOeU5gAxlT9 46tg== ARC-Authentication-Results: i=1; mx.google.com; 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 z3si18624897edl.170.2021.10.18.08.27.51; Mon, 18 Oct 2021 08:28:17 -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; 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 S233278AbhJRPZx (ORCPT + 99 others); Mon, 18 Oct 2021 11:25:53 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:58753 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232818AbhJRPZw (ORCPT ); Mon, 18 Oct 2021 11:25:52 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 8C0841BF218; Mon, 18 Oct 2021 15:23:39 +0000 (UTC) From: Alexandre Belloni To: Alessandro Zummo , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rtc: expose RTC_FEATURE_UPDATE_INTERRUPT Date: Mon, 18 Oct 2021 17:23:36 +0200 Message-Id: <20211018152337.78732-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set RTC_FEATURE_UPDATE_INTERRUPT by default and clear it when it is not supported. Signed-off-by: Alexandre Belloni --- drivers/rtc/class.c | 4 ++++ drivers/rtc/interface.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 2e0cbc190a8a..4b460c61f1d8 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -232,6 +232,7 @@ static struct rtc_device *rtc_allocate_device(void) rtc->pie_enabled = 0; set_bit(RTC_FEATURE_ALARM, rtc->features); + set_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); return rtc; } @@ -389,6 +390,9 @@ int __devm_rtc_register_device(struct module *owner, struct rtc_device *rtc) if (!rtc->ops->set_alarm) clear_bit(RTC_FEATURE_ALARM, rtc->features); + if (rtc->uie_unsupported) + clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); + if (rtc->ops->set_offset) set_bit(RTC_FEATURE_CORRECTION, rtc->features); diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 9a2bd4947007..d005623e6eb3 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -561,7 +561,8 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled) if (rtc->uie_rtctimer.enabled == enabled) goto out; - if (rtc->uie_unsupported || !test_bit(RTC_FEATURE_ALARM, rtc->features)) { + if (!test_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features) || + !test_bit(RTC_FEATURE_ALARM, rtc->features)) { mutex_unlock(&rtc->ops_lock); #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL return rtc_dev_update_irq_enable_emul(rtc, enabled); -- 2.31.1