From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751316AbcDQVho (ORCPT ); Sun, 17 Apr 2016 17:37:44 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:56498 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbcDQVhn (ORCPT ); Sun, 17 Apr 2016 17:37:43 -0400 From: Arnd Bergmann To: Geert Uytterhoeven Cc: Greg Kroah-Hartman , "linux-arm-kernel@lists.infradead.org" , RTCLINUX , Alexandre Belloni , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/2] char: PC rtc: replace blacklist with whitelist Date: Sun, 17 Apr 2016 23:37:12 +0200 Message-ID: <4192558.Mh1hb3LCLb@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1456912137-1578635-1-git-send-email-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:DKEtUTHriSHeLlCzOR7x2E5oK7y/aIBCbyEzUz9KQKUe/Rxmzeh njjjs/gVb/naZJC4zuHqNCbxBWIgCP5t+8UG7L/p/X6RXdcSe21jL4UE0Ard5YJaQilbouS s/W/WBOfwyuDQdtmzBGgkbupI3gGNQs50jLqUvyRIQiShU72MgR+eTzMZyzE8QdBXLuKqMi OSf/niinqb9vxm4UyTD+Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:fbAkBSiE/mI=:ZzpsrQDN+dUhgD98pGXAPP /8xwCuou1UbLptcqggi/ZXumYiEkCo8zmEXdiH/UAv1Utf8NevH2CmsRR/qxtiyEux9l5/Xxj 6nAFdPl/91chVTZTiasccJOwsF1Eimm9jAmxnD2TE1EUYXs8CVIM7nuqAUe/KaAdfhi7iBb2M HeS7M6WNnOE0yW1epMbpElo4nXYKMg0BYDcgs/q1JbvRnsCHIZgzetdhW7KGKYWKzVN5vf7xy lKqcwaYWOw0pFpaUwW9niMCo+mvMo1Nn9ocNISfyJhxylbdwlYsUEKwvcuWLYSooi/g6I4GtJ ifddUAuyTXcWzdhlIbg9LBuVtYqXeNCovl7qVgV27q50FVClqvGXi02T6VPsfg2juDQMK8KBA L1EuIV1iPgzbys+SAxeItfJ25wmjixxPAG8rYmAPr7C++hRUSZX829rkQMN7w3SMM3lxcZsUv G2tBsfwZv2hqXM8HmrsPS/l9jGh3L6yXB9PPL5mYqPjammiaTrARnZc7x7uFzk2iHfJX0MAVH hf431+KjjmJwD9ZSfE9Vddezf7kfJMyXDkq24Ejn5mzLs7yFPCWAviUChVQDfoo95e31edVBi W1Lha+6CwKmY+Ix5+xW1D88YYZlFeR97ujF8BuDfoPFD5uEE4ucy6sUA2vGKTunq+Rk0BzyyN BAELSyqlZzbQpkDsQvaZrTXnG5jbyFVhLTjDddxeNI2+5KhKV+yM4uCZeTCkq2EkZl0xtj5Ae QXw1E+NFYOLRRqtK Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 02 March 2016 11:22:04 Geert Uytterhoeven wrote: > On Wed, Mar 2, 2016 at 10:48 AM, Arnd Bergmann wrote: > > Every new architecture has to add itself to the growing list of those > > that do not support the legacy PC RTC driver. > > > > This replaces the long list of architectures that don't support it > > with a shorter list of those that do. > > > > The list is taken from those architectures that have a non-empty > > asm/mc146818rtc.h header file and were not explicitly blacklisted. > > M68K was blacklisted... I never got back to you on this topic, sorry about that. I've fixed up the patch to leave out m68k now. On a semi-related note, I see that m68k is one of the few architectures still using the (other) genrtc driver. It would be nice to reduce that list and change m68k to use its own rtc driver (ideally one per platform), but the q40 platform is the only one providing get_rtc_pll()/set_rtc_pll() for the RTC_PLL_GET/RTC_PLL_SET ioctl commands. If we do this change on top of the other m68k patch I have, the rtc-generic driver should be usable as a full replacement for genrtc.c on m68k and we can remove all the set_rtc_pll/get_rtc_pll handling from genrtc. diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index 773b2187210d..f4781d612c37 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, }; Arnd