public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Kyle McMartin <kyle@mcmartin.ca>,
	rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>,
	linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org,
	linux-parisc@vger.kernel.org, linux-m68k@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] rtc: generic: allow building on all architectures
Date: Tue,  1 Mar 2016 17:59:57 +0100	[thread overview]
Message-ID: <1456851608-3374907-2-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1456851608-3374907-1-git-send-email-arnd@arndb.de>

There are four architectures using this driver, but since we can
build it with COMPILE_TEST, we should try dealing with the absence
of the asm/rtc.h header file, to avoid getting a build error:

drivers/rtc/rtc-generic.c:12:21: fatal error: asm/rtc.h: No such file or directory

This creates an alternative use of the driver, allowing architectures
to pass a set of rtc_class_ops in platform data. We can convert the
four architectures to use this and then remove the original
code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/rtc/rtc-generic.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c
index e782ebd719b2..d726c6aa96a8 100644
--- a/drivers/rtc/rtc-generic.c
+++ b/drivers/rtc/rtc-generic.c
@@ -9,6 +9,8 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 
+#if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \
+    defined(CONFIG_PPC) || defined(CONFIG_SUPERH32)
 #include <asm/rtc.h>
 
 static int generic_get_time(struct device *dev, struct rtc_time *tm)
@@ -33,13 +35,21 @@ static const struct rtc_class_ops generic_rtc_ops = {
 	.read_time = generic_get_time,
 	.set_time = generic_set_time,
 };
+#else
+#define generic_rtc_ops *(struct rtc_class_ops*)NULL
+#endif
 
 static int __init generic_rtc_probe(struct platform_device *dev)
 {
 	struct rtc_device *rtc;
+	const struct rtc_class_ops *ops;
+
+	ops = dev_get_platdata(&dev->dev);
+	if (!ops)
+		ops = &generic_rtc_ops;
 
 	rtc = devm_rtc_device_register(&dev->dev, "rtc-generic",
-					&generic_rtc_ops, THIS_MODULE);
+					ops, THIS_MODULE);
 	if (IS_ERR(rtc))
 		return PTR_ERR(rtc);
 
-- 
2.7.0

       reply	other threads:[~2016-03-01 17:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1456851608-3374907-1-git-send-email-arnd@arndb.de>
2016-03-01 16:59 ` Arnd Bergmann [this message]
2016-03-02  8:57   ` [PATCH 1/6] rtc: generic: allow building on all architectures Geert Uytterhoeven
2016-03-02  9:05     ` Arnd Bergmann
2016-03-02  9:28     ` Andreas Schwab
2016-03-02  9:39       ` Geert Uytterhoeven
2016-03-01 16:59 ` [PATCH 2/6] m68k: rtc: provide rtc_class_ops directly Arnd Bergmann
2016-03-01 16:59 ` [PATCH 3/6] powerpc: " Arnd Bergmann
2016-03-01 18:37   ` kbuild test robot
2016-03-01 20:31     ` Arnd Bergmann
2016-03-01 17:00 ` [PATCH 4/6] parisc: " Arnd Bergmann
2016-03-01 17:19   ` kbuild test robot
2016-03-10  4:34   ` Alexandre Belloni
2016-03-01 17:00 ` [PATCH 5/6] sh: " Arnd Bergmann
2016-03-01 17:00 ` [PATCH 6/6] rtc: generic: remove get_rtc_time/set_rtc_time wrappers Arnd Bergmann

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=1456851608-3374907-2-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=kyle@mcmartin.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=rtc-linux@googlegroups.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox