From patchwork Sun Apr 17 21:37:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 611531 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-vk0-x240.google.com (mail-vk0-x240.google.com [IPv6:2607:f8b0:400c:c05::240]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qp4PG2N0sz9t5Y for ; Mon, 18 Apr 2016 07:37:21 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b=T2WychG9; dkim-atps=neutral Received: by mail-vk0-x240.google.com with SMTP id x190sf45264672vka.1 for ; Sun, 17 Apr 2016 14:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=sender:from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=R5F7uPRFqFIefU8Vhz5ETmsmgFbZy61l4yNOYoh0jg0=; b=T2WychG9jwm4qSIfnl7H3Ol02GYN0lU/z9RTST0qoltLdaoW3RAyysQ5d9ox7O4Pmj TvDJ1qipiluniVpash4aFcBCalgeVn7Yl8AqFFA5zFqxQUXt/8ttHJtNzrVlTPwclGdz BQYWu4IF7EOewkFWxMqfQQBcbZdnCwa3iflbavRTt2pY6Cp3VhDyqeuCeswxTayS93JE yroHR/nBjLygTN+nhb8UD+Eelb1Ux7J5SnY7835R3dLK306CMJRZun9D13M74EfggJzv 1D+bY/0JV4ivuFs1jUKavt8IeFZvLOq49zDDIQHm8UwBflT8cnrjGSOfpxGQGENoiYLV +gXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :user-agent:in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=R5F7uPRFqFIefU8Vhz5ETmsmgFbZy61l4yNOYoh0jg0=; b=UCpKr+cNAyabW6DYkSd6X0o/P1cDBc2/2rPZBUgoaQ/yalz/8JVNQXS6SL44t9tUf2 sdfYwasr7ZfwXGTdV3KV0CzKLe4AbmE51B2e0htoj6r7qJ71XgwieTbrMgCKSGTSz3Lu lBJWXoRWI004yF8yOjrGVGnRf5ltEqztEW5uK2kRQ/fZuws0eCH1W7IIfKgDk7z/Mogg gFPulBJgt2Dv7kg2sY44qnJR1jTySPUyRCfHStMNave07/Fmv4ncC4Ln8sDi2jDhfhDo evLVqEtO/gXt1mvHpvZAZDtEakW+VXx6eBgRQEwBNz4BoK6MlkFcqvpVSrNUiI5Sx0Yf bx+w== Sender: rtc-linux@googlegroups.com X-Gm-Message-State: AOPr4FX4ORkMDaMJwkF2xJMJej1vGX1Fnezu/eLmfpgJUrbM7RWBzxideUzWC+q0ukbFZQ== X-Received: by 10.157.35.195 with SMTP id t61mr305741otb.16.1460929037466; Sun, 17 Apr 2016 14:37:17 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.157.31.118 with SMTP id x51ls82172otx.39.gmail; Sun, 17 Apr 2016 14:37:16 -0700 (PDT) X-Received: by 10.182.73.72 with SMTP id j8mr2547524obv.16.1460929036843; Sun, 17 Apr 2016 14:37:16 -0700 (PDT) Received: from mout.kundenserver.de (mout.kundenserver.de. [217.72.192.73]) by gmr-mx.google.com with ESMTPS id r5si157911igp.0.2016.04.17.14.37.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Apr 2016 14:37:16 -0700 (PDT) Received-SPF: neutral (google.com: 217.72.192.73 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=217.72.192.73; Received: from wuerfel.localnet ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0LZvn3-1bbT0e30Np-00lkLg; Sun, 17 Apr 2016 23:37:13 +0200 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: [rtc-linux] 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 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 X-Original-Sender: arnd@arndb.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 217.72.192.73 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mailfrom=arnd@arndb.de Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: rtc-linux@googlegroups.com X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , 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. Arnd 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, };