From patchwork Tue Mar 1 16:59:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8467321 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BBDC8C0554 for ; Tue, 1 Mar 2016 17:01:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E991520260 for ; Tue, 1 Mar 2016 17:01:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 859D8202C8 for ; Tue, 1 Mar 2016 17:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752381AbcCARBV (ORCPT ); Tue, 1 Mar 2016 12:01:21 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:59802 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752364AbcCARBT (ORCPT ); Tue, 1 Mar 2016 12:01:19 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MD8ge-1agLYe41oy-00GY0b; Tue, 01 Mar 2016 18:00:37 +0100 From: Arnd Bergmann To: Alexandre Belloni , Geert Uytterhoeven 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 2/6] m68k: rtc: provide rtc_class_ops directly Date: Tue, 1 Mar 2016 17:59:58 +0100 Message-Id: <1456851608-3374907-3-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:72JdRVEGitKHvXWvzoUbUvWzkk0q4J7xZt9OzT7M86DI8fe6GRL nX3K5A7ygjO5go06JAgV9gVIC6ntoDVVHd28Leuix83+zyUSmztoDjaDoCLbdY24AqwpE4S SirTpTE/uCX8D8g7B+l44BtGcAeY6AYbuWhUZBJIZQ4DIw1nLsk8a+MH0YMbYWJSxjTMCzT DKpkaNqQx0xC7rghSULXA== X-UI-Out-Filterresults: notjunk:1; V01:K0:ggtaDl2HJPI=:ppgIny8OngYdgGpOFhV6SZ jNzcTHdaALXsRBlIhTsgVkavdsF+FYMJpccVKX5SwG95XdoAHuMK7XnwOd4/Dlk8cOrzjU+Eb rL2Zol3jeYANV7QMXaXUifuhCxyPaQWJj4n3hqhNpz7eHTxAMI48DC7ixhzaLx4MusrBwL7QW oR5LHFIbfwnXAFpNz/2nNJL2npm8NzRv3Xsv2a+6/4eC6tn5MRcXRynllmK4zMQK6xS+dkQ1l ARMsBdSH77lZB3ECv76wYELNgoFnyH3w5d7tincCn9oEVRT5WctLXhvLeYcp+WzKdOFSRnudm XH/0OEjWtd991PXeO95hB8ImMNDAv50jedW2bAN003U6OmZOuzZcyXEqWvs6+BR//GsZRBxol Eayn/XXHI+UxUexPj1UK0UDFUi0ZMg2Iq+pMIwNDGwHxUbbyvwtXBkHtvoI1oOs/OxOOqynjw LDQKQb5liGbqIeYWu/pZtXBQl4+yMd614Gb337bFUg1F+7GaVkrxpraFDDXw/AjN4L7RduZOh iXeM9gHcejbn78Ia+XBbUPMc6HnXcxbPoMS/rt6qjG3WPILePbBBBl3AqJYeds8EL/IDN3R0y lHMvG2roFV8pZCzrLtCN/Jb9WHhQf6QH4PGKRlj0GAO/y2QBa8Bse6MumHy8VnmyKe82zo3Gi v3ux/As4AQJJ9ha9Ryi+7kJC3tykYaEHZyRaVmU51LEy6MNW9PwzNBp6gHnlhFV1Yn4w= 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 The rtc-generic driver provides an architecture specific wrapper on top of the generic rtc_class_ops abstraction, and m68k has another abstraction on top, which is a bit silly. This changes the m68k rtc-generic device to provide its rtc_class_ops directly, to reduce the number of layers by one. Signed-off-by: Arnd Bergmann --- arch/m68k/kernel/time.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index 3857737e3958..773b2187210d 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c @@ -87,6 +87,23 @@ void read_persistent_clock(struct timespec *ts) } #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET +static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm) +{ + mach_hwclk(0, tm); + return rtc_valid_tm(tm); +} + +static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm) +{ + if (mach_hwclk(1, tm) < 0) + return -EOPNOTSUPP; + return 0; +} + +static const struct rtc_class_ops generic_rtc_ops = { + .read_time = rtc_generic_get_time, + .set_time = rtc_generic_set_time, +}; static int __init rtc_init(void) { @@ -95,7 +112,10 @@ static int __init rtc_init(void) if (!mach_hwclk) return -ENODEV; - pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); + /* or just call devm_rtc_device_register instead? */ + pdev = platform_device_register_data(NULL, "rtc-generic", -1, + &generic_rtc_ops, + sizeof(generic_rtc_ops)); return PTR_ERR_OR_ZERO(pdev); }