From patchwork Sun Jan 10 23:17:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009561 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 87704C433DB for ; Sun, 10 Jan 2021 23:20:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 465CB227C3 for ; Sun, 10 Jan 2021 23:20:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 465CB227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=249dL25SIbltcwmgEyw0WL/uDKpT6kgbKsTJA5cmU44=; b=fzU8EQBNMPS3Eq0dbtp2hud2g MmpClrPUFFrVtOIKT5mkBlNxmLzC1e2x3E17hsbx0EDo0bqXH1RSP2vygYUywjl5FDOLbpAx1vZPU BSrBUNVNGYIvmOKCk7mC+hrtxz3rFaCoJdF+N6UlbYpjNZMnGjA5yf9tu/QmT8DnaLQAXbBe1GlYZ DqgwFOKPNIdMH1HBJVh7467LccyPRY9klbXHWM7BhqKxebf2Ixu0vh+Bq1zfOW60eSJXKE5mTrYHx gefB2x8Y+CBNJrCc76NYvRtMfW7IzCn1QCHYAmEr6gb2dseQYfagYOEDzFkSN1Bka7hzuEIyiFS3u H+f8/wlFg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjys-0001d8-KT; Sun, 10 Jan 2021 23:18:42 +0000 Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyN-0001QA-GX for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:13 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id B812420004; Sun, 10 Jan 2021 23:18:02 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 01/17] rtc: introduce features bitfield Date: Mon, 11 Jan 2021 00:17:36 +0100 Message-Id: <20210110231752.1418816-2-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181811_792200_34189B32 X-CRM114-Status: GOOD ( 18.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce a bitfield to allow the drivers to announce the available features for an RTC. The main use case would be to better handle alarms, that could be present or not or have a minute resolution or may need a correct week day to be set. Use the newly introduced RTC_FEATURE_ALARM bit to then test whether alarms are available instead of relying on the presence of ops->set_alarm. Signed-off-by: Alexandre Belloni --- drivers/rtc/class.c | 5 +++++ drivers/rtc/interface.c | 12 ++++++------ include/linux/rtc.h | 2 ++ include/uapi/linux/rtc.h | 5 +++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 7e470fbd5e4d..03abd0aa229a 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -231,6 +231,8 @@ static struct rtc_device *rtc_allocate_device(void) rtc->pie_timer.function = rtc_pie_update_irq; rtc->pie_enabled = 0; + set_bit(RTC_FEATURE_ALARM, rtc->features); + return rtc; } @@ -386,6 +388,9 @@ int __devm_rtc_register_device(struct module *owner, struct rtc_device *rtc) return -EINVAL; } + if (!rtc->ops->set_alarm) + clear_bit(RTC_FEATURE_ALARM, rtc->features); + rtc->owner = owner; rtc_device_get_offset(rtc); diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 794a4f036b99..dcb34c73319e 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -186,7 +186,7 @@ static int rtc_read_alarm_internal(struct rtc_device *rtc, if (!rtc->ops) { err = -ENODEV; - } else if (!rtc->ops->read_alarm) { + } else if (!test_bit(RTC_FEATURE_ALARM, rtc->features) || !rtc->ops->read_alarm) { err = -EINVAL; } else { alarm->enabled = 0; @@ -392,7 +392,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) return err; if (!rtc->ops) { err = -ENODEV; - } else if (!rtc->ops->read_alarm) { + } else if (!test_bit(RTC_FEATURE_ALARM, rtc->features) || !rtc->ops->read_alarm) { err = -EINVAL; } else { memset(alarm, 0, sizeof(struct rtc_wkalrm)); @@ -436,7 +436,7 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) if (!rtc->ops) err = -ENODEV; - else if (!rtc->ops->set_alarm) + else if (!test_bit(RTC_FEATURE_ALARM, rtc->features)) err = -EINVAL; else err = rtc->ops->set_alarm(rtc->dev.parent, alarm); @@ -451,7 +451,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) if (!rtc->ops) return -ENODEV; - else if (!rtc->ops->set_alarm) + else if (!test_bit(RTC_FEATURE_ALARM, rtc->features)) return -EINVAL; err = rtc_valid_tm(&alarm->time); @@ -531,7 +531,7 @@ int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled) /* nothing */; else if (!rtc->ops) err = -ENODEV; - else if (!rtc->ops->alarm_irq_enable) + else if (!test_bit(RTC_FEATURE_ALARM, rtc->features) || !rtc->ops->alarm_irq_enable) err = -EINVAL; else err = rtc->ops->alarm_irq_enable(rtc->dev.parent, enabled); @@ -843,7 +843,7 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) static void rtc_alarm_disable(struct rtc_device *rtc) { - if (!rtc->ops || !rtc->ops->alarm_irq_enable) + if (!rtc->ops || !test_bit(RTC_FEATURE_ALARM, rtc->features) || !rtc->ops->alarm_irq_enable) return; rtc->ops->alarm_irq_enable(rtc->dev.parent, false); diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 568909449c13..bd611e26291d 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -141,6 +141,8 @@ struct rtc_device { */ unsigned long set_offset_nsec; + unsigned long features[BITS_TO_LONGS(RTC_FEATURE_CNT)]; + time64_t range_min; timeu64_t range_max; time64_t start_secs; diff --git a/include/uapi/linux/rtc.h b/include/uapi/linux/rtc.h index fa9aff91cbf2..f950bff75e97 100644 --- a/include/uapi/linux/rtc.h +++ b/include/uapi/linux/rtc.h @@ -110,6 +110,11 @@ struct rtc_pll_info { #define RTC_AF 0x20 /* Alarm interrupt */ #define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ +/* feature list */ +#define RTC_FEATURE_ALARM 0 +#define RTC_FEATURE_ALARM_RES_MINUTE 1 +#define RTC_FEATURE_NEED_WEEK_DAY 2 +#define RTC_FEATURE_CNT 3 #define RTC_MAX_FREQ 8192 From patchwork Sun Jan 10 23:17:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009557 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 87D8CC433E0 for ; Sun, 10 Jan 2021 23:20:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 38820227C3 for ; Sun, 10 Jan 2021 23:20:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38820227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LXo51aMrVQZSoPrkAWWaKPiD1NGFIQXIdMhbDOlib9A=; b=ye7i+vNxR4+J+7Bcjg/xVmcc1 JVtR6WyRL7zeAXQGSWO0OqUJY2JJz9gZarMOcd/OEhun4wkm2fI09r/cvK78c14EdTeyW6jGPaUuj vy5p3ilNUgy4lOPnj4sU1bIQ9b4bR/xUtfr0GZBUIqNlM/bqWu/+WByJbhfPF5A+77urrtvdhYBom ZtiwmIbRRFfjWqhn8w5elN9ItCiiPQosc0Kxd8Lj7exq4/UMOhrMLoL8/BeScyWMWLuKKXN4noEwT oneuAHLyPnhZ6PfLKZYgKJ1dhTGFMfgh7WZpwy1fkcauqfie5vflXUrFAFF7PWXq3TpR7vuxa8owo pKX4qzsCg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyR-0001Ta-Rx; Sun, 10 Jan 2021 23:18:15 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyM-0001Qt-R8 for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:11 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 3FDA640005; Sun, 10 Jan 2021 23:18:05 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Linus Walleij , Alessandro Zummo , Alexandre Belloni Subject: [PATCH 02/17] rtc: pl031: use RTC_FEATURE_ALARM Date: Mon, 11 Jan 2021 00:17:37 +0100 Message-Id: <20210110231752.1418816-3-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181811_038915_21D8436E X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clear RTC_FEATURE_ALARM instead of setting set_alarm, read_alarm and alarm_irq_enable to NULL. Signed-off-by: Alexandre Belloni Acked-by: Linus Walleij --- drivers/rtc/rtc-pl031.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 224bbf096262..7c3967df4f9a 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -352,12 +352,8 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) } } - if (!adev->irq[0]) { - /* When there's no interrupt, no point in exposing the alarm */ - ops->read_alarm = NULL; - ops->set_alarm = NULL; - ops->alarm_irq_enable = NULL; - } + if (!adev->irq[0]) + clear_bit(RTC_FEATURE_ALARM, ldata->rtc->features); device_init_wakeup(&adev->dev, true); ldata->rtc = devm_rtc_allocate_device(&adev->dev); From patchwork Sun Jan 10 23:17:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009559 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 B05E4C433E0 for ; Sun, 10 Jan 2021 23:20:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6C461227C3 for ; Sun, 10 Jan 2021 23:20:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C461227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ACDwhA2GhYq/jY72EoFm4jMqnZWWzp7JQyFGFydhPAI=; b=Wu+SCIEJH8xdp1s0TEFj8nB2v FMa8icgckeyVAlL5wmfxwQv87xyHJz7p9GRKLLY9AQ21z3tn4RB7fdqMouYEhvR8GJYfVfBVG+9BH NHr6JKD50+kbpTrl9sAXelqLAJr2jxoyLBseLNjYuzCl4vrFYBxaxYBZ3Tk0oLmoR1OYSv11T4KHI IW9Qd0BCwu6F8z7bDwoVLkbRyy47fsZjLy3yy0NWLFczUkdko7LOoskqdj4u8GBN5rU56pdgNqXUO pDAQSSTW1La7EeYIR3gv+haDzzIFjfMkpOiBSmlsg2UEk9SUPRgw3Ti9NIOdsOrsyrpy8Qp6ksAU2 7JDeA6GgQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjym-0001bg-H8; Sun, 10 Jan 2021 23:18:36 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyN-0001RK-3j for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:13 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id E8FE740006; Sun, 10 Jan 2021 23:18:06 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Alessandro Zummo , Alexandre Belloni Subject: [PATCH 03/17] rtc: armada38x: remove armada38x_rtc_ops_noirq Date: Mon, 11 Jan 2021 00:17:38 +0100 Message-Id: <20210110231752.1418816-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181811_326939_A3C3E40C X-CRM114-Status: GOOD ( 12.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of having a supplementary struct rtc_class_ops with a NULL .set_alarm. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-armada38x.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c index 807a79c07f08..cc542e6b1d5b 100644 --- a/drivers/rtc/rtc-armada38x.c +++ b/drivers/rtc/rtc-armada38x.c @@ -458,14 +458,6 @@ static const struct rtc_class_ops armada38x_rtc_ops = { .set_offset = armada38x_rtc_set_offset, }; -static const struct rtc_class_ops armada38x_rtc_ops_noirq = { - .read_time = armada38x_rtc_read_time, - .set_time = armada38x_rtc_set_time, - .read_alarm = armada38x_rtc_read_alarm, - .read_offset = armada38x_rtc_read_offset, - .set_offset = armada38x_rtc_set_offset, -}; - static const struct armada38x_rtc_data armada38x_data = { .update_mbus_timing = rtc_update_38x_mbus_timing_params, .read_rtc_reg = read_rtc_register_38x_wa, @@ -540,20 +532,15 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, rtc); - if (rtc->irq != -1) { + if (rtc->irq != -1) device_init_wakeup(&pdev->dev, 1); - rtc->rtc_dev->ops = &armada38x_rtc_ops; - } else { - /* - * If there is no interrupt available then we can't - * use the alarm - */ - rtc->rtc_dev->ops = &armada38x_rtc_ops_noirq; - } + else + clear_bit(RTC_FEATURE_ALARM, rtc->rtc_dev->features); /* Update RTC-MBUS bridge timing parameters */ rtc->data->update_mbus_timing(rtc); + rtc->rtc_dev->ops = &armada38x_rtc_ops; rtc->rtc_dev->range_max = U32_MAX; return devm_rtc_register_device(rtc->rtc_dev); From patchwork Sun Jan 10 23:17:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009567 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 759ABC433E0 for ; Sun, 10 Jan 2021 23:21:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 29AD122AB9 for ; Sun, 10 Jan 2021 23:21:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29AD122AB9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j4Edh/lRTgQ6dwFV7iFDOjPIsxXWu9n5Pi5yRRoka5U=; b=OWPIMsW272ID+9xvS6LJ+HLyd GI9JxX/5tLnHw+lNegGLrrJdZRf+MGrLsw5nskRQlYFQbeNKUcAG6MlklwolhGGIk5DfyJcTAiKb5 dEuVYJOsHipvrEHLNHKzwcIVbhzMYJg1eaLVE+pJjJTh+irN8QMiJ8spdK107GUjk34sBFWSP7rwq R0sJtZMN8oWgn1Be6+ZQFcoLolcFktsngieV3n2X/CxVtU2P57tuFn+RS8jwxJ0hb4xiy8rM9zyFw BShDPZuhOfHxrjn7T/mLq1vJKJMhmFKCam5SJ2KgHr/eUeboSmpJj9PXYaVl7RYKsTQxdbHY7wL35 2dR6HTa8g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjzU-0001qF-VP; Sun, 10 Jan 2021 23:19:21 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyY-0001Tv-TT for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:27 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 1F4F0FF804; Sun, 10 Jan 2021 23:18:11 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 04/17] rtc: cmos: remove cmos_rtc_ops_no_alarm Date: Mon, 11 Jan 2021 00:17:39 +0100 Message-Id: <20210110231752.1418816-5-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181823_361684_4AA198E9 X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of having a supplementary struct rtc_class_ops with a NULL .set_alarm. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-cmos.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 51e80bc70d42..c3746e249f5a 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -574,12 +574,6 @@ static const struct rtc_class_ops cmos_rtc_ops = { .alarm_irq_enable = cmos_alarm_irq_enable, }; -static const struct rtc_class_ops cmos_rtc_ops_no_alarm = { - .read_time = cmos_read_time, - .set_time = cmos_set_time, - .proc = cmos_procfs, -}; - /*----------------------------------------------------------------*/ /* @@ -857,12 +851,12 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq); goto cleanup1; } - - cmos_rtc.rtc->ops = &cmos_rtc_ops; } else { - cmos_rtc.rtc->ops = &cmos_rtc_ops_no_alarm; + clear_bit(RTC_FEATURE_ALARM, cmos_rtc.rtc->features); } + cmos_rtc.rtc->ops = &cmos_rtc_ops; + retval = devm_rtc_register_device(cmos_rtc.rtc); if (retval) goto cleanup2; From patchwork Sun Jan 10 23:17:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009571 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 202C6C433E0 for ; Sun, 10 Jan 2021 23:21:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEDB5227C3 for ; Sun, 10 Jan 2021 23:21:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEDB5227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Sioax1IN8ruWJ6c3Di0nC2QDkv0ndmlFIOusJ1xmH10=; b=G6NF6J0Gbs6OabFhzklPkTbPN nVYadi39YEJjkPMs4pQkxCqs6vx0rgtqfSMJQPUaoiKigTv7PMCngHeOHJifd4W6xMItFnDzklmFP 1P8OhcRA/z5hnu6WmbcZCzrKQOc1T0j2lDv0LpL4pR6OuysgP4O0k1RkUNGo1fvIwDOmRsfBR2Qo1 aieJhZjCLLn0ROde7fNIfPkj16mtMGJwOMo+JBw9dUk+DS4BvekIXzJvXSJDeEC2P1vi1mbb9ycPu Nc54Vmsfc/WblAJ3oP/q3AsPG34zmbHciTfErWrnqu3SG4I+Y7EdXUUm/MpjaaEhvufHG0tg443Z/ r3qb/3HCA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjzg-0001yD-Or; Sun, 10 Jan 2021 23:19:32 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyZ-0001UQ-Te for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:28 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 91A7760005; Sun, 10 Jan 2021 23:18:15 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 05/17] rtc: mv: remove mv_rtc_alarm_ops Date: Mon, 11 Jan 2021 00:17:40 +0100 Message-Id: <20210110231752.1418816-6-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181824_208670_AA5D5FC7 X-CRM114-Status: GOOD ( 11.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the alarm callbacks in mv_rtc_ops and clear RTC_FEATURE_ALARM to signal that alarms are not available instead of having a supplementary struct rtc_class_ops. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-mv.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index f8e2ecea1d8d..6c526e2ec56d 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c @@ -200,11 +200,6 @@ static irqreturn_t mv_rtc_interrupt(int irq, void *data) static const struct rtc_class_ops mv_rtc_ops = { .read_time = mv_rtc_read_time, .set_time = mv_rtc_set_time, -}; - -static const struct rtc_class_ops mv_rtc_alarm_ops = { - .read_time = mv_rtc_read_time, - .set_time = mv_rtc_set_time, .read_alarm = mv_rtc_read_alarm, .set_alarm = mv_rtc_set_alarm, .alarm_irq_enable = mv_rtc_alarm_irq_enable, @@ -268,13 +263,12 @@ static int __init mv_rtc_probe(struct platform_device *pdev) } } - if (pdata->irq >= 0) { + if (pdata->irq >= 0) device_init_wakeup(&pdev->dev, 1); - pdata->rtc->ops = &mv_rtc_alarm_ops; - } else { - pdata->rtc->ops = &mv_rtc_ops; - } + else + clear_bit(RTC_FEATURE_ALARM, pdata->rtc->features); + pdata->rtc->ops = &mv_rtc_ops; pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; pdata->rtc->range_max = RTC_TIMESTAMP_END_2099; From patchwork Sun Jan 10 23:17:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009573 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 510E8C433E0 for ; Sun, 10 Jan 2021 23:21:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F28A9227C3 for ; Sun, 10 Jan 2021 23:21:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F28A9227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5bYZJTmCHW5l9DEdHtXc9sGy0+gR8ZNS2WhuPNrNiWY=; b=PRdFl63N6MlAPvSnZHGB5vaM0 Q4mbmzI4ApYV3KXYhYfF5T5oxM/fKc9am7rtLi8iA1r8kqgDCYJ0fvXDVMGBPeH4iTJ6XMT7mZxJG ZBE9+QrCGzQTc00BKAX4KqB5bdmzSQrBzpIli1gtSBlxBUMr/wQrVt+jAsoAWUJDPE0YdyDpMVRw+ w+Z3EszHlS9TEdFydExROyZTm8VfpwYB3jb2dS5+CvkvGjQlhLADPxB9M5eO6QSVGDUu80gH/Z4im O6jcRGkOVk63UfsjJdoiAS0j9TRrPSL6PSN3ayIzQr4JYLfCdbtm/exuVdnpSwxDY4uwsEMU6Uv1A FQpZy9ZsA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjzq-00022s-3B; Sun, 10 Jan 2021 23:19:42 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyZ-0001UL-Te for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:28 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 8745260006; Sun, 10 Jan 2021 23:18:17 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 06/17] rtc: m48t59: remove m48t02_rtc_ops Date: Mon, 11 Jan 2021 00:17:41 +0100 Message-Id: <20210110231752.1418816-7-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181824_217286_9F3A6900 X-CRM114-Status: GOOD ( 14.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of having a supplementary struct rtc_class_ops without alarm callbacks. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-m48t59.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 5f5898d3b055..1d2e99a70fce 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c @@ -313,11 +313,6 @@ static const struct rtc_class_ops m48t59_rtc_ops = { .alarm_irq_enable = m48t59_rtc_alarm_irq_enable, }; -static const struct rtc_class_ops m48t02_rtc_ops = { - .read_time = m48t59_rtc_read_time, - .set_time = m48t59_rtc_set_time, -}; - static int m48t59_nvram_read(void *priv, unsigned int offset, void *val, size_t size) { @@ -366,7 +361,6 @@ static int m48t59_rtc_probe(struct platform_device *pdev) struct m48t59_private *m48t59 = NULL; struct resource *res; int ret = -ENOMEM; - const struct rtc_class_ops *ops; struct nvmem_config nvmem_cfg = { .name = "m48t59-", .word_size = 1, @@ -438,17 +432,21 @@ static int m48t59_rtc_probe(struct platform_device *pdev) if (ret) return ret; } + + m48t59->rtc = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(m48t59->rtc)) + return PTR_ERR(m48t59->rtc); + switch (pdata->type) { case M48T59RTC_TYPE_M48T59: - ops = &m48t59_rtc_ops; pdata->offset = 0x1ff0; break; case M48T59RTC_TYPE_M48T02: - ops = &m48t02_rtc_ops; + clear_bit(RTC_FEATURE_ALARM, m48t59->rtc->features); pdata->offset = 0x7f0; break; case M48T59RTC_TYPE_M48T08: - ops = &m48t02_rtc_ops; + clear_bit(RTC_FEATURE_ALARM, m48t59->rtc->features); pdata->offset = 0x1ff0; break; default: @@ -459,11 +457,7 @@ static int m48t59_rtc_probe(struct platform_device *pdev) spin_lock_init(&m48t59->lock); platform_set_drvdata(pdev, m48t59); - m48t59->rtc = devm_rtc_allocate_device(&pdev->dev); - if (IS_ERR(m48t59->rtc)) - return PTR_ERR(m48t59->rtc); - - m48t59->rtc->ops = ops; + m48t59->rtc->ops = &m48t59_rtc_ops; nvmem_cfg.size = pdata->offset; ret = devm_rtc_nvmem_register(m48t59->rtc, &nvmem_cfg); From patchwork Sun Jan 10 23:17:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009563 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 65012C433E0 for ; Sun, 10 Jan 2021 23:20:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 071E3227C3 for ; Sun, 10 Jan 2021 23:20:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 071E3227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QcIvgWzGlb7MpMJQFIRni9YAcdSaTmFgAKqW7V6W0oc=; b=SrQ2kl3Ro3wFZ7Nb6BkBec5X7 A0MDZLxx9kOJJI1snOAKcbcI2EItgaasqBnvNfqRor8TeRwPNiNoICeGEk+OgjJWMP09QeDYkzBeC 4l9UgwCTHHXsvBEExbS4XfbUvCD2oxf0NvSYRirDWPV2DX6OkXoUq4IOOZ6bQr+Fi9vIPTON4O/pC 4/TDhVjXuORLeAhTCshrRLu5Tv9VtKDojf5bZJzrXKWwug2QCh4gL29jOpablYnpeIlbTWcFiUFtR J5zDJs4dlGafCJiAMgx+Hc3EXH9Uid1cvmA2eR+4QoieBmq7+jWeIcwyGsJb+HEV1FCvJwWwmzsSF OT21d84Hg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjz5-0001hR-VB; Sun, 10 Jan 2021 23:18:56 +0000 Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyV-0001UY-Va for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:21 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 79E4F20003; Sun, 10 Jan 2021 23:18:18 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 07/17] rtc: pcf2127: remove pcf2127_rtc_alrm_ops Date: Mon, 11 Jan 2021 00:17:42 +0100 Message-Id: <20210110231752.1418816-8-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181820_211333_1D8EBD78 X-CRM114-Status: GOOD ( 14.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the alarm callbacks in pcf2127_rtc_ops and use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of having a supplementary struct rtc_class_ops without alarm callbacks. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-pcf2127.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 39a7b5116aa4..68160d857ac1 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -225,12 +225,6 @@ static int pcf2127_rtc_ioctl(struct device *dev, } } -static const struct rtc_class_ops pcf2127_rtc_ops = { - .ioctl = pcf2127_rtc_ioctl, - .read_time = pcf2127_rtc_read_time, - .set_time = pcf2127_rtc_set_time, -}; - static int pcf2127_nvmem_read(void *priv, unsigned int offset, void *val, size_t bytes) { @@ -459,7 +453,7 @@ static irqreturn_t pcf2127_rtc_irq(int irq, void *dev) return IRQ_HANDLED; } -static const struct rtc_class_ops pcf2127_rtc_alrm_ops = { +static const struct rtc_class_ops pcf2127_rtc_ops = { .ioctl = pcf2127_rtc_ioctl, .read_time = pcf2127_rtc_read_time, .set_time = pcf2127_rtc_set_time, @@ -584,6 +578,7 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap, pcf2127->rtc->range_max = RTC_TIMESTAMP_END_2099; pcf2127->rtc->set_start_time = true; /* Sets actual start to 1970 */ pcf2127->rtc->uie_unsupported = 1; + clear_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features); if (alarm_irq > 0) { ret = devm_request_threaded_irq(dev, alarm_irq, NULL, @@ -598,7 +593,7 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap, if (alarm_irq > 0 || device_property_read_bool(dev, "wakeup-source")) { device_init_wakeup(dev, true); - pcf2127->rtc->ops = &pcf2127_rtc_alrm_ops; + set_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features); } if (has_nvmem) { From patchwork Sun Jan 10 23:17:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009565 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 2F16BC433DB for ; Sun, 10 Jan 2021 23:20:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD979227C3 for ; Sun, 10 Jan 2021 23:20:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD979227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NvJUNEQBDFaCnhi2bSxrmvj/jnhcJsHpCtwFdJBRuZ8=; b=bykSHB4ExUaPe7aKwaul+7ku9 Dg1jdblPPZjnNkOqCLv1ok8sLbb9Q6T356AnwBANI5TNDBPBJ97Vhe0h+RkFUFIquwdRElcAMEIAu ZCd9cV9G7kCUTx8Vr0o9ZyJdoLwTVKp9eBR/qRI2SdlDdSKzWbZTQNmCPzyzi4OJ1zQy1Ub+CJ8TJ h1o1m4/ciycIKd/tj+wPVWpqRfUBZhPXe+5cZEzwcolsNbMLyLuiNANIcCDG7BQhkpcGU6neuTnT/ yeriVaocTtNfkxxNnMwAsF8Z4nV6GNqM1sSN/VhcjxNEfyQrA8ZMVwe+pDev9/YIo9yjgVQQJpweG xKuPch0aw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjzD-0001kx-Df; Sun, 10 Jan 2021 23:19:03 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyY-0001Ui-T1 for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:24 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 5A7B2FF80A; Sun, 10 Jan 2021 23:18:19 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 08/17] rtc: pcf85063: remove pcf85063_rtc_ops_alarm Date: Mon, 11 Jan 2021 00:17:43 +0100 Message-Id: <20210110231752.1418816-9-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181823_274069_5D78D313 X-CRM114-Status: GOOD ( 13.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the alarm callbacks in pcf85063_rtc_ops and use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of having a supplementary struct rtc_class_ops without alarm callbacks. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-pcf85063.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c index e19cf2adbc35..f7e7c9eb0781 100644 --- a/drivers/rtc/rtc-pcf85063.c +++ b/drivers/rtc/rtc-pcf85063.c @@ -307,14 +307,6 @@ static int pcf85063_ioctl(struct device *dev, unsigned int cmd, } static const struct rtc_class_ops pcf85063_rtc_ops = { - .read_time = pcf85063_rtc_read_time, - .set_time = pcf85063_rtc_set_time, - .read_offset = pcf85063_read_offset, - .set_offset = pcf85063_set_offset, - .ioctl = pcf85063_ioctl, -}; - -static const struct rtc_class_ops pcf85063_rtc_ops_alarm = { .read_time = pcf85063_rtc_read_time, .set_time = pcf85063_rtc_set_time, .read_offset = pcf85063_read_offset, @@ -587,6 +579,7 @@ static int pcf85063_probe(struct i2c_client *client) pcf85063->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; pcf85063->rtc->range_max = RTC_TIMESTAMP_END_2099; pcf85063->rtc->uie_unsupported = 1; + clear_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features); if (config->has_alarms && client->irq > 0) { err = devm_request_threaded_irq(&client->dev, client->irq, @@ -597,7 +590,7 @@ static int pcf85063_probe(struct i2c_client *client) dev_warn(&pcf85063->rtc->dev, "unable to request IRQ, alarms disabled\n"); } else { - pcf85063->rtc->ops = &pcf85063_rtc_ops_alarm; + set_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features); device_init_wakeup(&client->dev, true); err = dev_pm_set_wake_irq(&client->dev, client->irq); if (err) From patchwork Sun Jan 10 23:17:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009569 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 17421C433E0 for ; Sun, 10 Jan 2021 23:21:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC15C227C3 for ; Sun, 10 Jan 2021 23:21:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC15C227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7WAjsMlD4wrcToVv2Yhb2d0CmIWPGpECGGh043mPhNQ=; b=ciopNNRMnCXZC7VT6mFlF8B0x OpKfwTcUHYVOMIZFhDgSsZszaQAhMCPnQUQmFT1U4PNPjasweU1FZDbKRAgk+zrzNoOfzKFCFi2pk iHQ79o9gr+h/IhEVXGUh1Q1a+yzes4rOJB5UIYTaByGLgYwtTuo4MqspNaH3to9zd0mbnKGpRci14 Ln0eUiK1FV+WFOFYo+xB4g6FQtANSVwOibojtzd/XMTEfekDZUvXj6rInM45HVm8nkb2vbzA+wg6N YGiTo9zgku/F0xKTApE+N0BuQh9dGoMPIKDKzjZtOmOpA3or31Ns0u6ZKfU8B9WM+iGBQbmXsfyTG 2Hg5MWACg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjza-0001uk-BG; Sun, 10 Jan 2021 23:19:26 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyY-0001V3-T7 for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:27 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 47308FF80B; Sun, 10 Jan 2021 23:18:20 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 09/17] rtc: rx8010: drop a struct rtc_class_ops Date: Mon, 11 Jan 2021 00:17:44 +0100 Message-Id: <20210110231752.1418816-10-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181823_360071_599CEA20 X-CRM114-Status: GOOD ( 13.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Merge both struct rtc_class_ops in a single one and use RTC_FEATURE_ALARM to signal to the core whether alarms are available. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-rx8010.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c index 8340ab47a059..1a05e4654290 100644 --- a/drivers/rtc/rtc-rx8010.c +++ b/drivers/rtc/rtc-rx8010.c @@ -354,13 +354,7 @@ static int rx8010_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) } } -static const struct rtc_class_ops rx8010_rtc_ops_default = { - .read_time = rx8010_get_time, - .set_time = rx8010_set_time, - .ioctl = rx8010_ioctl, -}; - -static const struct rtc_class_ops rx8010_rtc_ops_alarm = { +static const struct rtc_class_ops rx8010_rtc_ops = { .read_time = rx8010_get_time, .set_time = rx8010_set_time, .ioctl = rx8010_ioctl, @@ -409,12 +403,11 @@ static int rx8010_probe(struct i2c_client *client) dev_err(dev, "unable to request IRQ\n"); return err; } - - rx8010->rtc->ops = &rx8010_rtc_ops_alarm; } else { - rx8010->rtc->ops = &rx8010_rtc_ops_default; + clear_bit(RTC_FEATURE_ALARM, rx8010->rtc->features); } + rx8010->rtc->ops = &rx8010_rtc_ops; rx8010->rtc->max_user_freq = 1; rx8010->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; rx8010->rtc->range_max = RTC_TIMESTAMP_END_2099; From patchwork Sun Jan 10 23:17:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009579 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 7C277C433DB for ; Sun, 10 Jan 2021 23:22:10 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 40209227C3 for ; Sun, 10 Jan 2021 23:22:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40209227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=65Iu5zQtIRmgG+q3kI5uo+Z19WBVuq9jm9w2+bSfVsU=; b=jADBU2ybg+CkzY/Ss1qr4WKu/ k0VEodtCKJtWQ4sa1IUdcFkpNdKe8lFTnzYOGal8tRT8eZnaOkeGCKSYCg299LWUcBpIxI6g26mdA UTLqj1Aa7rflPCaJzWwfXCb4SdkRwT2iTMCVqCoupfhmBS14d/guNt7HeQpEqfy3we4a0cj2ZimrV T+IQF4VpORn+UNch8/BwFTVFGSFn1qRN2QbhqfqHVt0livd694FMO4DKnlsLOzsw81LraeamU33oX osAERsqYQKnmr3q/4cq1aL9Bef6u8ITRpVeNdETB2XI4xDYRNjpyW/ZIIpBtMONG8wvyPlomLQFcV fN+hHZkAg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyk0U-0002Sq-0B; Sun, 10 Jan 2021 23:20:22 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyc-0001Wx-V0 for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:30 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 41E16E000B; Sun, 10 Jan 2021 23:18:21 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 10/17] rtc: pcf85363: drop a struct rtc_class_ops Date: Mon, 11 Jan 2021 00:17:45 +0100 Message-Id: <20210110231752.1418816-11-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181827_178405_78B664E4 X-CRM114-Status: GOOD ( 12.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Merge both struct rtc_class_ops in a single one and use RTC_FEATURE_ALARM to signal to the core whether alarms are available. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-pcf85363.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c index a574c8d15a5c..8c2dcbac0d7b 100644 --- a/drivers/rtc/rtc-pcf85363.c +++ b/drivers/rtc/rtc-pcf85363.c @@ -285,11 +285,6 @@ static irqreturn_t pcf85363_rtc_handle_irq(int irq, void *dev_id) static const struct rtc_class_ops rtc_ops = { .read_time = pcf85363_rtc_read_time, .set_time = pcf85363_rtc_set_time, -}; - -static const struct rtc_class_ops rtc_ops_alarm = { - .read_time = pcf85363_rtc_read_time, - .set_time = pcf85363_rtc_set_time, .read_alarm = pcf85363_rtc_read_alarm, .set_alarm = pcf85363_rtc_set_alarm, .alarm_irq_enable = pcf85363_rtc_alarm_irq_enable, @@ -403,6 +398,7 @@ static int pcf85363_probe(struct i2c_client *client, pcf85363->rtc->ops = &rtc_ops; pcf85363->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; pcf85363->rtc->range_max = RTC_TIMESTAMP_END_2099; + clear_bit(RTC_FEATURE_ALARM, pcf85363->rtc->features); if (client->irq > 0) { regmap_write(pcf85363->regmap, CTRL_FLAGS, 0); @@ -415,7 +411,7 @@ static int pcf85363_probe(struct i2c_client *client, if (ret) dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); else - pcf85363->rtc->ops = &rtc_ops_alarm; + set_bit(RTC_FEATURE_ALARM, pcf85363->rtc->features); } ret = devm_rtc_register_device(pcf85363->rtc); From patchwork Sun Jan 10 23:17:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009575 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 44009C433DB for ; Sun, 10 Jan 2021 23:21:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F37B7227C3 for ; Sun, 10 Jan 2021 23:21:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F37B7227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rOZJilM9Ix/Uan6ZLZoYmMcXjfWsUm8kXqShht1G7x8=; b=bARsCMD54yeyahfAyb16cUeNF x5K01wXDfXvDI7Fxjj6IEECvIY/H7RKf7kQoPsrJyQLlZwu4fh2dNAZBBmXiPsoW/94sXzo1bMjPg fc08/vCHX5PkW0LDVxCyYVeYnKsRyrobtdL52UZKsRlBHaOWHG4mmLxXBF/jY0dOUqNxzx5uzO4II tTHhObEwaBMynLi5evTC0LFqdYQg/CZFVDdetYzH7ZOeQrReoBe2T+dS7iSMcJZOr5RZ4K6jYyfEM hAIkhLBQbPolKJdvEsdfOZWmO6u1uGSDpPPFOq7CUZf2ZPX83tBipblhIx4Dh4v4dO/4YjBOH6B/X uvxWcTgCA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyk02-0002CD-RI; Sun, 10 Jan 2021 23:19:54 +0000 Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjya-0001WI-FJ for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:29 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 0659B20007; Sun, 10 Jan 2021 23:18:22 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 11/17] rtc: m41t80: constify m41t80_rtc_ops Date: Mon, 11 Jan 2021 00:17:46 +0100 Message-Id: <20210110231752.1418816-12-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181824_798725_8D802B1B X-CRM114-Status: GOOD ( 14.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of changing the global struct rtc_class_ops, allowing to make it const. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-m41t80.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 160dcf68e64e..e3ddd660d68c 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c @@ -397,10 +397,13 @@ static int m41t80_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) return 0; } -static struct rtc_class_ops m41t80_rtc_ops = { +static const struct rtc_class_ops m41t80_rtc_ops = { .read_time = m41t80_rtc_read_time, .set_time = m41t80_rtc_set_time, .proc = m41t80_rtc_proc, + .read_alarm = m41t80_read_alarm, + .set_alarm = m41t80_set_alarm, + .alarm_irq_enable = m41t80_alarm_irq_enable, }; #ifdef CONFIG_PM_SLEEP @@ -913,13 +916,10 @@ static int m41t80_probe(struct i2c_client *client, wakeup_source = false; } } - if (client->irq > 0 || wakeup_source) { - m41t80_rtc_ops.read_alarm = m41t80_read_alarm; - m41t80_rtc_ops.set_alarm = m41t80_set_alarm; - m41t80_rtc_ops.alarm_irq_enable = m41t80_alarm_irq_enable; - /* Enable the wakealarm */ + if (client->irq > 0 || wakeup_source) device_init_wakeup(&client->dev, true); - } + else + clear_bit(RTC_FEATURE_ALARM, m41t80_data->rtc->features); m41t80_data->rtc->ops = &m41t80_rtc_ops; m41t80_data->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; From patchwork Sun Jan 10 23:17:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009577 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 6C172C433E0 for ; Sun, 10 Jan 2021 23:22:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 30489227C3 for ; Sun, 10 Jan 2021 23:22:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30489227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vFAlh2HH4xGYqpxpLViSnXiyqTkRn/Yd79WPQx8tEUU=; b=nmbGysrmHqKsuoWtRZt/2LbQ4 BgHxUhCisFWPcOa6LtecAxL2Ogk7zf1hsVcEkInzHrgw36VK8QIK0XV0OxyF6d4zHakpPMupE8KaF 9F+tdh/m+7JS1mt5bc9MgCLpiHSP6IzlDUumZanb81tBCr2Q2ZC7S2DU31Xq7YV10uLI19inLZgV/ 9F+gIHEDtfcNLvrHNP5UtzF9aiCHpwxHyJ87aPXFWfgwj3LZjjp9kHohw1P8tdI0BNo/pbqmPxwjv MVRl79wKPqTCrOcQ7Ecl8adH6svx1pOJuSIF/pDpkCbWWOoVaqM0zzjx49iTEl4rgv6ap8uW/yB9z z0otd196A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyk0H-0002KK-5D; Sun, 10 Jan 2021 23:20:09 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyc-0001XI-77 for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:30 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id DC80260008; Sun, 10 Jan 2021 23:18:23 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alessandro Zummo , Alexandre Belloni Subject: [PATCH 12/17] rtc: opal: constify opal_rtc_ops Date: Mon, 11 Jan 2021 00:17:47 +0100 Message-Id: <20210110231752.1418816-13-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181826_421052_6AB7B579 X-CRM114-Status: GOOD ( 13.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of changing the global struct rtc_class_ops, allowing to make it const. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-opal.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c index c586f695bdc9..f8f49a969c23 100644 --- a/drivers/rtc/rtc-opal.c +++ b/drivers/rtc/rtc-opal.c @@ -224,9 +224,12 @@ static int opal_tpo_alarm_irq_enable(struct device *dev, unsigned int enabled) return enabled ? 0 : opal_set_tpo_time(dev, &alarm); } -static struct rtc_class_ops opal_rtc_ops = { +static const struct rtc_class_ops opal_rtc_ops = { .read_time = opal_get_rtc_time, .set_time = opal_set_rtc_time, + .read_alarm = opal_get_tpo_time, + .set_alarm = opal_set_tpo_time, + .alarm_irq_enable = opal_tpo_alarm_irq_enable, }; static int opal_rtc_probe(struct platform_device *pdev) @@ -239,12 +242,10 @@ static int opal_rtc_probe(struct platform_device *pdev) if (pdev->dev.of_node && (of_property_read_bool(pdev->dev.of_node, "wakeup-source") || - of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) { + of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) device_set_wakeup_capable(&pdev->dev, true); - opal_rtc_ops.read_alarm = opal_get_tpo_time; - opal_rtc_ops.set_alarm = opal_set_tpo_time; - opal_rtc_ops.alarm_irq_enable = opal_tpo_alarm_irq_enable; - } + else + clear_bit(RTC_FEATURE_ALARM, rtc->features); rtc->ops = &opal_rtc_ops; rtc->range_min = RTC_TIMESTAMP_BEGIN_0000; From patchwork Sun Jan 10 23:17:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009585 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 75C42C433DB for ; Sun, 10 Jan 2021 23:23:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39D8C227C3 for ; Sun, 10 Jan 2021 23:23:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39D8C227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gHyWjSGR/3rf0g4LsCiQB6KXxNl5VOAHsikjtgJTtpM=; b=PBsZIg7kGBEAZD7R3zHOxdo35 AD2YzYEVtw5ax2XeLaLI+z9x+KAreIw64HcesI+SDGYkIagA4xwolPEQtSVXcgz66fgESMysMuTll s/IdRAyk/y0UeSmxMVaPNXtogEPmFzb5mj23CRN9GhmE1PYDPNXvM6LYLJWfytHDGz6AXPMhx9dAU hIbKnoN9CE4agsff/cV1TmgIdrOQ8k9OMKK6D5wzG0DYkXVJq7DU6Fq4S7aLYN7PBzu0cpoVE+yA8 4vnitaom9sCromDiMgxlvnbHHlOdaOJ2ahT3a6FB+//UR/1OtJCp8Ghcw++rvUsTUnujwlKuY00il vwgsTm+jQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyk1q-0003Fi-FG; Sun, 10 Jan 2021 23:21:46 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyf-0001YH-NL for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:32 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id A9EAE240003; Sun, 10 Jan 2021 23:18:25 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 13/17] rtc: rv3028: constify rv3028_rtc_ops Date: Mon, 11 Jan 2021 00:17:48 +0100 Message-Id: <20210110231752.1418816-14-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181829_965649_7AE1C6F1 X-CRM114-Status: GOOD ( 14.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of changing the global struct rtc_class_ops, allowing to make it const. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-rv3028.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c index 979407a51c7a..2004f8c5397f 100644 --- a/drivers/rtc/rtc-rv3028.c +++ b/drivers/rtc/rtc-rv3028.c @@ -770,9 +770,12 @@ static int rv3028_clkout_register_clk(struct rv3028_data *rv3028, } #endif -static struct rtc_class_ops rv3028_rtc_ops = { +static const struct rtc_class_ops rv3028_rtc_ops = { .read_time = rv3028_get_time, .set_time = rv3028_set_time, + .read_alarm = rv3028_get_alarm, + .set_alarm = rv3028_set_alarm, + .alarm_irq_enable = rv3028_alarm_irq_enable, .read_offset = rv3028_read_offset, .set_offset = rv3028_set_offset, .ioctl = rv3028_ioctl, @@ -841,12 +844,10 @@ static int rv3028_probe(struct i2c_client *client) if (ret) { dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); client->irq = 0; - } else { - rv3028_rtc_ops.read_alarm = rv3028_get_alarm; - rv3028_rtc_ops.set_alarm = rv3028_set_alarm; - rv3028_rtc_ops.alarm_irq_enable = rv3028_alarm_irq_enable; } } + if (!client->irq) + clear_bit(RTC_FEATURE_ALARM, rv3028->rtc->features); ret = regmap_update_bits(rv3028->regmap, RV3028_CTRL1, RV3028_CTRL1_WADA, RV3028_CTRL1_WADA); From patchwork Sun Jan 10 23:17:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009581 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 4790FC433DB for ; Sun, 10 Jan 2021 23:22:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3D42227C3 for ; Sun, 10 Jan 2021 23:22:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3D42227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=agRJH2tNaPKXoViSkpSi/wzjw6JQPIHqDQbtHTI1lts=; b=Xcp5Ou9f5mDfaVnMetR540TVW SbFdsJcnnQJ2wVanwiWm5cfP2VldAkomeRhrLki1oTE6dWHmqqoXJM7y2B21byIEuvMj/IK0HSOmd Sk3y2yKVT39uP68tDLVHhkFRLzk5DWiTtjw82aMfCn6Jzeyg5ZHB7stuJU3HG1rNLevVjgdaOCWdy 4gukvVVCkb1a/39zqCN7AIW5PsFCQiPaRXM+6Gsx4Gz27CMReMnHRWNUqIkAsylcJ3nwALjQLy7J0 IHVAIhkdwwkY3iWdT/5sBTfRfE/MSS7x+tleJmfcO8JwIxYDYdd1HaZBExy/pJZSpuLIV98RnQnbF AdcNMW5zQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyk0w-0002eO-8F; Sun, 10 Jan 2021 23:20:50 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjye-0001YF-CL for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:31 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 04E7CFF809; Sun, 10 Jan 2021 23:18:26 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 14/17] rtc: rv3029: constify rv3029_rtc_ops Date: Mon, 11 Jan 2021 00:17:49 +0100 Message-Id: <20210110231752.1418816-15-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181829_405255_9A0AC12F X-CRM114-Status: GOOD ( 15.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of changing the global struct rtc_class_ops, allowing to make it const. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-rv3029c2.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c index dc1bda62095e..c1f4c0bba1e5 100644 --- a/drivers/rtc/rtc-rv3029c2.c +++ b/drivers/rtc/rtc-rv3029c2.c @@ -694,10 +694,13 @@ static void rv3029_hwmon_register(struct device *dev, const char *name) #endif /* CONFIG_RTC_DRV_RV3029_HWMON */ -static struct rtc_class_ops rv3029_rtc_ops = { +static const struct rtc_class_ops rv3029_rtc_ops = { .read_time = rv3029_read_time, .set_time = rv3029_set_time, .ioctl = rv3029_ioctl, + .read_alarm = rv3029_read_alarm, + .set_alarm = rv3029_set_alarm, + .alarm_irq_enable = rv3029_alarm_irq_enable, }; static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq, @@ -739,12 +742,10 @@ static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq, if (rc) { dev_warn(dev, "unable to request IRQ, alarms disabled\n"); rv3029->irq = 0; - } else { - rv3029_rtc_ops.read_alarm = rv3029_read_alarm; - rv3029_rtc_ops.set_alarm = rv3029_set_alarm; - rv3029_rtc_ops.alarm_irq_enable = rv3029_alarm_irq_enable; } } + if (!rv3029->irq) + clear_bit(RTC_FEATURE_ALARM, rv3029->rtc->features); rv3029->rtc->ops = &rv3029_rtc_ops; rv3029->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; From patchwork Sun Jan 10 23:17:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009583 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 2021DC433E0 for ; Sun, 10 Jan 2021 23:23:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE821227C3 for ; Sun, 10 Jan 2021 23:23:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE821227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LhPjh8jJnIDZU+rywXH/G0INZlJG38l5UBvWCG47ehk=; b=hg/YWDO9z9IPydF4w89ORSasl KXVVpMVEjFnhbt/krmXOYcft8RMrYgaEA7uzlTdW+8sTn8kze3re6NQRuAfDZNtfGMmGepZADAfkg j4fja52sV5PtFSf7Y302VCnTTm3q7fF63kl0+LFrgCupQ9sZRafQuUDFsyKMIlh7i/6qTCftoP5AM WdEY+MEAMNMXagX1yaytBMIvankN7wjXoUYBaxm8VNIb/MW3VJMnjNG9ZF2s+ZlOo2mTWvIr5Upd6 J1H5CZzQxBDXSD884hHnhWCXdh5ue9tDCbKlInWUL9rSEfqF5+0zrKYsSaVCnCdblWwODmd4wxAtw Fbu2kh0bA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyk1L-0002xe-LP; Sun, 10 Jan 2021 23:21:15 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyf-0001YR-B0 for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:31 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E43EC6000B; Sun, 10 Jan 2021 23:18:27 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 15/17] rtc: rv3032: constify rv3032_rtc_ops Date: Mon, 11 Jan 2021 00:17:50 +0100 Message-Id: <20210110231752.1418816-16-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181829_577874_55B6095C X-CRM114-Status: GOOD ( 15.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of changing the global struct rtc_class_ops, allowing to make it const. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-rv3032.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-rv3032.c b/drivers/rtc/rtc-rv3032.c index c9bcea727757..5161016bce00 100644 --- a/drivers/rtc/rtc-rv3032.c +++ b/drivers/rtc/rtc-rv3032.c @@ -804,12 +804,15 @@ static void rv3032_hwmon_register(struct device *dev) devm_hwmon_device_register_with_info(dev, "rv3032", rv3032, &rv3032_hwmon_chip_info, NULL); } -static struct rtc_class_ops rv3032_rtc_ops = { +static const struct rtc_class_ops rv3032_rtc_ops = { .read_time = rv3032_get_time, .set_time = rv3032_set_time, .read_offset = rv3032_read_offset, .set_offset = rv3032_set_offset, .ioctl = rv3032_ioctl, + .read_alarm = rv3032_get_alarm, + .set_alarm = rv3032_set_alarm, + .alarm_irq_enable = rv3032_alarm_irq_enable, }; static const struct regmap_config regmap_config = { @@ -868,12 +871,10 @@ static int rv3032_probe(struct i2c_client *client) if (ret) { dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); client->irq = 0; - } else { - rv3032_rtc_ops.read_alarm = rv3032_get_alarm; - rv3032_rtc_ops.set_alarm = rv3032_set_alarm; - rv3032_rtc_ops.alarm_irq_enable = rv3032_alarm_irq_enable; } } + if (!client->irq) + clear_bit(RTC_FEATURE_ALARM, rv3032->rtc->features); ret = regmap_update_bits(rv3032->regmap, RV3032_CTRL1, RV3032_CTRL1_WADA, RV3032_CTRL1_WADA); From patchwork Sun Jan 10 23:17:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009587 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 E97BBC433E0 for ; Sun, 10 Jan 2021 23:23:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7AFE7227C3 for ; Sun, 10 Jan 2021 23:23:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AFE7227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C+v+Xgwqt7Fsk1kKzmv/x/d0txM2CPToGR+v9b3HofM=; b=feel0PLkH3JPgw5OVtY5Bx9Fb qabQ9WyNr588XwCOEDSQKMzPXPZt16qH349E2nRCuq/d2V9zB+mOrwSi2NBzrqhkgZM/Rg7oheBfd FIxnvxb+hwGwSs1XlnhyxyXywYEeHxSaFPf439H3PSxj8u/GAvWY0FNahJIikWxE8KP1mGN3n/vAn SgcBlNc4ZDwuGUpmzKQF+acw8s2zEods1QyNKh54J4AXIgUddoVOjoI+EvOAGrz+gkWFcHfEZsvLN kk31ewVxH6qcZljCguRbfYS+CHBv7c5y+QiijWNb5MaffOV0lemSNlRB1XRUpg0zF+CKBRAFrH/ZV MiEb1PKwA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyk2A-0003TL-1D; Sun, 10 Jan 2021 23:22:07 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyg-0001Yn-Dh for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:32 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id C35296000C; Sun, 10 Jan 2021 23:18:28 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 16/17] rtc: rv8803: constify rv8803_rtc_ops Date: Mon, 11 Jan 2021 00:17:51 +0100 Message-Id: <20210110231752.1418816-17-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181830_634968_83B5D150 X-CRM114-Status: GOOD ( 14.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of changing the global struct rtc_class_ops, allowing to make it const. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-rv8803.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c index d4ea6db51b26..8821264e9385 100644 --- a/drivers/rtc/rtc-rv8803.c +++ b/drivers/rtc/rtc-rv8803.c @@ -471,10 +471,13 @@ static int rv8803_nvram_read(void *priv, unsigned int offset, return 0; } -static struct rtc_class_ops rv8803_rtc_ops = { +static const struct rtc_class_ops rv8803_rtc_ops = { .read_time = rv8803_get_time, .set_time = rv8803_set_time, .ioctl = rv8803_ioctl, + .read_alarm = rv8803_get_alarm, + .set_alarm = rv8803_set_alarm, + .alarm_irq_enable = rv8803_alarm_irq_enable, }; static int rx8900_trickle_charger_init(struct rv8803_data *rv8803) @@ -567,12 +570,10 @@ static int rv8803_probe(struct i2c_client *client, if (err) { dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); client->irq = 0; - } else { - rv8803_rtc_ops.read_alarm = rv8803_get_alarm; - rv8803_rtc_ops.set_alarm = rv8803_set_alarm; - rv8803_rtc_ops.alarm_irq_enable = rv8803_alarm_irq_enable; } } + if (!client->irq) + clear_bit(RTC_FEATURE_ALARM, rv8803->rtc->features); err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA); if (err) From patchwork Sun Jan 10 23:17:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 12009589 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 4A5B0C433DB for ; Sun, 10 Jan 2021 23:24:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01A05227C3 for ; Sun, 10 Jan 2021 23:24:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01A05227C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=25QLUKG96VrBS7Izy7jtYiyarG6KkjhJhrDtzLLLw8M=; b=TvqmSpvwEI5N6iiV6fcecKiBJ kDl4bsccIsC4gXDA5xeruXaNy8yOPM2UbqNg4+2sZ599UWJQqxq3t5Z1fLH/lpeJ+day/ooR5TC3C 8IGQDXrSfgcIBKrIHnX7NWjFm5O077u9mm9gSDagNDtEA810uyr7WuRvmPrz7OLjnRcPGX2sniaKb PQXVTOvCAznw3PeDYPq3zpkpBgIIXtY3OKtAOFvjBegvWtMSNlTk1UDz8tWc69SjOrm8JwYdpgB7X eVoQbm+itqPa3ReaRD6OHaS+0ecs92ICRMZN85nNNibnhe49KxZs+4addgoBIbDoIpP1JaH6P5qJp 1oaszGJJg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyk2c-0003ih-PL; Sun, 10 Jan 2021 23:22:34 +0000 Received: from relay8-d.mail.gandi.net ([217.70.183.201]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kyjyk-0001an-OE for linux-arm-kernel@lists.infradead.org; Sun, 10 Jan 2021 23:18:35 +0000 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id D6C071BF209; Sun, 10 Jan 2021 23:18:29 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Subject: [PATCH 17/17] rtc: tps65910: remove tps65910_rtc_ops_noirq Date: Mon, 11 Jan 2021 00:17:52 +0100 Message-Id: <20210110231752.1418816-18-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> References: <20210110231752.1418816-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210110_181835_009655_516B8DEA X-CRM114-Status: GOOD ( 12.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of having a supplementary struct rtc_class_ops without alarm callbacks. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-tps65910.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c index 2d87b62826a8..e1415a49f4ee 100644 --- a/drivers/rtc/rtc-tps65910.c +++ b/drivers/rtc/rtc-tps65910.c @@ -361,13 +361,6 @@ static const struct rtc_class_ops tps65910_rtc_ops = { .set_offset = tps65910_set_offset, }; -static const struct rtc_class_ops tps65910_rtc_ops_noirq = { - .read_time = tps65910_rtc_read_time, - .set_time = tps65910_rtc_set_time, - .read_offset = tps65910_read_offset, - .set_offset = tps65910_set_offset, -}; - static int tps65910_rtc_probe(struct platform_device *pdev) { struct tps65910 *tps65910 = NULL; @@ -425,12 +418,12 @@ static int tps65910_rtc_probe(struct platform_device *pdev) irq = -1; tps_rtc->irq = irq; - if (irq != -1) { + if (irq != -1) device_set_wakeup_capable(&pdev->dev, 1); - tps_rtc->rtc->ops = &tps65910_rtc_ops; - } else - tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq; + else + clear_bit(RTC_FEATURE_ALARM, tps_rtc->rtc->features); + tps_rtc->rtc->ops = &tps65910_rtc_ops; tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099;