All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: linux-rtc@vger.kernel.org,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 06/17] rtc: m48t59: remove m48t02_rtc_ops
Date: Mon, 11 Jan 2021 00:17:41 +0100	[thread overview]
Message-ID: <20210110231752.1418816-7-alexandre.belloni@bootlin.com> (raw)
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>

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 <alexandre.belloni@bootlin.com>
---
 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);
-- 
2.29.2


WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: linux-rtc@vger.kernel.org,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/17] rtc: m48t59: remove m48t02_rtc_ops
Date: Mon, 11 Jan 2021 00:17:41 +0100	[thread overview]
Message-ID: <20210110231752.1418816-7-alexandre.belloni@bootlin.com> (raw)
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>

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 <alexandre.belloni@bootlin.com>
---
 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);
-- 
2.29.2


WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: linux-rtc@vger.kernel.org,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/17] rtc: m48t59: remove m48t02_rtc_ops
Date: Mon, 11 Jan 2021 00:17:41 +0100	[thread overview]
Message-ID: <20210110231752.1418816-7-alexandre.belloni@bootlin.com> (raw)
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>

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 <alexandre.belloni@bootlin.com>
---
 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);
-- 
2.29.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-01-10 23:19 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 23:17 [PATCH 00/17] rtc: constify all rtc_class_ops Alexandre Belloni
2021-01-10 23:17 ` Alexandre Belloni
2021-01-10 23:17 ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 01/17] rtc: introduce features bitfield Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 02/17] rtc: pl031: use RTC_FEATURE_ALARM Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-11 22:00   ` Linus Walleij
2021-01-11 22:00     ` Linus Walleij
2021-01-11 22:00     ` Linus Walleij
2021-01-10 23:17 ` [PATCH 03/17] rtc: armada38x: remove armada38x_rtc_ops_noirq Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 04/17] rtc: cmos: remove cmos_rtc_ops_no_alarm Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-04-28 18:49   ` youling257
2021-04-28 18:49     ` youling257
2021-04-28 18:49     ` youling257
2021-04-28 20:20     ` Alexandre Belloni
2021-04-28 20:20       ` Alexandre Belloni
2021-04-28 20:20       ` Alexandre Belloni
2021-04-28 21:07       ` youling 257
2021-04-28 21:07         ` youling 257
2021-04-28 21:07         ` youling 257
2021-01-10 23:17 ` [PATCH 05/17] rtc: mv: remove mv_rtc_alarm_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` Alexandre Belloni [this message]
2021-01-10 23:17   ` [PATCH 06/17] rtc: m48t59: remove m48t02_rtc_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 07/17] rtc: pcf2127: remove pcf2127_rtc_alrm_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 08/17] rtc: pcf85063: remove pcf85063_rtc_ops_alarm Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 09/17] rtc: rx8010: drop a struct rtc_class_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 10/17] rtc: pcf85363: " Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 11/17] rtc: m41t80: constify m41t80_rtc_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 12/17] rtc: opal: constify opal_rtc_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 13/17] rtc: rv3028: constify rv3028_rtc_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 14/17] rtc: rv3029: constify rv3029_rtc_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 15/17] rtc: rv3032: constify rv3032_rtc_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 16/17] rtc: rv8803: constify rv8803_rtc_ops Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17 ` [PATCH 17/17] rtc: tps65910: remove tps65910_rtc_ops_noirq Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni
2021-01-10 23:17   ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210110231752.1418816-7-alexandre.belloni@bootlin.com \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.