From patchwork Tue Mar 1 16:59:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102642 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1940691lbc; Tue, 1 Mar 2016 09:01:19 -0800 (PST) X-Received: by 10.66.124.226 with SMTP id ml2mr31554309pab.90.1456851679075; Tue, 01 Mar 2016 09:01:19 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ah10si12486428pad.118.2016.03.01.09.01.18; Tue, 01 Mar 2016 09:01:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752350AbcCARBQ (ORCPT + 30 others); Tue, 1 Mar 2016 12:01:16 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:53682 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751771AbcCARBN (ORCPT ); Tue, 1 Mar 2016 12:01:13 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0Lj2nG-1a36jS25y2-00dDNH; Tue, 01 Mar 2016 18:00:28 +0100 From: Arnd Bergmann To: Alexandre Belloni Cc: linux-arm-kernel@lists.infradead.org, Kyle McMartin , rtc-linux@googlegroups.com, Alessandro Zummo , linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-parisc@vger.kernel.org, linux-m68k@lists.linux-m68k.org, Arnd Bergmann , 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 Message-Id: <1456851608-3374907-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456851608-3374907-1-git-send-email-arnd@arndb.de> References: <1456851608-3374907-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:B5ShExoSe/LlQlS4gFHKon++T3ysRIeZ5LX7fOS2CMdtJMJu+Gm rFi442YkW+4dzmYYTxx4rK10HjwKEeDMRQOtSYt31Jxe08Oe2iZ/RYEcD8Ok6xUhuMUQ3if nKrz7UXZ4C8gaD2I6lOBwkoERCYNPTkoLlOstoLmvS/Vd5U4C1Ib90n3KJjb0SWfEY5T25J WmRer+SpF06tQh4aS9I+g== X-UI-Out-Filterresults: notjunk:1; V01:K0:dAaVFL2LliI=:YiWRw9Jn45IpXzTqC+hu2I op4laaKXZ0XrwNeLhvjZUTSy08eJ9aDiPYYzJSmmyrGODS5OoVag8qCrZIAmU06IBq0pNUmz+ KF+XSH0EQk2siirNYtqRR/q0wxrW/biUdXIwzZVb+TZ+qpPq5JmkGofb7SElQYb2vDR5dw7Ka x4tnGmkYJbeRs3ZtXdZpbijoK50PCF7qwLgXsC2jaSqZTGCM2AppEak6WxXBd6TEuWSoiAEqG TKWeKbYuott2CkEbUPDN4Pjhkj2lYarL/oQakwcHHwdxY1TE5Xtxrm45X4GkqcD/ItLAXI4xP 9ZaFHHYzKWPokf2p8bOfwI78YuKDg/VM5FyQOOs6lbmctFC25xgRqfJFA0O8cxxaBpXIaDfxc z/Hi4tidA56pdqayu7PNLYmQ9C9rnO8Hhw3ivDi4g89yIjdxmW0mc+WxUpc3EiJvrHxmWZ7M+ jwc9dAvTS5tYwqX1jPL2AdmlDB3TZIrPfVai33LJZairG4rN1Di/vcETv3g74HiN/PfceTdTd pzCiwJdS48kmy61YTcM/RW6kHWFYm4YTlHi1/3BvlGhddd664onfYZxKqq+7zr5FBRsFlvOyv 6hO4OQFf2qQf5unkC45VFYpRrF7AhG60bvb1un4fEQNi3K5cLcL7w4j7ynS24ZW5v8xNvFDSh yu5X6lkwG+/YBEwKuKsufJfm4P9GxdG6VV+oggRa1/fNOXgGMz2cETRpTMwYgcmBu7+Y= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/rtc/rtc-generic.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.7.0 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 #include +#if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \ + defined(CONFIG_PPC) || defined(CONFIG_SUPERH32) #include 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);