From patchwork Tue Mar 1 16:59:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8467381 Return-Path: X-Original-To: patchwork-linux-parisc@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 518DD9F38C for ; Tue, 1 Mar 2016 17:03:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FAFD20265 for ; Tue, 1 Mar 2016 17:03:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9548920125 for ; Tue, 1 Mar 2016 17:03:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752724AbcCARCc (ORCPT ); Tue, 1 Mar 2016 12:02:32 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:55337 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699AbcCARCa (ORCPT ); Tue, 1 Mar 2016 12:02:30 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MUEV8-1aSVv304cU-00R4HT; Tue, 01 Mar 2016 18:01:35 +0100 From: Arnd Bergmann To: Alexandre Belloni , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman 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 3/6] powerpc: rtc: provide rtc_class_ops directly Date: Tue, 1 Mar 2016 17:59:59 +0100 Message-Id: <1456851608-3374907-4-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:la+hdd4yyrAyAuTGf3L+LeKdPaCifD6D8XqLDyUlhsKqIEwIoff C5xlTnYSE2EjfpCImWOoOxN8PkrKOm8kdfLICSkh13J9dCj1DJZ68mzJZ87Hb3x8PjoHqqV SUn7udi2BMMKOyMNRgV1uBBE7RXtyvPK5ACOFV8Tj6Yl4oNpmdi/VKdSWQ1TmCJKTuk3uuf ML4h9pAHONzpSq/oAxwoA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Kd/sbDg0XAM=:to6/p9T1Fh9uQzN8pHVeN2 5ZI0qfEiZLnDhsJyAs4xptq/cq7qkD0ZG+miFY80gpXD9+JSC86rFHQW6zibLZtsmyvGJKRSw FpuBbyER8vumI7TvooIahdg2LBVO7C5KClZKQKReFMNihcYT65ZQMeIMJFndid5NVBkRF6cVn MFfVOpCmdL3PiP9xNhwk2s9XJekZo0qmvf6ZLOOszi0u0BVPuAAiafqPZBZh40A2hmGnMyyFI Z/rLriZ17+UnszbDLgonYSFmVe/5W2joU/WFxK6LHdcC00himLI0z4w5xbQATNUzaArBFo1o/ c7IIgDyOmNVyrwupxBu/NooA1xVWei1xypc66gZ4NnkWAAkObpPxagAyxhZ8dBG5Ljo4Z3Azz ag2BVAzVz5HE08CqAZNk6CqX14gqVbxBvODB0KfYRP36cRP8a1uqRppHZ1fp7GmP1uGdkrZG4 yDVcs6Fypz5fNLb7shYUL0uVDc9m4u3SKSe6GHpZvGU9RIpbazeBc5cztwAO9v8cMiYCggZ+P 0C6S43HXWvSexOaslqI1Htwjf/f2ul+jqFYc0J+Jsn9JY4VBCD98pkVkih1uasmtKB19uBptv n9KruFSa9T+ztg6mXdMnCSPdV+OiosuhT6AcKbjNFso/CKAeO0nEkDw367b8MDbJABJX9Hrv3 nAXyXKTh0IrC9P+x0UWFejDVWJO3ZBfO2NsXtPhCZMXUIYmXpQ/lpg3ZFXlzmrIz7vzs= Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@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 The rtc-generic driver provides an architecture specific wrapper on top of the generic rtc_class_ops abstraction, and powerpc has another abstraction on top, which is a bit silly. This changes the powerpc rtc-generic device to provide its rtc_class_ops directly, to reduce the number of layers by one. Signed-off-by: Arnd Bergmann --- arch/powerpc/kernel/time.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 81b0900a39ee..84a1228be617 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -1080,6 +1080,28 @@ void calibrate_delay(void) loops_per_jiffy = tb_ticks_per_jiffy; } +static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm) +{ + ppc_md.get_rtc_time(tm); + return rtc_valid_tm(tm); +} + +static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm) +{ + if (!ppc_md.set_rtc_time) + return -EOPNOTSUPP; + + if (ppc_md.set_rtc_time(tm) < 0) + return -EOPNOTSUPP; + + return 0; +} + +static const struct rtc_class_ops rtc_generic_ops = { + .read_time = rtc_generic_get_time, + .set_time = rtc_generic_set_time, +}; + static int __init rtc_init(void) { struct platform_device *pdev; @@ -1087,7 +1109,9 @@ static int __init rtc_init(void) if (!ppc_md.get_rtc_time) return -ENODEV; - pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); + pdev = platform_device_register_data(NULL, "rtc-generic", -1, + &rtc_generic_ops, + sizeof(rtc_generic_ops)); return PTR_ERR_OR_ZERO(pdev); }