From patchwork Wed Apr 27 22:34:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102426 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2444578qge; Wed, 27 Apr 2016 15:36:06 -0700 (PDT) X-Received: by 10.66.193.202 with SMTP id hq10mr15322187pac.6.1461796565922; Wed, 27 Apr 2016 15:36:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si7549059paw.142.2016.04.27.15.36.05; Wed, 27 Apr 2016 15:36:05 -0700 (PDT) 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 S1754127AbcD0WgB (ORCPT + 29 others); Wed, 27 Apr 2016 18:36:01 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:65257 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753947AbcD0Wf4 (ORCPT ); Wed, 27 Apr 2016 18:35:56 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MORLZ-1b0ki22lID-005m4T; Thu, 28 Apr 2016 00:34:48 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 01/16] rtc: cmos: remove empty asm/mc146818rtc.h files Date: Thu, 28 Apr 2016 00:34:15 +0200 Message-Id: <1461796470-1291527-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:B1uPrrbFlwyJa5wj1lfx3hJnOYjPiyFIB6aSscav6a6cEXILlDR 3niXOOoA0jAyWJl3PerNK9g78btD1jCv56XU20aSlZM1PU3SeBBVMHEhFWQTlw9+hwapg7Q R7CAp0kpzbIYtdTmqnMZunlrP5wQJDLSZatlIYSVxKOTqqVCUuZtrKtPs3Pd85lC1fiMyd/ rXvzEwyexAEEjnEc07EqQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Abfw2q7P0G8=:lsIyBL2yHjsWHA87c1hxDQ 3+UbtQT4IAEwyJQVtkLW1LBsSpFBmH00h1KUcmlWhNTbG1DENv0/ME8iLc1B6qgVe+JA3TmNj S/CzpQzPVAj1MH96siKhly7d2rW9tUF7+uAy4zAdgae6cmf+keYihQ3wuYX40eAGZkDgdkCSi +MpxueFBUBSzGpsZw+CFsZwRsmnRj8F/xgwnlgKr/nNy2kfw1SCm5tvaP+TNVZNTY5RFwLtrY SSAT9XG8HLrkxtQ3Apf0RuAJPzvEAzL+QY71c08AInKONM8h41GA1HqObzBdIMrGtWEhA/StW vfEe2ZPOgqY5CSdiKiriTfKEtrb9AbQTSMETI0Oi9xUFjVfK1/GGGsKZpYRJ4IGhSpM2pwjap +TlLqWoUEvdb9yNtugh/M+t8z+3lY5pgOs5NZ0LBZBoCtxtklbf/2FA6Dvre2C7YMp9yv5qqn FiC61b5u7vQZ4ltro12N3fRX+0hi2lIRJlKDv5rEdeD+nAwDrSMDZsWFgdVzwgH1dfDhXxXbO uYZ1GLXrOlr/im+GsNQ/3tTMJoa6+23wWjPJmVRmbGLt3agEYyBfO2bnLLDwAoyTGb9Wikq/K YUpEFeGTeQk92Ij12yX9NN2sGKZ2G6Wlf/V5326BsSJ+xN0O8t9BHv8bGS4nU7++ty0cI0PlI UJQW5SqZ+MfjRlfa8b25o1bui91sqp99hvBDaQezVsZdxKXyZDp2wmvq8KtMfdF5byz0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nothing on these architectures ever includes the asm/mc146818rtc.h file, the drivers that used to do this have been fixed long ago, and the remaining users are all PC-specific. This removes the files for good. Signed-off-by: Arnd Bergmann Acked-by: Alexandre Belloni --- arch/frv/include/asm/mc146818rtc.h | 16 ---------------- arch/h8300/include/asm/mc146818rtc.h | 9 --------- arch/ia64/include/asm/mc146818rtc.h | 10 ---------- arch/parisc/include/asm/mc146818rtc.h | 9 --------- arch/sh/include/asm/mc146818rtc.h | 7 ------- 5 files changed, 51 deletions(-) delete mode 100644 arch/frv/include/asm/mc146818rtc.h delete mode 100644 arch/h8300/include/asm/mc146818rtc.h delete mode 100644 arch/ia64/include/asm/mc146818rtc.h delete mode 100644 arch/parisc/include/asm/mc146818rtc.h delete mode 100644 arch/sh/include/asm/mc146818rtc.h -- 2.7.0 diff --git a/arch/frv/include/asm/mc146818rtc.h b/arch/frv/include/asm/mc146818rtc.h deleted file mode 100644 index 90dfb7a633d1..000000000000 --- a/arch/frv/include/asm/mc146818rtc.h +++ /dev/null @@ -1,16 +0,0 @@ -/* mc146818rtc.h: RTC defs - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifndef _ASM_MC146818RTC_H -#define _ASM_MC146818RTC_H - - -#endif /* _ASM_MC146818RTC_H */ diff --git a/arch/h8300/include/asm/mc146818rtc.h b/arch/h8300/include/asm/mc146818rtc.h deleted file mode 100644 index ab9d9646d241..000000000000 --- a/arch/h8300/include/asm/mc146818rtc.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Machine dependent access functions for RTC registers. - */ -#ifndef _H8300_MC146818RTC_H -#define _H8300_MC146818RTC_H - -/* empty include file to satisfy the include in genrtc.c/ide-geometry.c */ - -#endif /* _H8300_MC146818RTC_H */ diff --git a/arch/ia64/include/asm/mc146818rtc.h b/arch/ia64/include/asm/mc146818rtc.h deleted file mode 100644 index 407787a237ba..000000000000 --- a/arch/ia64/include/asm/mc146818rtc.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _ASM_IA64_MC146818RTC_H -#define _ASM_IA64_MC146818RTC_H - -/* - * Machine dependent access functions for RTC registers. - */ - -/* empty include file to satisfy the include in genrtc.c */ - -#endif /* _ASM_IA64_MC146818RTC_H */ diff --git a/arch/parisc/include/asm/mc146818rtc.h b/arch/parisc/include/asm/mc146818rtc.h deleted file mode 100644 index adf41631449f..000000000000 --- a/arch/parisc/include/asm/mc146818rtc.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Machine dependent access functions for RTC registers. - */ -#ifndef _ASM_MC146818RTC_H -#define _ASM_MC146818RTC_H - -/* empty include file to satisfy the include in genrtc.c */ - -#endif /* _ASM_MC146818RTC_H */ diff --git a/arch/sh/include/asm/mc146818rtc.h b/arch/sh/include/asm/mc146818rtc.h deleted file mode 100644 index 0aee96a97330..000000000000 --- a/arch/sh/include/asm/mc146818rtc.h +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Machine dependent access functions for RTC registers. - */ -#ifndef _ASM_MC146818RTC_H -#define _ASM_MC146818RTC_H - -#endif /* _ASM_MC146818RTC_H */ From patchwork Wed Apr 27 22:34:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102424 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2444691qge; Wed, 27 Apr 2016 15:36:24 -0700 (PDT) X-Received: by 10.66.148.232 with SMTP id tv8mr15582962pab.21.1461796584421; Wed, 27 Apr 2016 15:36:24 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a206si6241420pfa.164.2016.04.27.15.36.24; Wed, 27 Apr 2016 15:36:24 -0700 (PDT) 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 S1754138AbcD0WgK (ORCPT + 29 others); Wed, 27 Apr 2016 18:36:10 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:55457 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753862AbcD0WgA (ORCPT ); Wed, 27 Apr 2016 18:36:00 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0LoqDL-1bbjM30yB1-00gm2t; Thu, 28 Apr 2016 00:34:48 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 02/16] rtc: cmos: move mc146818rtc code out of asm-generic/rtc.h Date: Thu, 28 Apr 2016 00:34:16 +0200 Message-Id: <1461796470-1291527-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:SfGJpr2EnAOmvWDaaSNdv9KkmBVnGnEv017FRLLlH9FyoBghQuB rQfBf7u5F09rTkZoAl8OOib/oJFjlaLcVFB8aLme80iz4tmEWOQ0tWCCQJuoS7Be050B/1O G4Vmvpbgyg9w4BZt1jXU89Z2NMth7KhPgeUYOPSMVHsajUKuZnOp1CdEb4+jztKh10hkepc nMM76mOb2iUeYu5hEUTVQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:dm+boJ9+kZg=:e+tQINJc4bk7Vg1oIPSNcu 0kRtbnBcTXAM6/CVm2vm23Ot5QTfWqIcRuQTHrTRavJ7vLFlylZ7ckmDcXvdz5xnvMO6NgI/W wNT1kPiKoooyibilajSvdZ3Cy5b7sRUjCnZrjHowtoLiuzbvXhhD9RgYzIcim0C2sdTMXekxv 7PwlDMrUXlfDee+Tc4Zi2egYuZsC1CtK8sQQ5GFMCyg95Sgn1dV/Fsx0nFqJNo0M01bhj3/mH Uk4Lqts+dKpz5YjUUCt/8sNZKeVdsyhTf4L3B/6Bl8qOKznBkCpzqTDECj3GIFY1jbdEoT5hH wb7WikoCZGMpWStYYJNT6c/dM+QYx60JZ4BhubXaLhloSMa3Qv0VelSuuInem3P+oxm1vhOQt MwtqrWGB4XF5Tyk1VNm/wYVZOCjoo4UirxPcheNgpNIzrROOjsgtDIdF+Ktdpn6QvA+ydZDPZ mhir3a+EpzF0AsWolReW73cqlPek3wiCsrvu6Kkc+2T4HElnUmKg1rBQvRQ4+YCfW5NWRJIFy JIswLnqUxbBHCr6sBrFPJtczUjGaVXbw2isIsoAXpW8I5mfV37L8o4HLTZW3YOA1cff5sgL1s OgSDAWhKqkd9kHEHRLb1BRha7NYRcWe+tvs5+kqrKz5asA2A5ihHuJ5e20Yn7cdtID0thbDjA k8YH6Hs4kl6i+mu54yV5oFFuHQxVIwLnybDL6xtHuWPI/ooqG7+nJlnh1K4fSjax3SyE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drivers should not really include stuff from asm-generic directly, and the PC-style cmos rtc driver does this in order to reuse the mc146818 implementation of get_rtc_time/set_rtc_time rather than the architecture specific one for the architecture it gets built for. To make it more obvious what is going on, this moves and renames the two functions into include/linux/mc146818rtc.h, which holds the other mc146818 specific code. Ideally it would be in a .c file, but that would require extra infrastructure as the functions are called by multiple drivers with conflicting dependencies. With this change, the asm-generic/rtc.h header also becomes much more generic, so it can be reused more easily across any architecture that still relies on the genrtc driver. The only caller of the internal __get_rtc_time/__set_rtc_time functions is in arch/alpha/kernel/rtc.c, and we just change those over to the new naming. Signed-off-by: Arnd Bergmann Acked-by: Alexandre Belloni --- arch/alpha/kernel/rtc.c | 6 +- arch/x86/include/asm/mc146818rtc.h | 1 - drivers/rtc/rtc-cmos.c | 12 +-- include/asm-generic/rtc.h | 206 +------------------------------------ include/linux/mc146818rtc.h | 194 ++++++++++++++++++++++++++++++++++ 5 files changed, 207 insertions(+), 212 deletions(-) -- 2.7.0 diff --git a/arch/alpha/kernel/rtc.c b/arch/alpha/kernel/rtc.c index f535a3fd0f60..ceed68c7500b 100644 --- a/arch/alpha/kernel/rtc.c +++ b/arch/alpha/kernel/rtc.c @@ -15,8 +15,6 @@ #include #include -#include - #include "proto.h" @@ -81,7 +79,7 @@ init_rtc_epoch(void) static int alpha_rtc_read_time(struct device *dev, struct rtc_time *tm) { - __get_rtc_time(tm); + mc146818_get_time(tm); /* Adjust for non-default epochs. It's easier to depend on the generic __get_rtc_time and adjust the epoch here than create @@ -112,7 +110,7 @@ alpha_rtc_set_time(struct device *dev, struct rtc_time *tm) tm = &xtm; } - return __set_rtc_time(tm); + return mc146818_set_time(tm); } static int diff --git a/arch/x86/include/asm/mc146818rtc.h b/arch/x86/include/asm/mc146818rtc.h index 0f555cc31984..24acd9ba7837 100644 --- a/arch/x86/include/asm/mc146818rtc.h +++ b/arch/x86/include/asm/mc146818rtc.h @@ -6,7 +6,6 @@ #include #include -#include #ifndef RTC_PORT #define RTC_PORT(x) (0x70 + (x)) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 84fb541038be..c7993f18edfa 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -43,7 +43,7 @@ #include /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ -#include +#include struct cmos_rtc { struct rtc_device *rtc; @@ -190,10 +190,10 @@ static inline void cmos_write_bank2(unsigned char val, unsigned char addr) static int cmos_read_time(struct device *dev, struct rtc_time *t) { /* REVISIT: if the clock has a "century" register, use - * that instead of the heuristic in get_rtc_time(). + * that instead of the heuristic in mc146818_get_time(). * That'll make Y3K compatility (year > 2070) easy! */ - get_rtc_time(t); + mc146818_get_time(t); return 0; } @@ -205,7 +205,7 @@ static int cmos_set_time(struct device *dev, struct rtc_time *t) * takes effect exactly 500ms after we write the register. * (Also queueing and other delays before we get this far.) */ - return set_rtc_time(t); + return mc146818_set_time(t); } static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t) @@ -1142,14 +1142,14 @@ static __init void cmos_of_init(struct platform_device *pdev) if (val) CMOS_WRITE(be32_to_cpup(val), RTC_FREQ_SELECT); - get_rtc_time(&time); + cmos_read_time(&pdev->dev, &time); ret = rtc_valid_tm(&time); if (ret) { struct rtc_time def_time = { .tm_year = 1, .tm_mday = 1, }; - set_rtc_time(&def_time); + cmos_set_time(&pdev->dev, &def_time); } } #else diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h index 4e3b6558331e..4fcff22cd707 100644 --- a/include/asm-generic/rtc.h +++ b/include/asm-generic/rtc.h @@ -12,12 +12,12 @@ #ifndef __ASM_RTC_H__ #define __ASM_RTC_H__ -#include #include -#include -#include -#ifdef CONFIG_ACPI -#include + +#ifndef get_rtc_time +#include +#define get_rtc_time mc146818_get_time +#define set_rtc_time mc146818_set_time #endif #define RTC_PIE 0x40 /* periodic interrupt enable */ @@ -31,202 +31,6 @@ #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ #define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ -/* - * Returns true if a clock update is in progress - */ -static inline unsigned char rtc_is_updating(void) -{ - unsigned char uip; - unsigned long flags; - - spin_lock_irqsave(&rtc_lock, flags); - uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); - spin_unlock_irqrestore(&rtc_lock, flags); - return uip; -} - -static inline unsigned int __get_rtc_time(struct rtc_time *time) -{ - unsigned char ctrl; - unsigned long flags; - unsigned char century = 0; - -#ifdef CONFIG_MACH_DECSTATION - unsigned int real_year; -#endif - - /* - * read RTC once any update in progress is done. The update - * can take just over 2ms. We wait 20ms. There is no need to - * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. - * If you need to know *exactly* when a second has started, enable - * periodic update complete interrupts, (via ioctl) and then - * immediately read /dev/rtc which will block until you get the IRQ. - * Once the read clears, read the RTC time (again via ioctl). Easy. - */ - if (rtc_is_updating()) - mdelay(20); - - /* - * Only the values that we read from the RTC are set. We leave - * tm_wday, tm_yday and tm_isdst untouched. Even though the - * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated - * by the RTC when initially set to a non-zero value. - */ - spin_lock_irqsave(&rtc_lock, flags); - time->tm_sec = CMOS_READ(RTC_SECONDS); - time->tm_min = CMOS_READ(RTC_MINUTES); - time->tm_hour = CMOS_READ(RTC_HOURS); - time->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); - time->tm_mon = CMOS_READ(RTC_MONTH); - time->tm_year = CMOS_READ(RTC_YEAR); -#ifdef CONFIG_MACH_DECSTATION - real_year = CMOS_READ(RTC_DEC_YEAR); -#endif -#ifdef CONFIG_ACPI - if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && - acpi_gbl_FADT.century) - century = CMOS_READ(acpi_gbl_FADT.century); -#endif - ctrl = CMOS_READ(RTC_CONTROL); - spin_unlock_irqrestore(&rtc_lock, flags); - - if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) - { - time->tm_sec = bcd2bin(time->tm_sec); - time->tm_min = bcd2bin(time->tm_min); - time->tm_hour = bcd2bin(time->tm_hour); - time->tm_mday = bcd2bin(time->tm_mday); - time->tm_mon = bcd2bin(time->tm_mon); - time->tm_year = bcd2bin(time->tm_year); - century = bcd2bin(century); - } - -#ifdef CONFIG_MACH_DECSTATION - time->tm_year += real_year - 72; -#endif - - if (century) - time->tm_year += (century - 19) * 100; - - /* - * Account for differences between how the RTC uses the values - * and how they are defined in a struct rtc_time; - */ - if (time->tm_year <= 69) - time->tm_year += 100; - - time->tm_mon--; - - return RTC_24H; -} - -#ifndef get_rtc_time -#define get_rtc_time __get_rtc_time -#endif - -/* Set the current date and time in the real time clock. */ -static inline int __set_rtc_time(struct rtc_time *time) -{ - unsigned long flags; - unsigned char mon, day, hrs, min, sec; - unsigned char save_control, save_freq_select; - unsigned int yrs; -#ifdef CONFIG_MACH_DECSTATION - unsigned int real_yrs, leap_yr; -#endif - unsigned char century = 0; - - yrs = time->tm_year; - mon = time->tm_mon + 1; /* tm_mon starts at zero */ - day = time->tm_mday; - hrs = time->tm_hour; - min = time->tm_min; - sec = time->tm_sec; - - if (yrs > 255) /* They are unsigned */ - return -EINVAL; - - spin_lock_irqsave(&rtc_lock, flags); -#ifdef CONFIG_MACH_DECSTATION - real_yrs = yrs; - leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) || - !((yrs + 1900) % 400)); - yrs = 72; - - /* - * We want to keep the year set to 73 until March - * for non-leap years, so that Feb, 29th is handled - * correctly. - */ - if (!leap_yr && mon < 3) { - real_yrs--; - yrs = 73; - } -#endif - -#ifdef CONFIG_ACPI - if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && - acpi_gbl_FADT.century) { - century = (yrs + 1900) / 100; - yrs %= 100; - } -#endif - - /* These limits and adjustments are independent of - * whether the chip is in binary mode or not. - */ - if (yrs > 169) { - spin_unlock_irqrestore(&rtc_lock, flags); - return -EINVAL; - } - - if (yrs >= 100) - yrs -= 100; - - if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) - || RTC_ALWAYS_BCD) { - sec = bin2bcd(sec); - min = bin2bcd(min); - hrs = bin2bcd(hrs); - day = bin2bcd(day); - mon = bin2bcd(mon); - yrs = bin2bcd(yrs); - century = bin2bcd(century); - } - - save_control = CMOS_READ(RTC_CONTROL); - CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); - save_freq_select = CMOS_READ(RTC_FREQ_SELECT); - CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); - -#ifdef CONFIG_MACH_DECSTATION - CMOS_WRITE(real_yrs, RTC_DEC_YEAR); -#endif - CMOS_WRITE(yrs, RTC_YEAR); - CMOS_WRITE(mon, RTC_MONTH); - CMOS_WRITE(day, RTC_DAY_OF_MONTH); - CMOS_WRITE(hrs, RTC_HOURS); - CMOS_WRITE(min, RTC_MINUTES); - CMOS_WRITE(sec, RTC_SECONDS); -#ifdef CONFIG_ACPI - if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && - acpi_gbl_FADT.century) - CMOS_WRITE(century, acpi_gbl_FADT.century); -#endif - - CMOS_WRITE(save_control, RTC_CONTROL); - CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); - - spin_unlock_irqrestore(&rtc_lock, flags); - - return 0; -} - -#ifndef set_rtc_time -#define set_rtc_time __set_rtc_time -#endif - static inline unsigned int get_rtc_ss(void) { struct rtc_time h; diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h index 433e0c74d643..e9e346b37846 100644 --- a/include/linux/mc146818rtc.h +++ b/include/linux/mc146818rtc.h @@ -14,6 +14,12 @@ #include #include /* get the user-level API */ #include /* register access macros */ +#include +#include + +#ifdef CONFIG_ACPI +#include +#endif #ifdef __KERNEL__ #include /* spinlock_t */ @@ -120,4 +126,192 @@ struct cmos_rtc_board_info { #define RTC_IO_EXTENT_USED RTC_IO_EXTENT #endif /* ARCH_RTC_LOCATION */ +/* + * Returns true if a clock update is in progress + */ +static inline unsigned char mc146818_is_updating(void) +{ + unsigned char uip; + unsigned long flags; + + spin_lock_irqsave(&rtc_lock, flags); + uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); + spin_unlock_irqrestore(&rtc_lock, flags); + return uip; +} + +static inline unsigned int mc146818_get_time(struct rtc_time *time) +{ + unsigned char ctrl; + unsigned long flags; + unsigned char century = 0; + +#ifdef CONFIG_MACH_DECSTATION + unsigned int real_year; +#endif + + /* + * read RTC once any update in progress is done. The update + * can take just over 2ms. We wait 20ms. There is no need to + * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. + * If you need to know *exactly* when a second has started, enable + * periodic update complete interrupts, (via ioctl) and then + * immediately read /dev/rtc which will block until you get the IRQ. + * Once the read clears, read the RTC time (again via ioctl). Easy. + */ + if (mc146818_is_updating()) + mdelay(20); + + /* + * Only the values that we read from the RTC are set. We leave + * tm_wday, tm_yday and tm_isdst untouched. Even though the + * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated + * by the RTC when initially set to a non-zero value. + */ + spin_lock_irqsave(&rtc_lock, flags); + time->tm_sec = CMOS_READ(RTC_SECONDS); + time->tm_min = CMOS_READ(RTC_MINUTES); + time->tm_hour = CMOS_READ(RTC_HOURS); + time->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); + time->tm_mon = CMOS_READ(RTC_MONTH); + time->tm_year = CMOS_READ(RTC_YEAR); +#ifdef CONFIG_MACH_DECSTATION + real_year = CMOS_READ(RTC_DEC_YEAR); +#endif +#ifdef CONFIG_ACPI + if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && + acpi_gbl_FADT.century) + century = CMOS_READ(acpi_gbl_FADT.century); +#endif + ctrl = CMOS_READ(RTC_CONTROL); + spin_unlock_irqrestore(&rtc_lock, flags); + + if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) + { + time->tm_sec = bcd2bin(time->tm_sec); + time->tm_min = bcd2bin(time->tm_min); + time->tm_hour = bcd2bin(time->tm_hour); + time->tm_mday = bcd2bin(time->tm_mday); + time->tm_mon = bcd2bin(time->tm_mon); + time->tm_year = bcd2bin(time->tm_year); + century = bcd2bin(century); + } + +#ifdef CONFIG_MACH_DECSTATION + time->tm_year += real_year - 72; +#endif + + if (century) + time->tm_year += (century - 19) * 100; + + /* + * Account for differences between how the RTC uses the values + * and how they are defined in a struct rtc_time; + */ + if (time->tm_year <= 69) + time->tm_year += 100; + + time->tm_mon--; + + return RTC_24H; +} + +/* Set the current date and time in the real time clock. */ +static inline int mc146818_set_time(struct rtc_time *time) +{ + unsigned long flags; + unsigned char mon, day, hrs, min, sec; + unsigned char save_control, save_freq_select; + unsigned int yrs; +#ifdef CONFIG_MACH_DECSTATION + unsigned int real_yrs, leap_yr; +#endif + unsigned char century = 0; + + yrs = time->tm_year; + mon = time->tm_mon + 1; /* tm_mon starts at zero */ + day = time->tm_mday; + hrs = time->tm_hour; + min = time->tm_min; + sec = time->tm_sec; + + if (yrs > 255) /* They are unsigned */ + return -EINVAL; + + spin_lock_irqsave(&rtc_lock, flags); +#ifdef CONFIG_MACH_DECSTATION + real_yrs = yrs; + leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) || + !((yrs + 1900) % 400)); + yrs = 72; + + /* + * We want to keep the year set to 73 until March + * for non-leap years, so that Feb, 29th is handled + * correctly. + */ + if (!leap_yr && mon < 3) { + real_yrs--; + yrs = 73; + } +#endif + +#ifdef CONFIG_ACPI + if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && + acpi_gbl_FADT.century) { + century = (yrs + 1900) / 100; + yrs %= 100; + } +#endif + + /* These limits and adjustments are independent of + * whether the chip is in binary mode or not. + */ + if (yrs > 169) { + spin_unlock_irqrestore(&rtc_lock, flags); + return -EINVAL; + } + + if (yrs >= 100) + yrs -= 100; + + if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) + || RTC_ALWAYS_BCD) { + sec = bin2bcd(sec); + min = bin2bcd(min); + hrs = bin2bcd(hrs); + day = bin2bcd(day); + mon = bin2bcd(mon); + yrs = bin2bcd(yrs); + century = bin2bcd(century); + } + + save_control = CMOS_READ(RTC_CONTROL); + CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); + save_freq_select = CMOS_READ(RTC_FREQ_SELECT); + CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); + +#ifdef CONFIG_MACH_DECSTATION + CMOS_WRITE(real_yrs, RTC_DEC_YEAR); +#endif + CMOS_WRITE(yrs, RTC_YEAR); + CMOS_WRITE(mon, RTC_MONTH); + CMOS_WRITE(day, RTC_DAY_OF_MONTH); + CMOS_WRITE(hrs, RTC_HOURS); + CMOS_WRITE(min, RTC_MINUTES); + CMOS_WRITE(sec, RTC_SECONDS); +#ifdef CONFIG_ACPI + if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && + acpi_gbl_FADT.century) + CMOS_WRITE(century, acpi_gbl_FADT.century); +#endif + + CMOS_WRITE(save_control, RTC_CONTROL); + CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); + + spin_unlock_irqrestore(&rtc_lock, flags); + + return 0; +} + #endif /* _MC146818RTC_H */ From patchwork Wed Apr 27 22:34:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102421 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2445153qge; Wed, 27 Apr 2016 15:37:39 -0700 (PDT) X-Received: by 10.98.10.20 with SMTP id s20mr15787672pfi.109.1461796659710; Wed, 27 Apr 2016 15:37:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10si7584957pas.64.2016.04.27.15.37.39; Wed, 27 Apr 2016 15:37:39 -0700 (PDT) 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 S1753961AbcD0Whh (ORCPT + 29 others); Wed, 27 Apr 2016 18:37:37 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:56082 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753894AbcD0Wfm (ORCPT ); Wed, 27 Apr 2016 18:35:42 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0Mgw4G-1bHbAm3LCi-00M4ZE; Thu, 28 Apr 2016 00:34:49 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 03/16] char/genrtc: x86: remove remnants of asm/rtc.h Date: Thu, 28 Apr 2016 00:34:17 +0200 Message-Id: <1461796470-1291527-4-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:IO1YOHRqyK4MZXxcBIhsyFhwbqFw/XypBGuGnI2njAINgZohy82 E9Yn5UoPBs08qhs+Blibug5xFG9uQENs8GxRyknYq3RqC2KW/PmUAlfeFWrtoi1SPooMAss cHz1ejKndhQvNCbM29h6pd6gsUNYJJf/NptL76BfNEn13RyrUjoAAlFQ62PmisNwqeLn3n0 A+H12sUhqymCkZXoTrfAg== X-UI-Out-Filterresults: notjunk:1; V01:K0:6UfdcP7XGKU=:pGjQo+faqEhs4Y8eJbGfGO JJPN06KkmOED3L2KtVipoFK+mbI4ln+ANzSlFeX4abFqptXlxVfxVkq5H+GQr9YjEGRYGvqY0 mOJtyny/ybjk/g0Anj9vQvuqN4/UiqF4ZT5sgHk4jThOg5Sx37mPgT03FN2sDypq1bn/b3FFN WkrSJKkfwwDwG4AWpPkXGtgwiIP/AMUOij1yoolGa+hs1HAx9kV11SJIpPLWPuOsufPtKdsKm PhmDPOsx1gwTfpJOAdsj9FuoP5uzIAeoflJu7wh2QXocgn0kPoXytVxHn7dkldztVfNe5qZ84 EqVr+Gx+Qnw5fcIIJoNl3IexSc4U4pYYcoLfWesnxz4JWTEb84DUNiDFImXy5UCZnvRlo2MDP 9TgKTDmbG2tnWgBcHsMGgamSknuq8hbVdImuxf3Wtwy4s79r2lEhdJrNbJfI5hyDvMG/Rov6a OLmN/kDKwzf9pZlCOZ8wS8q+fyQglL/57bCanq7NWaYps7FMJ5LGJsA4Ga4eVrj85dSCITri4 qktgk+C0Y7Y3JO6adD7ZAMMxPbJ8NUgqWfEVRg41GLl0UN0WeAheVdhENXX8i8zP/hU0g0yx3 Am995t6DO89hpB0eBaj9ZNUW0pXC1lrFM+U9ISpMxuxbuEecRixvg1Fs/y9l1zKOHE0UThGsg l6edzM1FWwYe3sINbjhEZspwlDNwI63JDjSzVv1bjIvXRfwZ5HeyxrVwTQxiQyJvSU2A= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 3195ef59cb42 ("x86: Do full rtc synchronization with ntp") had the side-effect of unconditionally enabling the RTC_LIB symbol on x86, which in turn disables the selection of the CONFIG_RTC and CONFIG_GEN_RTC drivers that contain a two older implementations of the CONFIG_RTC_DRV_CMOS driver. This removes x86 from the list for genrtc, and changes all references to the asm/rtc.h header to instead point to the interfaces from linux/mc146818rtc.h. Signed-off-by: Arnd Bergmann --- arch/x86/include/asm/rtc.h | 1 - arch/x86/kernel/hpet.c | 3 +-- arch/x86/kernel/rtc.c | 3 +-- arch/x86/platform/efi/efi.c | 1 - drivers/acpi/acpi_cmos_rtc.c | 2 +- drivers/base/power/trace.c | 6 +++--- drivers/char/Kconfig | 2 +- drivers/rtc/rtc-mrst.c | 2 +- 8 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 arch/x86/include/asm/rtc.h -- 2.7.0 diff --git a/arch/x86/include/asm/rtc.h b/arch/x86/include/asm/rtc.h deleted file mode 100644 index f71c3b0ed360..000000000000 --- a/arch/x86/include/asm/rtc.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index f112af7aa62e..357900aad62c 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -1020,7 +1020,6 @@ void hpet_disable(void) */ #include #include -#include #define DEFAULT_RTC_INT_FREQ 64 #define DEFAULT_RTC_SHIFT 6 @@ -1244,7 +1243,7 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) memset(&curr_time, 0, sizeof(struct rtc_time)); if (hpet_rtc_flags & (RTC_UIE | RTC_AIE)) - get_rtc_time(&curr_time); + mc146818_set_time(&curr_time); if (hpet_rtc_flags & RTC_UIE && curr_time.tm_sec != hpet_prev_update_sec) { diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c index eceaa082ec3f..79c6311cd912 100644 --- a/arch/x86/kernel/rtc.c +++ b/arch/x86/kernel/rtc.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #ifdef CONFIG_X86_32 @@ -47,7 +46,7 @@ int mach_set_rtc_mmss(const struct timespec *now) rtc_time_to_tm(nowtime, &tm); if (!rtc_valid_tm(&tm)) { - retval = set_rtc_time(&tm); + retval = mc146818_set_time(&tm); if (retval) printk(KERN_ERR "%s: RTC write failed with error %d\n", __func__, retval); diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 994a7df84a7b..13b216f71191 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -51,7 +51,6 @@ #include #include #include -#include #include #define EFI_DEBUG diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c index 81dc75033f15..0980a133916f 100644 --- a/drivers/acpi/acpi_cmos_rtc.c +++ b/drivers/acpi/acpi_cmos_rtc.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include "internal.h" diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c index a6975795e7f3..efec10b49d59 100644 --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include "power.h" @@ -103,7 +103,7 @@ static int set_magic_time(unsigned int user, unsigned int file, unsigned int dev n /= 24; time.tm_min = (n % 20) * 3; n /= 20; - set_rtc_time(&time); + mc146818_set_time(&time); return n ? -1 : 0; } @@ -112,7 +112,7 @@ static unsigned int read_magic_time(void) struct rtc_time time; unsigned int val; - get_rtc_time(&time); + mc146818_get_time(&time); pr_info("RTC time: %2d:%02d:%02d, date: %02d/%02d/%02d\n", time.tm_hour, time.tm_min, time.tm_sec, time.tm_mon + 1, time.tm_mday, time.tm_year % 100); diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index ca397384dc15..9bdb629fbaae 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -328,7 +328,7 @@ config JS_RTC config GEN_RTC tristate "Generic /dev/rtc emulation" depends on RTC!=y - depends on ALPHA || M68K || MN10300 || PARISC || PPC || X86 + depends on ALPHA || M68K || MN10300 || PARISC || PPC ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index 548ea6f6f384..bb8ac7c5e217 100644 --- a/drivers/rtc/rtc-mrst.c +++ b/drivers/rtc/rtc-mrst.c @@ -32,11 +32,11 @@ #include #include #include +#include #include #include #include -#include #include #include #include From patchwork Wed Apr 27 22:34:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102428 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2444453qge; Wed, 27 Apr 2016 15:35:47 -0700 (PDT) X-Received: by 10.66.254.74 with SMTP id ag10mr15606629pad.106.1461796547516; Wed, 27 Apr 2016 15:35:47 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wl8si11934965pab.33.2016.04.27.15.35.47; Wed, 27 Apr 2016 15:35:47 -0700 (PDT) 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 S1754080AbcD0Wfi (ORCPT + 29 others); Wed, 27 Apr 2016 18:35:38 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:50172 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753921AbcD0Wfc (ORCPT ); Wed, 27 Apr 2016 18:35:32 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0M6lu8-1bs1r31Q1s-00wVFU; Thu, 28 Apr 2016 00:34:49 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 04/16] rtc: sh: provide rtc_class_ops directly Date: Thu, 28 Apr 2016 00:34:18 +0200 Message-Id: <1461796470-1291527-5-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:3mgPSE3SDOSGAPnsP2hm0JPweUgYtF3hmNHddu5lFI7Vgzep5rl VDnzLqBtUp/QWQ3a5cHvmTFVwY0WJxaoNoZvo6tiotT0HytAZq1NoTBmoQY3Dn5oYCYiDgc 7BQA1q/wy9ux4qiRU7IQTr15Pmp8laDylx/T4Qlb02iE5Ou6Pn3/WRMvTWEACYk7W2uEolE KQY4wphBB/JxvTn5r3P+g== X-UI-Out-Filterresults: notjunk:1; V01:K0:9+H6nzp0bnE=:I4z+ErcfYMVaYZB6MzPdgd kMTXKYKpAxz64oMUweemdNBZXo8k3NBRxXhopVoa6Fxbz3n8G+IoAjIatJrcUUIcBnTxUzlcb F3i/nOY8scMagFv15deoFN0F/Vum9XSngmheNnXs/Ho3fr3a1kkzPnKB1JnX6bygFOV8KEyze D7Y1NZJ78b/My1N8GqdKSGsoGDeuIRbfOfVwwIX9c65l0P76RNpzNJOn6W8D+lePVSU71qmtK Im2nE56Q4ChFWLJlDBwYRqWw9MeN2N/hrtUtjDyojHKWutUo0OWlmAYNbzyI6kC077AOZHDgV Cz5zv2dJj+0k8yh0Lpsob9aXv9GROQMARThocmhIcFg4Uu3PsU5Fk0Jrf3voy7+Bbnp+gEqqr oWgGlq/aPXigYF/Z8waCWEKtqPONM1opw/aomlUcEL+b2OcYO0nbNbooLTmlcxx0cI8BNTeDx UXnJbgGWHPcNTyeUIT/25kyFztjM9qZuNSZrysYu/2Knro9vynCFJG8bmn2QWcRsqBi9OPXH0 LO89yQzmLgcOyAW+ykJmhDSfwR1E/a7APNZFsGPCV6Okowqcv8ihWb5201ELtMz8OSbXgKB2A hrQWeMlYqyJz3c5jwwjfY+OIUAGYsFUZ962dJgwXcYaFxdwJ6woMu5J9EjEslJydwtWCaPw3T KulUxt7k1mVYkov79Dkqzwwls00DOC8oNjSuw2L201quR0Rbhk8WKvc3tjCVZqPefurI= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rtc-generic driver provides an architecture specific wrapper on top of the generic rtc_class_ops abstraction, and on sh, that goes through another indirection using the rtc_sh_get_time/rtc_sh_set_time functions. This changes the sh rtc-generic device to provide its rtc_class_ops directly, skipping one of the abstraction levels. Signed-off-by: Arnd Bergmann --- arch/sh/include/asm/rtc.h | 11 ----------- arch/sh/kernel/time.c | 32 +++++++++++++++++++------------- drivers/rtc/rtc-generic.c | 2 +- 3 files changed, 20 insertions(+), 25 deletions(-) -- 2.7.0 diff --git a/arch/sh/include/asm/rtc.h b/arch/sh/include/asm/rtc.h index 52b0c2dba979..f7b010d48af7 100644 --- a/arch/sh/include/asm/rtc.h +++ b/arch/sh/include/asm/rtc.h @@ -6,17 +6,6 @@ extern void (*board_time_init)(void); extern void (*rtc_sh_get_time)(struct timespec *); extern int (*rtc_sh_set_time)(const time_t); -/* some dummy definitions */ -#define RTC_BATT_BAD 0x100 /* battery bad */ -#define RTC_SQWE 0x08 /* enable square-wave output */ -#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ -#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ -#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ - -struct rtc_time; -unsigned int get_rtc_time(struct rtc_time *); -int set_rtc_time(struct rtc_time *); - #define RTC_CAP_4_DIGIT_YEAR (1 << 0) struct sh_rtc_platform_info { diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c index d6d0a986c6e9..92cd676970d9 100644 --- a/arch/sh/kernel/time.c +++ b/arch/sh/kernel/time.c @@ -50,27 +50,30 @@ int update_persistent_clock(struct timespec now) } #endif -unsigned int get_rtc_time(struct rtc_time *tm) +static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm) { - if (rtc_sh_get_time != null_rtc_get_time) { - struct timespec tv; + struct timespec tv; - rtc_sh_get_time(&tv); - rtc_time_to_tm(tv.tv_sec, tm); - } - - return RTC_24H; + rtc_sh_get_time(&tv); + rtc_time_to_tm(tv.tv_sec, tm); + return 0; } -EXPORT_SYMBOL(get_rtc_time); -int set_rtc_time(struct rtc_time *tm) +static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm) { unsigned long secs; rtc_tm_to_time(tm, &secs); - return rtc_sh_set_time(secs); + if (!rtc_sh_set_time || rtc_sh_set_time(secs) < 0) + return -EOPNOTSUPP; + + return 0; } -EXPORT_SYMBOL(set_rtc_time); + +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_generic_init(void) { @@ -79,7 +82,10 @@ static int __init rtc_generic_init(void) if (rtc_sh_get_time == null_rtc_get_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); } diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c index d726c6aa96a8..3958e87a05fa 100644 --- a/drivers/rtc/rtc-generic.c +++ b/drivers/rtc/rtc-generic.c @@ -10,7 +10,7 @@ #include #if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \ - defined(CONFIG_PPC) || defined(CONFIG_SUPERH32) + defined(CONFIG_PPC) #include static int generic_get_time(struct device *dev, struct rtc_time *tm) From patchwork Wed Apr 27 22:34:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102417 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2446339qge; Wed, 27 Apr 2016 15:40:57 -0700 (PDT) X-Received: by 10.98.38.130 with SMTP id m124mr15770062pfm.14.1461796857694; Wed, 27 Apr 2016 15:40:57 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si6284715pfa.23.2016.04.27.15.40.57; Wed, 27 Apr 2016 15:40:57 -0700 (PDT) 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 S1753945AbcD0Wks (ORCPT + 29 others); Wed, 27 Apr 2016 18:40:48 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:64591 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbcD0Wko (ORCPT ); Wed, 27 Apr 2016 18:40:44 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MTP9j-1b5kg23iqt-00SRgd; Thu, 28 Apr 2016 00:34:50 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 05/16] char/genrtc: remove alpha support Date: Thu, 28 Apr 2016 00:34:19 +0200 Message-Id: <1461796470-1291527-6-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:5Xhm0uyLDMztmgDv4vSJ3XFkiAZV3dsnNylUjDski8dEf27pE0C o+W/4qhlACXl83v/RAVmDXBsRfVs7R3k9xjIO+0M0rc+3D7FaFObsJqdWcdFdjgqovvCKzG cFrQzvD6Gl+eOylSwl7EO60Ys1O+uvbOrI6aLgXqtU9LGfpuiEVR0vYG5wowQi2P5XUDZl1 e1NY3JOL8OMPvOi/DPmXA== X-UI-Out-Filterresults: notjunk:1; V01:K0:7TrYiwxaXnI=:yk9Cz6dUv08Tl4kSB6Ppvd boW1xy7axCYuP2PVNYTjArIoHxzlspI70W5VZw1XREqT71oZTEBnk/ozdttjnhUtlCq7zshrf rwEQi3l2puxP+4MShnwzeM2C3beQc84BXmdljOfhTQB58g6dG85aXzwJoz9iXigd9M1hxZYQx rIXP0GjJh7764vQevnBcfhPqKkIxI50rX56lD2NbatoD3FYrqP8e9jwgxwiOGlYlmnOtcYIZW ApuooKlR7YmbwTKqAKwXrSY7J/lEkMaaYj4xQSrA+VgAwQfevJoxJfJUrbNJFqx+dI63dziKB LKTzp5GjJGKsNxx0gPUPLPmBFBTw1v+y4a5Ihrx2CRFhtVmv374gatSOOjn+kiiQmgOV4QLik aC/Sl3dFIVZq1bZLPdlUWNAxOds5eJL1QVOJxOiyCegL3SMI5JHH3jW71Kmm0PwzLyTTC2VuP Acxk161ki7Lr5ChtCBwoaBKqyTbqXZI5SRke4HnHc+FJ/MFmScsA8HUUQk2OqkAqXlbCEOdWT c4xOhiHK8PfzCw9lL6NdG2Q9nx5jq4+5x8/XsRKof2a8HyjoxAgJwKgL2qhWYw3Jn2AFGktux RqqkUT/OTZG4gQakEKfK2ye4XD6971gEBPVmg6xMd6FtpyEgGaSd8gkf6lE+24J5oudQqRVEc byhY0AsrK4MOnol8w5dK9JI2cG5zM0KTbVW0R1gqh/NyWvNCacMV1eklM5M5knMqY/J0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The genrtc driver serves no purpose on Alpha because it drives the same hardware as the original rtc.c driver, and the newer rtc-generic.c or rtc-cmos.c drivers on architectures that use the asm-generic/rtc.h header. The defconfig uses CONFIG_RTC=y, so this driver is not used by default. At one point it was used to abstract a quirk for the "Marvel" platform, but it does not do this any more after the code was moved into yet another driver in arch/alpha/kernel/rtc.c. Signed-off-by: Arnd Bergmann --- arch/alpha/include/asm/rtc.h | 1 - arch/alpha/kernel/core_marvel.c | 1 - drivers/char/Kconfig | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 arch/alpha/include/asm/rtc.h -- 2.7.0 diff --git a/arch/alpha/include/asm/rtc.h b/arch/alpha/include/asm/rtc.h deleted file mode 100644 index f71c3b0ed360..000000000000 --- a/arch/alpha/include/asm/rtc.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c index 53dd2f1a53aa..d5f0580746a5 100644 --- a/arch/alpha/kernel/core_marvel.c +++ b/arch/alpha/kernel/core_marvel.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "proto.h" diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 9bdb629fbaae..697510325b1d 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -328,7 +328,7 @@ config JS_RTC config GEN_RTC tristate "Generic /dev/rtc emulation" depends on RTC!=y - depends on ALPHA || M68K || MN10300 || PARISC || PPC + depends on M68K || MN10300 || PARISC || PPC ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you From patchwork Wed Apr 27 22:34:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102415 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2446494qge; Wed, 27 Apr 2016 15:41:26 -0700 (PDT) X-Received: by 10.98.80.10 with SMTP id e10mr15640389pfb.141.1461796886504; Wed, 27 Apr 2016 15:41:26 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si6274139pfn.148.2016.04.27.15.41.26; Wed, 27 Apr 2016 15:41:26 -0700 (PDT) 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 S1753918AbcD0WlR (ORCPT + 29 others); Wed, 27 Apr 2016 18:41:17 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:63699 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbcD0Wkx (ORCPT ); Wed, 27 Apr 2016 18:40:53 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0M6ETS-1btfkG1nCs-00yATK; Thu, 28 Apr 2016 00:34:50 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 06/16] char/genrtc: remove mn10300 support Date: Thu, 28 Apr 2016 00:34:20 +0200 Message-Id: <1461796470-1291527-7-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:HgqZYZpTezOakQAI7K5jhMcg2t50rak84IQeVjyNsyryOUqigp4 qRAclMb08n/tnxuWPJbXapcyn/3CDxTMqicFvMsgxfA1AY/gZ13Xi72gXk3O3hgs8x+B+u0 jtYgJ0vIrL57uVKSkiWt7y31B8T+KV1psGSar5EVAeIHOhhmbZ13tNBlaIKyLMC+L+6tjgK MqA+uBSlCN6hHvX+wXtnQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:iTr1ijSpHg4=:lR4KKIphuoUTLBHJszzgUk vpjoDCMEyaidgYXxerw60ZtvF+pLbAbtg3jb4SW7AXcqttuq/WXf97KT3RjZYUkzDepDS8gm2 Hwl7a0IiVMWeKXX+f3Y7xVsRTd8tiNbV2e4YbBZRCX2IuCVz7iLIkRkYxWAe3TUdlH7y1aKgn 3Juluyx49hausWCkHYHZAwUB7d3EwUiPg7WvZXfEyVDPO6EIEuAO2gBrOziKM2YQBWXvjqOC6 VfSnr2xmp8r5ZfpqoF7ciAokuy1Lxnvg7mImzUECNjRcs8d+qaASoaw7mH1/jG1WIE4GIMHBO K4aMTCgoTUtzkujb295/7XEl3wGF0glnWq2i1e/cZYGZlYiC/A5VFHqCvVEXBonKNxw/l0KtB to0ejxyjU+m5frVRaaE1SmcImx3tKGJL3s86JJMM6caVap6yANahC2Q50j4DhI9HbjVFUk6WE mW48GUx63ylwTQHsrEulvyrn4qQhvb5elLp4AGgIMLWMKOktAg9Xa/gqX/vMa+HjFoRdepIz4 8CHvRVAMMQRstfYfM2PdXVnxvPag8TZEZeyx3+RkXKgzbLvAp6uGB/lr4Otdqrs4yZCLAnr7p qdzOANdpNNaDcY2P8zE4AbaQ08CXm09gDj7tl6L0/qe+POnF+51ClP3YAEPU59+HPyW0FI4/z PMXYvkLIVVJiIp03E57h9mvMPXT61m4GWdv9Qko8dIzvzBY9RQ2U/1C0HYTgDXePGc3E= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The genrtc driver serves no purpose on mn10300 because it drives the same hardware as the original rtc.c driver, and the newer rtc-generic.c or rtc-cmos.c drivers on architectures that use the asm-generic/rtc.h header. I assume it was initially only added for completeness when the mn10300 port was done, but the older rtc.c driver was always used instead. We can also stop include asm-generic/rtc.h now, because we just call mc146818_set_time() directly. It would be nice to change the architecture to use the rtc-cmos driver next, and remove support for the old rtc driver as well. Signed-off-by: Arnd Bergmann --- arch/mn10300/include/asm/rtc.h | 2 -- arch/mn10300/kernel/rtc.c | 2 +- drivers/char/Kconfig | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) -- 2.7.0 diff --git a/arch/mn10300/include/asm/rtc.h b/arch/mn10300/include/asm/rtc.h index 6c14bb1d0d9b..07dc87656197 100644 --- a/arch/mn10300/include/asm/rtc.h +++ b/arch/mn10300/include/asm/rtc.h @@ -25,6 +25,4 @@ static inline void calibrate_clock(void) #endif /* !CONFIG_MN10300_RTC */ -#include - #endif /* _ASM_RTC_H */ diff --git a/arch/mn10300/kernel/rtc.c b/arch/mn10300/kernel/rtc.c index 48d7058b3295..77e0be4d92ea 100644 --- a/arch/mn10300/kernel/rtc.c +++ b/arch/mn10300/kernel/rtc.c @@ -27,7 +27,7 @@ void read_persistent_clock(struct timespec *ts) { struct rtc_time tm; - get_rtc_time(&tm); + mc146818_set_time(&tm); ts->tv_nsec = 0; ts->tv_sec = mktime(tm.tm_year, tm.tm_mon, tm.tm_mday, diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 697510325b1d..d17ed90ebc82 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -328,7 +328,7 @@ config JS_RTC config GEN_RTC tristate "Generic /dev/rtc emulation" depends on RTC!=y - depends on M68K || MN10300 || PARISC || PPC + depends on M68K || PARISC || PPC ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you From patchwork Wed Apr 27 22:34:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102429 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2444399qge; Wed, 27 Apr 2016 15:35:38 -0700 (PDT) X-Received: by 10.66.176.103 with SMTP id ch7mr9358959pac.20.1461796538192; Wed, 27 Apr 2016 15:35:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e66si6252540pfa.118.2016.04.27.15.35.37; Wed, 27 Apr 2016 15:35:38 -0700 (PDT) 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 S1754033AbcD0Wfb (ORCPT + 29 others); Wed, 27 Apr 2016 18:35:31 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:63201 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753532AbcD0Wf2 (ORCPT ); Wed, 27 Apr 2016 18:35:28 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0M5xcn-1bsqnb3ynZ-00xtDt; Thu, 28 Apr 2016 00:34:51 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 07/16] rtc: parisc: provide rtc_class_ops directly Date: Thu, 28 Apr 2016 00:34:21 +0200 Message-Id: <1461796470-1291527-8-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:62x2aIdnKqPcbygSy2sENMpJcKWeNB/mTUpBKKJ/eLubsRKZxZT vgqeOFbyF4Ow5fAHeDVhHoNROE+VX/3I4SOo7G7BRLud94NFThUvY67uDxb0KUw6D12Ut94 JVLlhePLyZCK4Mx8LVPFkQzrP0/XaTEewLMXRILfglf7djYnMY/tRWZWxpBtDEzkpuX0cDT BmPlvG3HDiv8dHINrhYjw== X-UI-Out-Filterresults: notjunk:1; V01:K0:TwoCPQQjntU=:3KW+cYvH1Kjlv23f/GpgTZ VrwjEOpbV5drQoa1MkdlY2tNqNDXinDw2Wjj+T6VGqyE3umtt9am/W/rcugvgm7QKryMRLC11 57CMrtVF2mUNLrYuTvGaPm0BdVE0UKZ7UOtBEHt68bKOfIFXwl9NlupI6UovXGE0gh1tqpNbh 8iDYQPHQfEyZB8z6ozGgrRkK6fOVLrylUKLUe0F757r5kfUKQO1g43hoiIFNuPwp4vM3t9qBh pIXZ+3Dk4ewzP6JGgY2gxCx2d1daHXjoJoSpgbQpKqKmsVXKqDYbmc6QwRun4A6k/Bb8JyrOf wQryd5YD3feaeOjmbV1YfUYxkHM5FTLKR3NVg10fXSgON92K/8XkD5vDrlaYUiIq3i79KCAo2 smTXna8COSOANqJRCAY9mVccUFam8rVguxCbfY1SQbqILLDywmi4mbCnvi/GCe5ixrTO9gNn4 pWRRnp7T88A9qY8Z1vVd0PIdYLJjDFCoMzVb6d/dorfh9XTQf/7l3HeKAp5Pepb2DY5tEfw/M PsRDYsJAWNXuoFxPpABaE3h9TwsltYwCiQqVmiPh42Xv8Y+Rq93HOyZLW/2QtigkUmONNHg+3 uzjWFb9sBIrVE7hWtuKiH5M4wVAdkg+3GNujHM38dGV3lObUHay090fml6a+DNv7tRtPErt9T QGTqA0+AFdDKyElbrPwggev1AKNaWzxWjSA03MgHZxbCSQQm8O5stfna7HgwGARaXF/w= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rtc-generic driver provides an architecture specific wrapper on top of the generic rtc_class_ops abstraction, and on pa-risc, that is implemented using an open-coded version of rtc_time_to_tm/rtc_tm_to_time. This changes the parisc rtc-generic device to provide its rtc_class_ops directly, using the normal helper functions, which makes this y2038 safe (on 32-bit) and simplifies the implementation. Signed-off-by: Arnd Bergmann --- arch/parisc/kernel/time.c | 36 +++++++++++++++++++++++++++++++++++- drivers/rtc/rtc-generic.c | 3 +-- 2 files changed, 36 insertions(+), 3 deletions(-) -- 2.7.0 diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 58dd6801f5be..744878789752 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c @@ -12,6 +12,7 @@ */ #include #include +#include #include #include #include @@ -248,14 +249,47 @@ void __init start_cpu_itimer(void) per_cpu(cpu_data, cpu).it_value = next_tick; } +#if IS_ENABLED(CONFIG_RTC_DRV_GENERIC) +static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm) +{ + struct pdc_tod tod_data; + + memset(tm, 0, sizeof(*tm)); + if (pdc_tod_read(&tod_data) < 0) + return -EOPNOTSUPP; + + /* we treat tod_sec as unsigned, so this can work until year 2106 */ + rtc_time64_to_tm(tod_data.tod_sec, tm); + return rtc_valid_tm(tm); +} + +static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm) +{ + time64_t secs = rtc_tm_to_time64(tm); + + if (pdc_tod_set(secs, 0) < 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; - 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); } device_initcall(rtc_init); +#endif void read_persistent_clock(struct timespec *ts) { diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c index 3958e87a05fa..92b5e02a3750 100644 --- a/drivers/rtc/rtc-generic.c +++ b/drivers/rtc/rtc-generic.c @@ -9,8 +9,7 @@ #include #include -#if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \ - defined(CONFIG_PPC) +#if defined(CONFIG_M68K) || defined(CONFIG_PPC) #include static int generic_get_time(struct device *dev, struct rtc_time *tm) From patchwork Wed Apr 27 22:34:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102420 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2445338qge; Wed, 27 Apr 2016 15:38:10 -0700 (PDT) X-Received: by 10.98.98.1 with SMTP id w1mr15664696pfb.117.1461796690725; Wed, 27 Apr 2016 15:38:10 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6si6249826pfj.184.2016.04.27.15.38.10; Wed, 27 Apr 2016 15:38:10 -0700 (PDT) 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 S1754044AbcD0WiI (ORCPT + 29 others); Wed, 27 Apr 2016 18:38:08 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:63441 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752236AbcD0Wff (ORCPT ); Wed, 27 Apr 2016 18:35:35 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0M4rAD-1btwjG25vB-00yz9Z; Thu, 28 Apr 2016 00:34:51 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 08/16] char/genrtc: remove parisc support Date: Thu, 28 Apr 2016 00:34:22 +0200 Message-Id: <1461796470-1291527-9-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:hDlGA05dpdNMTEDjZR01lDPZsqpJtKQ5Fyet8yo2+a4sHfJ6dsd Cgn0o4JuI5z3elDVFaofzGczl2tOhUc5iNk61m/ah/K3utrf6kT9qrdiik5xjzDTONK8smR oG2dl6F7oeHqcNKWf2QQp/PrgYfPsX4+kuiGpOLd34zw97dPnEGZI86+I80J2HA+w5IgXmi K6mMdDLRfhids66T07Thw== X-UI-Out-Filterresults: notjunk:1; V01:K0:gDZghHuRU6A=:EiUrb1TMgWRtZdmOa5h+uD oi08FH2EvZ2qsrrsc6CZbEzHqZmP6d6Euq6hHwbKsBTmKPsXywU49B/0Wv4gwVRbS9EKJ9QuJ kQi6woqB4tukr8XPHNqGzCAAoeZ/M4eVDUKJcST4c5qEn7ePsD1jS/FSo2txE2gx9wq0nEerK jYzH/KZit8RahVIZ7mmacPTiVP3mI/E+xs9whvSjR7SzQy+9vrNT8EyRACAKhltfrQK7z98sf hWg3F/nRIt3qSfPJMMk7aR2+8S20S2BN90vZGdNKdYaGEsJN4zrc3ld0uE3OHweTQKbp1Usgl LbMTbMPM6jctXnMIxC92B954+RE6FZhEC/izWPv0YqHUUVIAaXf4XGvOrphef9qztn42E5FN0 xwP3Nd1bAFhRmnqTr0zwJgp+Iq8p3BX7qLqOA+W/lbHMnTqOH+b7oSTWqT7tJQ7r+44XbaG2t JQmkbLOAV1gsUhmDLyfDKis8P2cCyqZgW1etWXqa4C3oZlTm4Ak0E837SNLFjxg+57+ZmMU8H 8z5UcYVzGILhRC/eb+NwSmp0MqXoPuV1r8TmTuXGs36al6dOTOt6GjIEUGm3hgN3mN5dO6oxv c7CcD0zEdxh++OpjsvUQHfmNhUZxPOEJdys022j4cLf5yh+I2a5EngL6+26rZO233dHdkdpwA UAb7sXmDGNoJMsgGNSw8uL73n/I+7bg9GDkg58F6HDdYDhcB+iVsI8nwmeq7JPQC0LOk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This architecture selects RTC_CLASS unconditionally, so the GEN_RTC has not worked here for a long time. Now we can remove both the asm/rtc.h header and the Kconfig dependency for CONFIG_GEN_RTC. Signed-off-by: Arnd Bergmann --- arch/parisc/include/asm/rtc.h | 131 ------------------------------------------ drivers/char/Kconfig | 2 +- 2 files changed, 1 insertion(+), 132 deletions(-) delete mode 100644 arch/parisc/include/asm/rtc.h -- 2.7.0 diff --git a/arch/parisc/include/asm/rtc.h b/arch/parisc/include/asm/rtc.h deleted file mode 100644 index 099d641a42c2..000000000000 --- a/arch/parisc/include/asm/rtc.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * include/asm-parisc/rtc.h - * - * Copyright 2002 Randolph CHung - * - * Based on: include/asm-ppc/rtc.h and the genrtc driver in the - * 2.4 parisc linux tree - */ - -#ifndef __ASM_RTC_H__ -#define __ASM_RTC_H__ - -#ifdef __KERNEL__ - -#include - -#include - -#define SECS_PER_HOUR (60 * 60) -#define SECS_PER_DAY (SECS_PER_HOUR * 24) - - -#define RTC_PIE 0x40 /* periodic interrupt enable */ -#define RTC_AIE 0x20 /* alarm interrupt enable */ -#define RTC_UIE 0x10 /* update-finished interrupt enable */ - -#define RTC_BATT_BAD 0x100 /* battery bad */ - -/* some dummy definitions */ -#define RTC_SQWE 0x08 /* enable square-wave output */ -#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ -#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ -#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ - -# define __isleap(year) \ - ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) - -/* How many days come before each month (0-12). */ -static const unsigned short int __mon_yday[2][13] = -{ - /* Normal years. */ - { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, - /* Leap years. */ - { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } -}; - -static inline unsigned int get_rtc_time(struct rtc_time *wtime) -{ - struct pdc_tod tod_data; - long int days, rem, y; - const unsigned short int *ip; - - memset(wtime, 0, sizeof(*wtime)); - if (pdc_tod_read(&tod_data) < 0) - return RTC_24H | RTC_BATT_BAD; - - // most of the remainder of this function is: -// Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc. -// This was originally a part of the GNU C Library. -// It is distributed under the GPL, and was swiped from offtime.c - - - days = tod_data.tod_sec / SECS_PER_DAY; - rem = tod_data.tod_sec % SECS_PER_DAY; - - wtime->tm_hour = rem / SECS_PER_HOUR; - rem %= SECS_PER_HOUR; - wtime->tm_min = rem / 60; - wtime->tm_sec = rem % 60; - - y = 1970; - -#define DIV(a, b) ((a) / (b) - ((a) % (b) < 0)) -#define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400)) - - while (days < 0 || days >= (__isleap (y) ? 366 : 365)) - { - /* Guess a corrected year, assuming 365 days per year. */ - long int yg = y + days / 365 - (days % 365 < 0); - - /* Adjust DAYS and Y to match the guessed year. */ - days -= ((yg - y) * 365 - + LEAPS_THRU_END_OF (yg - 1) - - LEAPS_THRU_END_OF (y - 1)); - y = yg; - } - wtime->tm_year = y - 1900; - - ip = __mon_yday[__isleap(y)]; - for (y = 11; days < (long int) ip[y]; --y) - continue; - days -= ip[y]; - wtime->tm_mon = y; - wtime->tm_mday = days + 1; - - return RTC_24H; -} - -static int set_rtc_time(struct rtc_time *wtime) -{ - u_int32_t secs; - - secs = mktime(wtime->tm_year + 1900, wtime->tm_mon + 1, wtime->tm_mday, - wtime->tm_hour, wtime->tm_min, wtime->tm_sec); - - if(pdc_tod_set(secs, 0) < 0) - return -1; - else - return 0; - -} - -static inline unsigned int get_rtc_ss(void) -{ - struct rtc_time h; - - get_rtc_time(&h); - return h.tm_sec; -} - -static inline int get_rtc_pll(struct rtc_pll_info *pll) -{ - return -EINVAL; -} -static inline int set_rtc_pll(struct rtc_pll_info *pll) -{ - return -EINVAL; -} - -#endif /* __KERNEL__ */ -#endif /* __ASM_RTC_H__ */ diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index d17ed90ebc82..abab6e565c60 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -328,7 +328,7 @@ config JS_RTC config GEN_RTC tristate "Generic /dev/rtc emulation" depends on RTC!=y - depends on M68K || PARISC || PPC + depends on M68K || PPC ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you From patchwork Wed Apr 27 22:34:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102413 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2449936qge; Wed, 27 Apr 2016 15:52:09 -0700 (PDT) X-Received: by 10.98.86.77 with SMTP id k74mr15421730pfb.28.1461797529125; Wed, 27 Apr 2016 15:52:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si6315409pfi.178.2016.04.27.15.52.08; Wed, 27 Apr 2016 15:52:09 -0700 (PDT) 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 S1753599AbcD0Wvu (ORCPT + 29 others); Wed, 27 Apr 2016 18:51:50 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:59797 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753452AbcD0Wvr (ORCPT ); Wed, 27 Apr 2016 18:51:47 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0LsywU-1bgSL00CeA-012cRm; Thu, 28 Apr 2016 00:34:52 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 09/16] rtc: m68k: provide rtc_class_ops directly Date: Thu, 28 Apr 2016 00:34:23 +0200 Message-Id: <1461796470-1291527-10-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:gEd2LWA4cgbBbC2AaK4LnxKv5LHzeMKq6B5eAUBz2OxAYSbZNeT 5vqs631zkyGU+QhTdTk3PfxMgF9LqhXz9ynaY+NwHVF6xEqGj+G0o0FQ4FGpdFOOjFNN6bw NQK2RzmgajRQ8hZwnKJI5hnpRlfCKIMKB9l2XbToC/sonTtjTpehmgNt0WAwFBUBFWZEMAP /Nq15rf2eoMXgCDuC/s8g== X-UI-Out-Filterresults: notjunk:1; V01:K0:NRFZ4jWArYE=:5z2lcgI8LiliwEXqpNb0ym Qz8vRNah1J32hJb46JnsWIEpAO9QV0FybDI26sg7Sb/rMoMWcQlLG8EbhaP3qxNiugEOE3VC0 Y5Bpl/qNHfd23WDJYbq+Oxze8XAWYto4QUtBCq1NrZrUqeWjpxm7w5wREslbhvBV1AJZ8ReH8 eP/kvFl5cKoAH1+HSa+K2dsEP3IXUT4eOs5qFv89s6MLwOA8435cAjwjouotTQzxzwxJAf4xB JQHIeW4VZLlqtr0D+aY+CaFFgcsvhMf4KBIMoLNVfKYgb8fDK0PskBC70BTvA09b05Xs5WLUE GsT8C5c88yWba0nRlMFBDxEmY0OX6koqjQ2604yBI26xQI3OttFQb/o6JkAksXnU7uyvP2IVl xj2WEUqTtOXxDf5rzzAOKZzU8LcFyvHK8V5rnCglbseWEg+5vgehQxFcLymUC6QV7o70SPAEl 621Nk56gAjaOADz50nOcBPvXfzRcqA0DfX6uGSG7bJhOkwTKVCxjoox+UhONuBh8G5vVEepFg seXf672GxDela/+4gGE78/qCswMUcRAIAlR1tEdniH+cpi9p4xiW/p8QN086BHSEPbYG6lKF7 V7t3N3CeaHuJWPmeeaYxNkOZWyxCjRErsBOpnc1H1lJOVJD/GbF1NU9j+LkroSQ3Q5DHH0stT GvotIFD6wXyWUJBuz51dbAefsvVF+gAylC1yd0S4Tsdksp2t0MDCwppjSRw5c6taoX6w= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 24 ++++++++++++++++++++++-- drivers/rtc/rtc-generic.c | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) -- 2.7.0 diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index 3857737e3958..80e024a10115 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c @@ -86,7 +86,24 @@ void read_persistent_clock(struct timespec *ts) } } -#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET +#if defined(CONFIG_ARCH_USES_GETTIMEOFFSET) && IS_ENABLED(CONFIG_RTC_DRV_GENERIC) +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); } diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c index 92b5e02a3750..5c82bae73b9c 100644 --- a/drivers/rtc/rtc-generic.c +++ b/drivers/rtc/rtc-generic.c @@ -9,7 +9,7 @@ #include #include -#if defined(CONFIG_M68K) || defined(CONFIG_PPC) +#if defined(CONFIG_PPC) #include static int generic_get_time(struct device *dev, struct rtc_time *tm) From patchwork Wed Apr 27 22:34:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102425 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2444574qge; Wed, 27 Apr 2016 15:36:05 -0700 (PDT) X-Received: by 10.98.28.84 with SMTP id c81mr15643717pfc.131.1461796565558; Wed, 27 Apr 2016 15:36:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si7549059paw.142.2016.04.27.15.36.05; Wed, 27 Apr 2016 15:36:05 -0700 (PDT) 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 S1754116AbcD0Wfu (ORCPT + 29 others); Wed, 27 Apr 2016 18:35:50 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:56918 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754057AbcD0Wfq (ORCPT ); Wed, 27 Apr 2016 18:35:46 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MRlnN-1b6Idh2Zez-00T0Rl; Thu, 28 Apr 2016 00:34:52 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 10/16] rtc: m68k: provide ioctl for q40 Date: Thu, 28 Apr 2016 00:34:24 +0200 Message-Id: <1461796470-1291527-11-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:RktldUwS981WlONpG3MYrdX4r9/s9FgSDFmAYbARkPS9smtyIce tj/NDTJgmp2mwyZiYaNDsNltY0ZXwIQ6ucGTOhDBzyVn/boVshUzsBHRb6/YX/N3uLQZ5Fs R1fWYkmqNtA7xQ+ygp1V4OjqphfRlDUCxecGFE+GQuDPPt/yvJqjNd4MfyE/vCvLwBZN5ep /JTCFqb5HZELk4U3YnYbA== X-UI-Out-Filterresults: notjunk:1; V01:K0:fKb2ZsotwuI=:8vNhchmTrtfiAVvpOuxvik dpxccZGVODooPBmpxeQjeyf3VLL1P+5WnY0k00O2lEDUFI9PIYbqnaE7YRAdwX0cspafuXCNi GjIX32qvEFyPMMgWhDxALOWFwTK25gCrq0cRvySBSGo9UVhdQWmayLy+A76/7jTy8zTseZ5v/ C76dA3U9BzxEHkMIroWDgz6UDi7VOguWC4+uAfJTzHmlAxZLTRszZOv5jTBNO6VyNVctGnQVm 7jZ3418VMciK3jxOYzroGavflwd77nvta+RH1s8tqNZY11ga6LDPm8C9m47QtYg3VoWEHrvh/ RCevsfYRSJvqIZ9tyPeNRct/xnxDZq196yfiNnAarufNqLexEVnH2YMW4RAs/kmAbN4pNe03L srBkipsTpYwp11oxT1xVHEiatizM0HCu+RAIFydt1fdxiLinpU/HbZZoWlTtyk0Xqsozw6Ivz hJmueEY+BSmwaEeRjicoVCZr5z3fFbOEeA9z+7voV9Lhu7NGeJLmA7VjHWFfP3jCEOiBLmHtX bbQlMYR+/Q1HouPVpcpro5l7sbQ9eOWklwLozYMNTuE7kSDgqDr7MFyWsmVlMEmS9Yun7g3C0 IqSrpuwspAGoFjKnNc5gadIgjeev+pv9EwQSdslnLgFz2sB8Qetyo6+jsd4rYfFeYuBfozJLt yoZbqgVYH6R3R161w4ub6oJn4SlNj5kE3jCAiAeFo5l7wbxHGtAoPdDDoMGAhoXyDrG4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The q40 platform is the only machine in the kernel that provides RTC_PLL_GET/RTC_PLL_SET ioctl commands in its rtc through the mach_get_rtc_pll/mach_set_rtc_pll callbacks. However, this currenctly works only in the old-style genrtc driver, not the (somewhat) modern rtc-generic driver replacing it. This adds an ioctl implementation to the m68k generic_rtc_ops in order to let both drivers provide the same API. After this, we should be able to remove support for genrtc from the m68k architecture. Signed-off-by: Arnd Bergmann --- arch/m68k/kernel/time.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.7.0 diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index 80e024a10115..465423c07a92 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c @@ -100,7 +100,32 @@ static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm) return 0; } +static int rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) +{ + struct rtc_pll_info pll; + struct rtc_pll_info __user *argp = (void __user *)arg; + + switch (cmd) { + case RTC_PLL_GET: + if (!mach_get_rtc_pll || mach_get_rtc_pll(&pll)) + return -EINVAL; + return copy_to_user(argp, &pll, sizeof pll) ? -EFAULT : 0; + + case RTC_PLL_SET: + if (!mach_set_rtc_pll) + return -EINVAL; + if (!capable(CAP_SYS_TIME)) + return -EACCES; + if (copy_from_user(&pll, argp, sizeof(pll))) + return -EFAULT; + return mach_set_rtc_pll(&pll); + } + + return -ENOIOCTLCMD; +} + static const struct rtc_class_ops generic_rtc_ops = { + .ioctl = rtc_ioctl, .read_time = rtc_generic_get_time, .set_time = rtc_generic_set_time, }; From patchwork Wed Apr 27 22:34:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102427 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2444461qge; Wed, 27 Apr 2016 15:35:48 -0700 (PDT) X-Received: by 10.98.104.6 with SMTP id d6mr15367290pfc.77.1461796547903; Wed, 27 Apr 2016 15:35:47 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wl8si11934965pab.33.2016.04.27.15.35.47; Wed, 27 Apr 2016 15:35:47 -0700 (PDT) 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 S1754101AbcD0Wfo (ORCPT + 29 others); Wed, 27 Apr 2016 18:35:44 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:63797 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754067AbcD0Wfj (ORCPT ); Wed, 27 Apr 2016 18:35:39 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MA6Q5-1aodEK0eIj-00BL2P; Thu, 28 Apr 2016 00:34:53 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 11/16] char/genrtc: remove m68k support Date: Thu, 28 Apr 2016 00:34:25 +0200 Message-Id: <1461796470-1291527-12-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:/b8Ei1tV1SoAUnNvSud5u4Fh+gqlcAb1zuKGYJPQN/vFBXHyKIV NYPDwMk56T/UyF+8ieZY4XXaLgrokYhX+J6N1srezzjM3txwW4pyk+a6wWMqK7nvdK4ddZi z2aboL/6sTgTmB72UUT3cMgivxkatn+8jwW4VL3/geapBKqsh1FGFTm9YniBOxM2X3GXUWt M8F1ULW5k8IbmHYhWVKHw== X-UI-Out-Filterresults: notjunk:1; V01:K0:13+sH3fNplc=:oU7P6KL2JeBvCkIjUHuXeb cpDohn8bLWqX4tjCvYNciirDcz3Jypm+1izULUGZaE1f5k3llXHsw+mJ+YPLT1K/xcXlThh9d Wa/8uzzXYJ7npBJ0+T6ywHhvZKdnpo4W9Mb2NueoYT6J35+L8C/Hg53dmHIiSRVidfeIuLpok cKFAh3YwPK4vxISGVdVbPOqEzsOQpCS2n/4mB9Q7frPADlSCAHUwTVy5mHHTZ0JbEzD+T4Hyy MydCPma6Dk7uAcGocKX4LsojqGNkSt9o35goc6imk6Cz2fxdJ2MybfGZ1Reap5SVDHOuHG7Yl I0/DD39idx8J6KoVCb2VyqxWFQN7Q3DncNYwNaazLhAQdHWxP6PvV/I/E9L+dlQlR2bQhxNL0 7yxIDkOax4FTDaW6uJLLekjOwwH4RtGpSg8VzGISaho0JSkbLFv4gaojH2WexJm5iU2kmigFi jKLomA9O2ue302h2keGBECq5sBeP1qPDYKY34LzaVw3ioweIm4tViSpWZyy+73HmL0kW50bi0 etvKz9qmeQaAQ8+1xmV9T3cTnRbyA1NoMaGJa0pZgYb0W8e9TS2sbWwVeshaRWCFlTgFvDOyS 40hwTk9Kbn+BwUZX24eaM3EjLt22oHPpkI5Uj6MomCMnzX5ZV6Qg+TbbMDJtXVFWvxdpigRt9 7pjAEHsZeqgAkTHSw0aX4TFIKulXAidhOFt5s+JQyhjQ7TPdr2sogXWXUNyHaqXu41+0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The asm/rtc.h header is only used for the old gen_rtc driver that has been replaced by rtc-generic. According to Geert Uytterhoeven, nobody has used the old driver on m68k for a long time, so we can now just remove the header file and disallow the driver in Kconfig. All files that used to include asm/rtc.h are now changed so they include the headers that were used implicitly through asm/rtc.h. Signed-off-by: Arnd Bergmann --- arch/m68k/amiga/config.c | 1 - arch/m68k/apollo/config.c | 1 - arch/m68k/bvme6000/config.c | 1 - arch/m68k/hp300/config.c | 2 +- arch/m68k/include/asm/rtc.h | 79 --------------------------------------------- arch/m68k/mac/config.c | 3 +- arch/m68k/mac/misc.c | 1 - arch/m68k/mvme147/config.c | 1 - arch/m68k/mvme16x/config.c | 1 - arch/m68k/q40/config.c | 2 +- arch/m68k/sun3/config.c | 1 - arch/m68k/sun3/intersil.c | 2 +- arch/m68k/sun3x/time.c | 2 +- drivers/char/Kconfig | 2 +- 14 files changed, 7 insertions(+), 92 deletions(-) delete mode 100644 arch/m68k/include/asm/rtc.h -- 2.7.0 diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c index 01693df7f2f6..ec9cc1fdd237 100644 --- a/arch/m68k/amiga/config.c +++ b/arch/m68k/amiga/config.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c index 6e62d66c396e..432bc8bacfc2 100644 --- a/arch/m68k/apollo/config.c +++ b/arch/m68k/apollo/config.c @@ -15,7 +15,6 @@ #include #include #include -#include #include u_long sio01_physaddr; diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c index 478623dbb209..611d4d9ea2bd 100644 --- a/arch/m68k/bvme6000/config.c +++ b/arch/m68k/bvme6000/config.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c index a9befe65adc4..7cfab158fb61 100644 --- a/arch/m68k/hp300/config.c +++ b/arch/m68k/hp300/config.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -20,7 +21,6 @@ #include #include /* readb() and writeb() */ #include -#include #include "time.h" diff --git a/arch/m68k/include/asm/rtc.h b/arch/m68k/include/asm/rtc.h deleted file mode 100644 index a4d08ea122ee..000000000000 --- a/arch/m68k/include/asm/rtc.h +++ /dev/null @@ -1,79 +0,0 @@ -/* include/asm-m68k/rtc.h - * - * Copyright Richard Zidlicky - * implementation details for genrtc/q40rtc driver - */ -/* permission is hereby granted to copy, modify and redistribute this code - * in terms of the GNU Library General Public License, Version 2 or later, - * at your option. - */ - -#ifndef _ASM_RTC_H -#define _ASM_RTC_H - -#ifdef __KERNEL__ - -#include -#include -#include - -#define RTC_PIE 0x40 /* periodic interrupt enable */ -#define RTC_AIE 0x20 /* alarm interrupt enable */ -#define RTC_UIE 0x10 /* update-finished interrupt enable */ - -/* some dummy definitions */ -#define RTC_BATT_BAD 0x100 /* battery bad */ -#define RTC_SQWE 0x08 /* enable square-wave output */ -#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ -#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ -#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ - -static inline unsigned int get_rtc_time(struct rtc_time *time) -{ - /* - * Only the values that we read from the RTC are set. We leave - * tm_wday, tm_yday and tm_isdst untouched. Even though the - * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated - * by the RTC when initially set to a non-zero value. - */ - if (mach_hwclk) - mach_hwclk(0, time); - return RTC_24H; -} - -static inline int set_rtc_time(struct rtc_time *time) -{ - if (mach_hwclk) - return mach_hwclk(1, time); - return -EINVAL; -} - -static inline unsigned int get_rtc_ss(void) -{ - if (mach_get_ss) - return mach_get_ss(); - else{ - struct rtc_time h; - - get_rtc_time(&h); - return h.tm_sec; - } -} - -static inline int get_rtc_pll(struct rtc_pll_info *pll) -{ - if (mach_get_rtc_pll) - return mach_get_rtc_pll(pll); - else - return -EINVAL; -} -static inline int set_rtc_pll(struct rtc_pll_info *pll) -{ - if (mach_set_rtc_pll) - return mach_set_rtc_pll(pll); - else - return -EINVAL; -} -#endif /* __KERNEL__ */ - -#endif /* _ASM__RTC_H */ diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 689b47d292ac..2f33a33001e5 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -10,6 +10,7 @@ * Miscellaneous linux stuff */ +#include #include #include #include @@ -25,6 +26,7 @@ #include #include #include +#include #include #include @@ -34,7 +36,6 @@ #include #include #include -#include #include #include diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index 707b61aea203..0fb54a90eac2 100644 --- a/arch/m68k/mac/misc.c +++ b/arch/m68k/mac/misc.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c index e6a3b56c6481..c11d38dfad08 100644 --- a/arch/m68k/mvme147/config.c +++ b/arch/m68k/mvme147/config.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c index a53803cc66cd..58e240939d26 100644 --- a/arch/m68k/mvme16x/config.c +++ b/arch/m68k/mvme16x/config.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c index e90fe903613e..fcb7f05b60b6 100644 --- a/arch/m68k/q40/config.c +++ b/arch/m68k/q40/config.c @@ -12,6 +12,7 @@ * for more details. */ +#include #include #include #include @@ -27,7 +28,6 @@ #include #include -#include #include #include #include diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c index 71884bf01d72..3af34fa3a344 100644 --- a/arch/m68k/sun3/config.c +++ b/arch/m68k/sun3/config.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/m68k/sun3/intersil.c b/arch/m68k/sun3/intersil.c index 889829e11f1d..2cd0bcbe6f30 100644 --- a/arch/m68k/sun3/intersil.c +++ b/arch/m68k/sun3/intersil.c @@ -14,8 +14,8 @@ #include #include -#include #include +#include /* bits to set for start/run of the intersil */ diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c index c8eb08add6b0..431d3c4306dd 100644 --- a/arch/m68k/sun3x/time.c +++ b/arch/m68k/sun3x/time.c @@ -15,10 +15,10 @@ #include #include +#include #include #include #include -#include #include "time.h" diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index abab6e565c60..26089feae9b0 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -328,7 +328,7 @@ config JS_RTC config GEN_RTC tristate "Generic /dev/rtc emulation" depends on RTC!=y - depends on M68K || PPC + depends on PPC ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you From patchwork Wed Apr 27 22:34:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102422 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2444958qge; Wed, 27 Apr 2016 15:37:07 -0700 (PDT) X-Received: by 10.98.42.211 with SMTP id q202mr15484491pfq.13.1461796627499; Wed, 27 Apr 2016 15:37:07 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yp3si396358pac.120.2016.04.27.15.37.07; Wed, 27 Apr 2016 15:37:07 -0700 (PDT) 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 S1753995AbcD0WhD (ORCPT + 29 others); Wed, 27 Apr 2016 18:37:03 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:58054 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753921AbcD0Wfn (ORCPT ); Wed, 27 Apr 2016 18:35:43 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MQODc-1b7fY92xAa-00TpOW; Thu, 28 Apr 2016 00:34:54 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 12/16] rtc: powerpc: provide rtc_class_ops directly Date: Thu, 28 Apr 2016 00:34:26 +0200 Message-Id: <1461796470-1291527-13-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:XBfNkGloWa/uzCFVyajs01ycJTURmGNk/2IFtq3jqhUx0ork69R lWXnlAbm4KNxleypu0vR5aDWS/KhJxPij+gW+3JMTE27g5oVwgz1ZqBBm4ZrCfi9yiKEmzf 6318Fa7mpBy/L8AUxuQpBBglVd1s9zvIL3Be/yon7tbXyw4HnbWenWpYS+cTvqkcxEmMiup PBE2uDRVP/DTdgf6+43hQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:fB7BUG1OKHU=:XHi5ZzU57Q46wdA1Ni6b72 nQ7xcnhjQjwZ08WT/ztVN8Hd6FYaJatg862N/nMWera2Vwe1woOk48fpgvwGZ2dgg6mnQfb1g STIzzovG+DUP7A4+aEIrRbQ6ubg7vCo7leiwlei56b5N5DJfV/9ZDmDabT88Cpx/t1XjIPpr+ JzzoQ00xIexsgNpSnDWgoamHv8IY47cRFTQ+mdH6RF4YaT1yqAcTVhGDnu/uKJDlua7+Qua7X 617IjdtQQWlqM9BfPcOgVcAJI7IolScyGNEznLBfWfCUCHMgXrVrU2jVr4YISBVX+uKn0mCLs pYl33X2xmjHtT90szxKaCFYqz0MzTUIJF74pjeJx905dsza5sFzH70AOfbc8r0SdjT6RW97sx 8ryneJShhrKaB39Pyj/N76boVr62TUj4KSLUoODHpDkWIlmebU4D/8qMT5BBSgQpKXmAE5T0x /EIZvL32S7ZhDHeZEeMAwXc8nD5Ao3AYrOsZiwkuADdWUaDJJSJM9mxLXIw4+Ej3n4nwoX9HG VSdlHXlM2oC0CO67DNakQkkhfEeGJ3whpk71v+Z/XSnlMBgJ6P4dk4aZZk/OHVaV3OMHCQekW CDFVObzReYRNpHpgmm5pvAfZ8QHc7B54YlHe52JMDKHZsa2VaHhfLtXxY6AmdlJlT7lN/UAJk mgpQIYizswM6YlcYhaSF5+6r9mO3QtloejwcohVxiPpYR74xvDsVhdXhPbbBQ3Go0MV0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 29 ++++++++++++++++++++++++++++- drivers/rtc/rtc-generic.c | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) -- 2.7.0 diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 3ed9a5a21d77..7a482a7f4d8d 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -1081,6 +1082,29 @@ void calibrate_delay(void) loops_per_jiffy = tb_ticks_per_jiffy; } +#if IS_ENABLED(CONFIG_RTC_DRV_GENERIC) +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; @@ -1088,9 +1112,12 @@ 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); } device_initcall(rtc_init); +#endif diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c index 5c82bae73b9c..efcb9833cac8 100644 --- a/drivers/rtc/rtc-generic.c +++ b/drivers/rtc/rtc-generic.c @@ -9,7 +9,7 @@ #include #include -#if defined(CONFIG_PPC) +#if 0 #include static int generic_get_time(struct device *dev, struct rtc_time *tm) From patchwork Wed Apr 27 22:34:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102416 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2446420qge; Wed, 27 Apr 2016 15:41:13 -0700 (PDT) X-Received: by 10.98.86.24 with SMTP id k24mr15627594pfb.87.1461796873048; Wed, 27 Apr 2016 15:41:13 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 10si7578507paw.114.2016.04.27.15.41.12; Wed, 27 Apr 2016 15:41:13 -0700 (PDT) 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 S1754039AbcD0Wk5 (ORCPT + 29 others); Wed, 27 Apr 2016 18:40:57 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:56811 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753788AbcD0Wkr (ORCPT ); Wed, 27 Apr 2016 18:40:47 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0M1GfI-1bok3q13eK-00tEWm; Thu, 28 Apr 2016 00:34:54 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 13/16] char/genrtc: remove powerpc support Date: Thu, 28 Apr 2016 00:34:27 +0200 Message-Id: <1461796470-1291527-14-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:YQ3v41WlZtCeAq48sh2EFTEdNw1MGsniNLoGu5hW5enKqULxD8P iDlYBvhJDuO6rGbWV62plNhxH8pvU5kLGDtE4ZZxXgLnD7+sv9O4B0DW8ZLD4rAXFzGet8P wOk1MIhHeiSeuhkcw6JcUMdls5piF50R2hO7mO0+xvN8Tmr8NYM7uSZrGYsu8t9sz21cRrG uYFWTBMG3D7e5uXCFcgcA== X-UI-Out-Filterresults: notjunk:1; V01:K0:LwmzO8iYIGE=:gwsQE21N5pENYjwOFh8Mzv Lzh/cFCHVkuC0k4Dasj31ZLxzZ+Pyl3sckxOWDItj4VSVMUirV1Wj+RLcT2SQCxTx3jHuK06T 6BXplcqy86r2TeV+BaDtVYxBvRDBrjc2w1jAbURoOOeM2XFHuEHXalPxszZtBDCBjg7wahjSr NExB7ZW+UTasBGNWPiC/fvYEV3VVlGJFgavWUh8bTCjwIpwVqRikxGFcmGHtX4zgiRsarpOE4 93mwydei1VyxA8bJOwjNagt7gGFjiWOgSIYNQgAPDUOJ6m+QiRraZMkG0vqUhTJceqNX43wz0 ooh+hezyIGsVoo0dF56oymO4KWKsK5U1CFHftjGSksNlcEashvSJEn8aoqROPl0jJnGem31jz sONCh3Esw+6cIa/LpVOn24Lg1V8TAKi1PnzIRBhRHwKtOACtjKn9C5B5XTdNG3EG/civMWkPA bWpG8rUWJ2ESo+X2Nz/7l2soRGEf59Y0geBmCxJ/DvH3zEbNJW2KVIwebfY2/hdL5/CTEtacz Axa/piYGpENCLoq0c5ujiLm84QGQ9sHzkcMtLkw6s/KIzCRqSW69wzBqe7yOnUDVRVZBGWMoE bppVn+mYe/8yaCvkDuR07gp+k0LA4BfmOrMSL7MCJFBUH1uJIYqtLK+M//a71ZJhC/5pko4/6 ESKMadhI7UVJ1dn8TQu41aYorxVpM8v5FjRwev1v8GaC2xROshraaY1mgn+31vEUxYSc= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PowerPC is the last architecture using the GEN_RTC driver on some machines, but we can migrate them all to using the RTC_DRV_GENERIC driver instead now. This moves over the CONFIG_GEN_RTC option from drivers/char into arch/powerpc/platforms/Kconfig and makes it just select the replacement driver instead, for the only reason of not breaking existing defconfig and .config files that users may have. Signed-off-by: Arnd Bergmann --- arch/powerpc/include/asm/rtc.h | 78 --------------------------------------- arch/powerpc/platforms/Kconfig | 11 ++++++ arch/powerpc/platforms/ps3/time.c | 2 +- drivers/char/Kconfig | 4 +- drivers/char/Makefile | 2 +- 5 files changed, 15 insertions(+), 82 deletions(-) delete mode 100644 arch/powerpc/include/asm/rtc.h -- 2.7.0 diff --git a/arch/powerpc/include/asm/rtc.h b/arch/powerpc/include/asm/rtc.h deleted file mode 100644 index f5802926b6c0..000000000000 --- a/arch/powerpc/include/asm/rtc.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Real-time clock definitions and interfaces - * - * Author: Tom Rini - * - * 2002 (c) MontaVista, Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - * - * Based on: - * include/asm-m68k/rtc.h - * - * Copyright Richard Zidlicky - * implementation details for genrtc/q40rtc driver - * - * And the old drivers/macintosh/rtc.c which was heavily based on: - * Linux/SPARC Real Time Clock Driver - * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) - * - * With additional work by Paul Mackerras and Franz Sirl. - */ - -#ifndef __ASM_POWERPC_RTC_H__ -#define __ASM_POWERPC_RTC_H__ - -#ifdef __KERNEL__ - -#include - -#include -#include - -#define RTC_PIE 0x40 /* periodic interrupt enable */ -#define RTC_AIE 0x20 /* alarm interrupt enable */ -#define RTC_UIE 0x10 /* update-finished interrupt enable */ - -/* some dummy definitions */ -#define RTC_BATT_BAD 0x100 /* battery bad */ -#define RTC_SQWE 0x08 /* enable square-wave output */ -#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ -#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ -#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ - -static inline unsigned int get_rtc_time(struct rtc_time *time) -{ - if (ppc_md.get_rtc_time) - ppc_md.get_rtc_time(time); - return RTC_24H; -} - -/* Set the current date and time in the real time clock. */ -static inline int set_rtc_time(struct rtc_time *time) -{ - if (ppc_md.set_rtc_time) - return ppc_md.set_rtc_time(time); - return -EINVAL; -} - -static inline unsigned int get_rtc_ss(void) -{ - struct rtc_time h; - - get_rtc_time(&h); - return h.tm_sec; -} - -static inline int get_rtc_pll(struct rtc_pll_info *pll) -{ - return -EINVAL; -} -static inline int set_rtc_pll(struct rtc_pll_info *pll) -{ - return -EINVAL; -} - -#endif /* __KERNEL__ */ -#endif /* __ASM_POWERPC_RTC_H__ */ diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index 46a3533d3acb..657243ffb525 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig @@ -321,6 +321,17 @@ config OF_RTC Uses information from the OF or flattened device tree to instantiate platform devices for direct mapped RTC chips like the DS1742 or DS1743. +config GEN_RTC + bool "Use the platform RTC operations from user space" + select RTC_CLASS + select RTC_DRV_GENERIC + help + This option provides backwards compatibility with the old gen_rtc.ko + module that was traditionally used for old PowerPC machines. + Platforms should migrate to enabling the RTC_DRV_GENERIC by hand + replacing changing their get_rtc_time/set_rtc_time callbacks with + a proper RTC device driver. + config SIMPLE_GPIO bool "Support for simple, memory-mapped GPIO controllers" depends on PPC diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c index 791c6142c4a7..11b45b58c81b 100644 --- a/arch/powerpc/platforms/ps3/time.c +++ b/arch/powerpc/platforms/ps3/time.c @@ -20,9 +20,9 @@ #include #include +#include #include -#include #include #include diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 26089feae9b0..a81f0eb9f71e 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -325,10 +325,10 @@ config JS_RTC To compile this driver as a module, choose M here: the module will be called js-rtc. -config GEN_RTC +config OLD_GEN_RTC tristate "Generic /dev/rtc emulation" depends on RTC!=y - depends on PPC + depends on BROKEN ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you diff --git a/drivers/char/Makefile b/drivers/char/Makefile index d8a7579300d2..fc0905aa7373 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -25,7 +25,7 @@ obj-$(CONFIG_APPLICOM) += applicom.o obj-$(CONFIG_SONYPI) += sonypi.o obj-$(CONFIG_RTC) += rtc.o obj-$(CONFIG_HPET) += hpet.o -obj-$(CONFIG_GEN_RTC) += genrtc.o +obj-$(CONFIG_OLD_GEN_RTC) += genrtc.o obj-$(CONFIG_EFI_RTC) += efirtc.o obj-$(CONFIG_DS1302) += ds1302.o obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ From patchwork Wed Apr 27 22:34:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102418 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2446282qge; Wed, 27 Apr 2016 15:40:44 -0700 (PDT) X-Received: by 10.66.218.161 with SMTP id ph1mr15387015pac.83.1461796844422; Wed, 27 Apr 2016 15:40:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xz4si7566945pab.139.2016.04.27.15.40.44; Wed, 27 Apr 2016 15:40:44 -0700 (PDT) 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 S1753759AbcD0Wkl (ORCPT + 29 others); Wed, 27 Apr 2016 18:40:41 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:50122 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbcD0Wki (ORCPT ); Wed, 27 Apr 2016 18:40:38 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0LalbM-1bOExq3P5c-00kOo4; Thu, 28 Apr 2016 00:34:55 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 14/16] rtc: generic: remove get_rtc_time/set_rtc_time wrappers Date: Thu, 28 Apr 2016 00:34:28 +0200 Message-Id: <1461796470-1291527-15-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:mL1n6P1rOtKtUfy0ODQ8J+s1s2yeLsptxhD9i4ilbE9iKNce4b4 9TVJ6iK/PU54MLXFnTjf57cSMxPde/rvm+Y6U1DTDj92OmYRyHORfa5vgDoLZES11ot/NHd 5KKn9we3gq1sgzeHivOsydktD8OiaD+weO+9VZW4KINzpfb/i7k4zxJ/cJSyu2toYOf4kj0 JQFu5S5tZMhEhvASC923A== X-UI-Out-Filterresults: notjunk:1; V01:K0:r5IBcqExddI=:GwoDvIMjp4UOV7hTO3Pre0 /ulQhDkylqHhBrxGIbLwex7HGUpOOSkVwMYq1RGWysok60MD4NhAW0NyVs3PgDBH0zDSW+vVH JQUFOMl2WAbtofNoZBBvn9l6oJmKBXK6iKUVWydt0aBzmHNOOUGJSPaup6szAgNCpW2Td3t+7 wUWiSNvhzZxDdt7kMx5J7UxxejDU0T692F6gkf7eAju2G62yznwvC/vxD+SrnqCAgnG9pRg53 br/mIvLazQi0BojMw6fnaD59pMYkb5CX8L44dYH+gHJndQU1gJ15p7QhgPEta/e1Qa5E853Ba uRO+lG70DyZeByOHNPLF0KmHJ7fhXp8BfwT7RTYYbQGKsFVswGarAnIv7fffj2XO1lLNdjCIM WNpxrOpcfl1tkSH/FO+PUJpdshjrLoN9In+kue9CqahGak6vsqExdZSBE0wcKBb1OF3G1aALT y7RRMLtkAKn6jAPySjjfDONyI9vjSHI2QP5zFpfd+zNelq7zk8aM28rZV1Nn5zOG8UDHheVcL xhGkFjRGQ0SaUtFs69BFHuaewkh+2C0mceaxoCuS0mAPSaH5CJ8RtjD2sWn3afICXHfSFSOMA 9CGaVaTL4C0sbdDSBZnh4QGCXM75mnd24v7olxuBsVh9wodE3BZj2F9H0M/N+oj8D1+304Cd0 v4QdUbT3yRwh5BRj66jof+anv2RyxMoiH5No7pOV/EaR0FVifTurZCUeu5OfHA++LKeQ= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All architectures using this driver are now converted to provide their own operations, so this one can be turned into a trivial stub driver relying on its platform data. Signed-off-by: Arnd Bergmann --- drivers/rtc/rtc-generic.c | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) -- 2.7.0 diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c index efcb9833cac8..1bf5d2347928 100644 --- a/drivers/rtc/rtc-generic.c +++ b/drivers/rtc/rtc-generic.c @@ -9,43 +9,10 @@ #include #include -#if 0 -#include - -static int generic_get_time(struct device *dev, struct rtc_time *tm) -{ - unsigned int ret = get_rtc_time(tm); - - if (ret & RTC_BATT_BAD) - return -EOPNOTSUPP; - - return rtc_valid_tm(tm); -} - -static int generic_set_time(struct device *dev, struct rtc_time *tm) -{ - if (set_rtc_time(tm) < 0) - return -EOPNOTSUPP; - - return 0; -} - -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; + const struct rtc_class_ops *ops = dev_get_platdata(&dev->dev); rtc = devm_rtc_device_register(&dev->dev, "rtc-generic", ops, THIS_MODULE); From patchwork Wed Apr 27 22:34:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102423 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2444819qge; Wed, 27 Apr 2016 15:36:43 -0700 (PDT) X-Received: by 10.66.55.101 with SMTP id r5mr15636354pap.146.1461796603426; Wed, 27 Apr 2016 15:36:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si7570947pan.105.2016.04.27.15.36.43; Wed, 27 Apr 2016 15:36:43 -0700 (PDT) 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 S1753986AbcD0Wgl (ORCPT + 29 others); Wed, 27 Apr 2016 18:36:41 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:50508 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753869AbcD0Wf5 (ORCPT ); Wed, 27 Apr 2016 18:35:57 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0LalbM-1bOExr1l3w-00kOo4; Thu, 28 Apr 2016 00:34:55 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 15/16] char/genrtc: remove asm-generic/rtc.h from mips Date: Thu, 28 Apr 2016 00:34:29 +0200 Message-Id: <1461796470-1291527-16-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:zDwCZH/Jldz4mbS1VtQu4VeIy0uN0ICQSu66caamLNdeEVJDJnX 1GsRY8UBwSGsgSRYoTgIF1P7unfvwbZhfhncUPn/bdmczUSHZwZ4n9tVbT3AqmPb3OAtU7A 1RX++NfylTddzesxNcRUMPRUOQkic5kdRUKYGkf9UwAYo99/TRvJbFQ0XaJarwuRpjUU+AE UmQh8mlR7WB/Z6f8uy24Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:ue0XjzFFvX8=:j/F0DRPAZBC/2DtiKeW0SY RzBVGuPBWUeQ3VUfzdYkUOhDV64gCu9+g97cVlN+8Iz1RseScm5FRQzhNzoUg9ri6SU0Wr0dS Pfr2w4FFyeJX5h7Ti82ILmqSGkKIGJtSQIW202NgzuC/NC9UvTDFfk0wlXEkA37gfGWOYntZk HIjeY/eOkVLtUPODAy7aSDhqLVwayAlRJXMKPk10VlK3hQ6kaH+x5tgP5zdMgGWSYfOM5IHzP URzOvj1fTjpY5qunPtMCOpnIaRPCyXrX5QE2NgAtB3R0GuJ+ADEdrW0OVGpkwrgyNV3CntLkD aW5g9aHN5KANcBv4SgcRqCqjZcTKx89CDQmcq0xdQRnSWq9tXGLI5M3jqOI4D4T8TMY1EXyFV rrfdhudyRk41Jp5MkorkZ2P+RSrO0lE8JJ6OMUIKkEvHUGB22iN9UOcFhDHR6FPjqlW+i3eTH TkJw9dxzAUyxWeu+7Lj3+6INbuWI73N7uzC8L7thGBILbZSDr/lDuKVkCZmBXVQq4qlXAI3gO OMDhYzUomjByoSr/kW0lXszHSsJRyNRGZftJ14myY9IpG3YCaI/mNTuK1wRJNgQ/hdNCVAUTT F4GsNKXaX7z7HrKgT45CIbC+oNoxDv98duCvsOX4yJ3acVsbagEY4cwajxUhZbFjpUrCumo9x 2Nm/l7eNcxA1X+oPoH+3+ukGQrzTEwymLY9Q/oPoDnbVIo+7sHVmiPn5mhhyONOoO7GI= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arch/mips/sni/time.c includes asm-generic/rtc.h for no apparent reason, and it works fine without that header, so lets remove the inclusion in preparation of deleting the file. Signed-off-by: Arnd Bergmann --- arch/mips/sni/time.c | 1 - 1 file changed, 1 deletion(-) -- 2.7.0 diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c index fb4b3520cdc6..7ee14f41fc25 100644 --- a/arch/mips/sni/time.c +++ b/arch/mips/sni/time.c @@ -8,7 +8,6 @@ #include #include -#include #define SNI_CLOCK_TICK_RATE 3686400 #define SNI_COUNTER2_DIV 64 From patchwork Wed Apr 27 22:34:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102419 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2445476qge; Wed, 27 Apr 2016 15:38:31 -0700 (PDT) X-Received: by 10.98.64.132 with SMTP id f4mr15893051pfd.146.1461796711041; Wed, 27 Apr 2016 15:38:31 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x190si6239092pfx.222.2016.04.27.15.38.30; Wed, 27 Apr 2016 15:38:31 -0700 (PDT) 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 S1754055AbcD0WiG (ORCPT + 29 others); Wed, 27 Apr 2016 18:38:06 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:58913 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752882AbcD0Wff (ORCPT ); Wed, 27 Apr 2016 18:35:35 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0LwZRP-1blf0J0OZb-018N4Z; Thu, 28 Apr 2016 00:34:56 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, deller@gmx.de, benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org, dhowells@redhat.com, linux-alpha@vger.kernel.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org, rtc-linux@googlegroups.com, linux-arch@vger.kernel.org Subject: [PATCH v3 16/16] char/genrtc: remove the rest of the driver Date: Thu, 28 Apr 2016 00:34:30 +0200 Message-Id: <1461796470-1291527-17-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461796470-1291527-1-git-send-email-arnd@arndb.de> References: <1461796470-1291527-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:dHP9x4uoBYLa53+4N2Azk+4jr2PNqXLr+fce/H1pglpsG1yWl+D q7boPy4yVzs44EVsP7em2FCKyuKoFnUyYE0B/+5bZT1X1Ig4YQqcVwqDtdoTtMVvpNPLC5W mOkfeK1g+O6Us1tJapZMRpIRGB/hHe+IWguoHRTM6lNya+mX3FLZ0ux4QTmW1YUCDZwbvqv IL7mGX1AaNLY1dc32nT1g== X-UI-Out-Filterresults: notjunk:1; V01:K0:066eKUiu8Ks=:N20LEC9PwH2IwPDc//9e8E GCAgmJ9+mm5Bcg9Ho819zIlQ1Mt2lOeDoRDO4uSJWQ3v3KMptJ6/6HvNHAWHee4zkDon+GrpZ BLtTdCp7L9f3a411osRu16q0D7llzkeyhMfzM73dLruUHxBf5AQ4VyoF4AX2LfIUgxS85/nRF HqSjVtK3fvkINqHOX/QejvfYo8e+/RCoNEZVJHAvxX8bPMFu4Wa8GeQ2ST0HCn/9qWS56GjgP g1FDQy0RNHUzppjH/rwnAP67vdHiQqziJKHfPIZFCb1d5b1qbvbyPq00RbB9Zw7ll5KRt8BIw BPARHiqNZUwBtCBszV4BpNlPsBNvDERPnJrtvVgaZCpF3UqtBP9SsmAQB4fUAYB3DY4IZnKr8 l9MaZOkOTB0e8H/gd0LDamwyXHMOjjtvVaXWfnR3JvboR/F7FgxlbkO7lbkaDSIhgPezUhrYe NZq0l+M5LXRAfbqVwUqkWtOWjTLFcNdMD6jCsxpAycXjy1zlMvGdLv6aKJ+x+q0tGInVO5mOy W3QTG5f7+6lsGKjCBmjsJ85lxHCIs5boP2as8ot0r73DIaB3hdozgiwmVnC5f+4aQzlKqPFr/ MiHzL0t903cF6SDihMAVvJM20WxqqWsutZHi8Kv9/UttRHegDX4p/U8AlSMRF87ZEjzQ8SIw+ jg8vYbZHiqzDZSOtR0Jt7KCpMQkFfms55rZdQH7AeNtpxXM9dLOWhJ+LVvt1AwedEWdE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No architecture uses the genrtc driver any more, so let's kill it off for good. This now also includes asm-generic/rtc.h, which is otherwise completely unused. Signed-off-by: Arnd Bergmann --- drivers/char/Kconfig | 26 --- drivers/char/Makefile | 1 - drivers/char/genrtc.c | 539 ---------------------------------------------- include/asm-generic/rtc.h | 51 ----- 4 files changed, 617 deletions(-) delete mode 100644 drivers/char/genrtc.c delete mode 100644 include/asm-generic/rtc.h -- 2.7.0 diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index a81f0eb9f71e..0d40fbd21c26 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -325,32 +325,6 @@ config JS_RTC To compile this driver as a module, choose M here: the module will be called js-rtc. -config OLD_GEN_RTC - tristate "Generic /dev/rtc emulation" - depends on RTC!=y - depends on BROKEN - ---help--- - If you say Y here and create a character special file /dev/rtc with - major number 10 and minor number 135 using mknod ("man mknod"), you - will get access to the real time clock (or hardware clock) built - into your computer. - - It reports status information via the file /proc/driver/rtc and its - behaviour is set by various ioctls on /dev/rtc. If you enable the - "extended RTC operation" below it will also provide an emulation - for RTC_UIE which is required by some programs and may improve - precision in some cases. - - To compile this driver as a module, choose M here: the - module will be called genrtc. - -config GEN_RTC_X - bool "Extended RTC operation" - depends on GEN_RTC - help - Provides an emulation for RTC_UIE which is required by some programs - and may improve precision of the generic RTC support in some cases. - config EFI_RTC bool "EFI Real Time Clock Services" depends on IA64 diff --git a/drivers/char/Makefile b/drivers/char/Makefile index fc0905aa7373..f33f5e35df9c 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -25,7 +25,6 @@ obj-$(CONFIG_APPLICOM) += applicom.o obj-$(CONFIG_SONYPI) += sonypi.o obj-$(CONFIG_RTC) += rtc.o obj-$(CONFIG_HPET) += hpet.o -obj-$(CONFIG_OLD_GEN_RTC) += genrtc.o obj-$(CONFIG_EFI_RTC) += efirtc.o obj-$(CONFIG_DS1302) += ds1302.o obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c deleted file mode 100644 index 4f943759d376..000000000000 --- a/drivers/char/genrtc.c +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Real Time Clock interface for - * - q40 and other m68k machines, - * - HP PARISC machines - * - PowerPC machines - * emulate some RTC irq capabilities in software - * - * Copyright (C) 1999 Richard Zidlicky - * - * based on Paul Gortmaker's rtc.c device and - * Sam Creasey Generic rtc driver - * - * This driver allows use of the real time clock (built into - * nearly all computers) from user space. It exports the /dev/rtc - * interface supporting various ioctl() and also the /proc/driver/rtc - * pseudo-file for status information. - * - * The ioctls can be used to set the interrupt behaviour where - * supported. - * - * The /dev/rtc interface will block on reads until an interrupt - * has been received. If a RTC interrupt has already happened, - * it will output an unsigned long and then block. The output value - * contains the interrupt status in the low byte and the number of - * interrupts since the last read in the remaining high bytes. The - * /dev/rtc interface can also be used with the select(2) call. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - - * 1.01 fix for 2.3.X rz@linux-m68k.org - * 1.02 merged with code from genrtc.c rz@linux-m68k.org - * 1.03 make it more portable zippel@linux-m68k.org - * 1.04 removed useless timer code rz@linux-m68k.org - * 1.05 portable RTC_UIE emulation rz@linux-m68k.org - * 1.06 set_rtc_time can return an error trini@kernel.crashing.org - * 1.07 ported to HP PARISC (hppa) Helge Deller - */ - -#define RTC_VERSION "1.07" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* - * We sponge a minor off of the misc major. No need slurping - * up another valuable major dev number for this. If you add - * an ioctl, make sure you don't conflict with SPARC's RTC - * ioctls. - */ - -static DEFINE_MUTEX(gen_rtc_mutex); -static DECLARE_WAIT_QUEUE_HEAD(gen_rtc_wait); - -/* - * Bits in gen_rtc_status. - */ - -#define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */ - -static unsigned char gen_rtc_status; /* bitmapped status byte. */ -static unsigned long gen_rtc_irq_data; /* our output to the world */ - -/* months start at 0 now */ -static unsigned char days_in_mo[] = -{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - -static int irq_active; - -#ifdef CONFIG_GEN_RTC_X -static struct work_struct genrtc_task; -static struct timer_list timer_task; - -static unsigned int oldsecs; -static int lostint; -static unsigned long tt_exp; - -static void gen_rtc_timer(unsigned long data); - -static volatile int stask_active; /* schedule_work */ -static volatile int ttask_active; /* timer_task */ -static int stop_rtc_timers; /* don't requeue tasks */ -static DEFINE_SPINLOCK(gen_rtc_lock); - -static void gen_rtc_interrupt(unsigned long arg); - -/* - * Routine to poll RTC seconds field for change as often as possible, - * after first RTC_UIE use timer to reduce polling - */ -static void genrtc_troutine(struct work_struct *work) -{ - unsigned int tmp = get_rtc_ss(); - - if (stop_rtc_timers) { - stask_active = 0; - return; - } - - if (oldsecs != tmp){ - oldsecs = tmp; - - timer_task.function = gen_rtc_timer; - timer_task.expires = jiffies + HZ - (HZ/10); - tt_exp=timer_task.expires; - ttask_active=1; - stask_active=0; - add_timer(&timer_task); - - gen_rtc_interrupt(0); - } else if (schedule_work(&genrtc_task) == 0) - stask_active = 0; -} - -static void gen_rtc_timer(unsigned long data) -{ - lostint = get_rtc_ss() - oldsecs ; - if (lostint<0) - lostint = 60 - lostint; - if (time_after(jiffies, tt_exp)) - printk(KERN_INFO "genrtc: timer task delayed by %ld jiffies\n", - jiffies-tt_exp); - ttask_active=0; - stask_active=1; - if ((schedule_work(&genrtc_task) == 0)) - stask_active = 0; -} - -/* - * call gen_rtc_interrupt function to signal an RTC_UIE, - * arg is unused. - * Could be invoked either from a real interrupt handler or - * from some routine that periodically (eg 100HZ) monitors - * whether RTC_SECS changed - */ -static void gen_rtc_interrupt(unsigned long arg) -{ - /* We store the status in the low byte and the number of - * interrupts received since the last read in the remainder - * of rtc_irq_data. */ - - gen_rtc_irq_data += 0x100; - gen_rtc_irq_data &= ~0xff; - gen_rtc_irq_data |= RTC_UIE; - - if (lostint){ - printk("genrtc: system delaying clock ticks?\n"); - /* increment count so that userspace knows something is wrong */ - gen_rtc_irq_data += ((lostint-1)<<8); - lostint = 0; - } - - wake_up_interruptible(&gen_rtc_wait); -} - -/* - * Now all the various file operations that we export. - */ -static ssize_t gen_rtc_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) -{ - unsigned long data; - ssize_t retval; - - if (count != sizeof (unsigned int) && count != sizeof (unsigned long)) - return -EINVAL; - - if (file->f_flags & O_NONBLOCK && !gen_rtc_irq_data) - return -EAGAIN; - - retval = wait_event_interruptible(gen_rtc_wait, - (data = xchg(&gen_rtc_irq_data, 0))); - if (retval) - goto out; - - /* first test allows optimizer to nuke this case for 32-bit machines */ - if (sizeof (int) != sizeof (long) && count == sizeof (unsigned int)) { - unsigned int uidata = data; - retval = put_user(uidata, (unsigned int __user *)buf) ?: - sizeof(unsigned int); - } - else { - retval = put_user(data, (unsigned long __user *)buf) ?: - sizeof(unsigned long); - } -out: - return retval; -} - -static unsigned int gen_rtc_poll(struct file *file, - struct poll_table_struct *wait) -{ - poll_wait(file, &gen_rtc_wait, wait); - if (gen_rtc_irq_data != 0) - return POLLIN | POLLRDNORM; - return 0; -} - -#endif - -/* - * Used to disable/enable interrupts, only RTC_UIE supported - * We also clear out any old irq data after an ioctl() that - * meddles with the interrupt enable/disable bits. - */ - -static inline void gen_clear_rtc_irq_bit(unsigned char bit) -{ -#ifdef CONFIG_GEN_RTC_X - stop_rtc_timers = 1; - if (ttask_active){ - del_timer_sync(&timer_task); - ttask_active = 0; - } - while (stask_active) - schedule(); - - spin_lock(&gen_rtc_lock); - irq_active = 0; - spin_unlock(&gen_rtc_lock); -#endif -} - -static inline int gen_set_rtc_irq_bit(unsigned char bit) -{ -#ifdef CONFIG_GEN_RTC_X - spin_lock(&gen_rtc_lock); - if ( !irq_active ) { - irq_active = 1; - stop_rtc_timers = 0; - lostint = 0; - INIT_WORK(&genrtc_task, genrtc_troutine); - oldsecs = get_rtc_ss(); - init_timer(&timer_task); - - stask_active = 1; - if (schedule_work(&genrtc_task) == 0){ - stask_active = 0; - } - } - spin_unlock(&gen_rtc_lock); - gen_rtc_irq_data = 0; - return 0; -#else - return -EINVAL; -#endif -} - -static int gen_rtc_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -{ - struct rtc_time wtime; - struct rtc_pll_info pll; - void __user *argp = (void __user *)arg; - - switch (cmd) { - - case RTC_PLL_GET: - if (get_rtc_pll(&pll)) - return -EINVAL; - else - return copy_to_user(argp, &pll, sizeof pll) ? -EFAULT : 0; - - case RTC_PLL_SET: - if (!capable(CAP_SYS_TIME)) - return -EACCES; - if (copy_from_user(&pll, argp, sizeof(pll))) - return -EFAULT; - return set_rtc_pll(&pll); - - case RTC_UIE_OFF: /* disable ints from RTC updates. */ - gen_clear_rtc_irq_bit(RTC_UIE); - return 0; - - case RTC_UIE_ON: /* enable ints for RTC updates. */ - return gen_set_rtc_irq_bit(RTC_UIE); - - case RTC_RD_TIME: /* Read the time/date from RTC */ - /* this doesn't get week-day, who cares */ - memset(&wtime, 0, sizeof(wtime)); - get_rtc_time(&wtime); - - return copy_to_user(argp, &wtime, sizeof(wtime)) ? -EFAULT : 0; - - case RTC_SET_TIME: /* Set the RTC */ - { - int year; - unsigned char leap_yr; - - if (!capable(CAP_SYS_TIME)) - return -EACCES; - - if (copy_from_user(&wtime, argp, sizeof(wtime))) - return -EFAULT; - - year = wtime.tm_year + 1900; - leap_yr = ((!(year % 4) && (year % 100)) || - !(year % 400)); - - if ((wtime.tm_mon < 0 || wtime.tm_mon > 11) || (wtime.tm_mday < 1)) - return -EINVAL; - - if (wtime.tm_mday < 0 || wtime.tm_mday > - (days_in_mo[wtime.tm_mon] + ((wtime.tm_mon == 1) && leap_yr))) - return -EINVAL; - - if (wtime.tm_hour < 0 || wtime.tm_hour >= 24 || - wtime.tm_min < 0 || wtime.tm_min >= 60 || - wtime.tm_sec < 0 || wtime.tm_sec >= 60) - return -EINVAL; - - return set_rtc_time(&wtime); - } - } - - return -EINVAL; -} - -static long gen_rtc_unlocked_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret; - - mutex_lock(&gen_rtc_mutex); - ret = gen_rtc_ioctl(file, cmd, arg); - mutex_unlock(&gen_rtc_mutex); - - return ret; -} - -/* - * We enforce only one user at a time here with the open/close. - * Also clear the previous interrupt data on an open, and clean - * up things on a close. - */ - -static int gen_rtc_open(struct inode *inode, struct file *file) -{ - mutex_lock(&gen_rtc_mutex); - if (gen_rtc_status & RTC_IS_OPEN) { - mutex_unlock(&gen_rtc_mutex); - return -EBUSY; - } - - gen_rtc_status |= RTC_IS_OPEN; - gen_rtc_irq_data = 0; - irq_active = 0; - mutex_unlock(&gen_rtc_mutex); - - return 0; -} - -static int gen_rtc_release(struct inode *inode, struct file *file) -{ - /* - * Turn off all interrupts once the device is no longer - * in use and clear the data. - */ - - gen_clear_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE); - - gen_rtc_status &= ~RTC_IS_OPEN; - return 0; -} - - -#ifdef CONFIG_PROC_FS - -/* - * Info exported via "/proc/driver/rtc". - */ - -static int gen_rtc_proc_show(struct seq_file *m, void *v) -{ - struct rtc_time tm; - unsigned int flags; - struct rtc_pll_info pll; - - flags = get_rtc_time(&tm); - - seq_printf(m, - "rtc_time\t: %02d:%02d:%02d\n" - "rtc_date\t: %04d-%02d-%02d\n" - "rtc_epoch\t: %04u\n", - tm.tm_hour, tm.tm_min, tm.tm_sec, - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 1900); - - tm.tm_hour = tm.tm_min = tm.tm_sec = 0; - - seq_puts(m, "alarm\t\t: "); - if (tm.tm_hour <= 24) - seq_printf(m, "%02d:", tm.tm_hour); - else - seq_puts(m, "**:"); - - if (tm.tm_min <= 59) - seq_printf(m, "%02d:", tm.tm_min); - else - seq_puts(m, "**:"); - - if (tm.tm_sec <= 59) - seq_printf(m, "%02d\n", tm.tm_sec); - else - seq_puts(m, "**\n"); - - seq_printf(m, - "DST_enable\t: %s\n" - "BCD\t\t: %s\n" - "24hr\t\t: %s\n" - "square_wave\t: %s\n" - "alarm_IRQ\t: %s\n" - "update_IRQ\t: %s\n" - "periodic_IRQ\t: %s\n" - "periodic_freq\t: %ld\n" - "batt_status\t: %s\n", - (flags & RTC_DST_EN) ? "yes" : "no", - (flags & RTC_DM_BINARY) ? "no" : "yes", - (flags & RTC_24H) ? "yes" : "no", - (flags & RTC_SQWE) ? "yes" : "no", - (flags & RTC_AIE) ? "yes" : "no", - irq_active ? "yes" : "no", - (flags & RTC_PIE) ? "yes" : "no", - 0L /* freq */, - (flags & RTC_BATT_BAD) ? "bad" : "okay"); - if (!get_rtc_pll(&pll)) - seq_printf(m, - "PLL adjustment\t: %d\n" - "PLL max +ve adjustment\t: %d\n" - "PLL max -ve adjustment\t: %d\n" - "PLL +ve adjustment factor\t: %d\n" - "PLL -ve adjustment factor\t: %d\n" - "PLL frequency\t: %ld\n", - pll.pll_value, - pll.pll_max, - pll.pll_min, - pll.pll_posmult, - pll.pll_negmult, - pll.pll_clock); - return 0; -} - -static int gen_rtc_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, gen_rtc_proc_show, NULL); -} - -static const struct file_operations gen_rtc_proc_fops = { - .open = gen_rtc_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static int __init gen_rtc_proc_init(void) -{ - struct proc_dir_entry *r; - - r = proc_create("driver/rtc", 0, NULL, &gen_rtc_proc_fops); - if (!r) - return -ENOMEM; - return 0; -} -#else -static inline int gen_rtc_proc_init(void) { return 0; } -#endif /* CONFIG_PROC_FS */ - - -/* - * The various file operations we support. - */ - -static const struct file_operations gen_rtc_fops = { - .owner = THIS_MODULE, -#ifdef CONFIG_GEN_RTC_X - .read = gen_rtc_read, - .poll = gen_rtc_poll, -#endif - .unlocked_ioctl = gen_rtc_unlocked_ioctl, - .open = gen_rtc_open, - .release = gen_rtc_release, - .llseek = noop_llseek, -}; - -static struct miscdevice rtc_gen_dev = -{ - .minor = RTC_MINOR, - .name = "rtc", - .fops = &gen_rtc_fops, -}; - -static int __init rtc_generic_init(void) -{ - int retval; - - printk(KERN_INFO "Generic RTC Driver v%s\n", RTC_VERSION); - - retval = misc_register(&rtc_gen_dev); - if (retval < 0) - return retval; - - retval = gen_rtc_proc_init(); - if (retval) { - misc_deregister(&rtc_gen_dev); - return retval; - } - - return 0; -} - -static void __exit rtc_generic_exit(void) -{ - remove_proc_entry ("driver/rtc", NULL); - misc_deregister(&rtc_gen_dev); -} - - -module_init(rtc_generic_init); -module_exit(rtc_generic_exit); - -MODULE_AUTHOR("Richard Zidlicky"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS_MISCDEV(RTC_MINOR); diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h deleted file mode 100644 index 4fcff22cd707..000000000000 --- a/include/asm-generic/rtc.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * include/asm-generic/rtc.h - * - * Author: Tom Rini - * - * Based on: - * drivers/char/rtc.c - * - * Please read the COPYING file for all license details. - */ - -#ifndef __ASM_RTC_H__ -#define __ASM_RTC_H__ - -#include - -#ifndef get_rtc_time -#include -#define get_rtc_time mc146818_get_time -#define set_rtc_time mc146818_set_time -#endif - -#define RTC_PIE 0x40 /* periodic interrupt enable */ -#define RTC_AIE 0x20 /* alarm interrupt enable */ -#define RTC_UIE 0x10 /* update-finished interrupt enable */ - -/* some dummy definitions */ -#define RTC_BATT_BAD 0x100 /* battery bad */ -#define RTC_SQWE 0x08 /* enable square-wave output */ -#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ -#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ -#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ - -static inline unsigned int get_rtc_ss(void) -{ - struct rtc_time h; - - get_rtc_time(&h); - return h.tm_sec; -} - -static inline int get_rtc_pll(struct rtc_pll_info *pll) -{ - return -EINVAL; -} -static inline int set_rtc_pll(struct rtc_pll_info *pll) -{ - return -EINVAL; -} - -#endif /* __ASM_RTC_H__ */