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: 8467331 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B19B39F38C for ; Tue, 1 Mar 2016 17:01:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E17A020260 for ; Tue, 1 Mar 2016 17:01:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12B87202FF for ; Tue, 1 Mar 2016 17:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752208AbcCARBO (ORCPT ); Tue, 1 Mar 2016 12:01:14 -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-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);