From patchwork Mon May 30 18:57:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 627915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-lf0-x23f.google.com (mail-lf0-x23f.google.com [IPv6:2a00:1450:4010:c07::23f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rJQqj38Pgz9t7T for ; Tue, 31 May 2016 04:58:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b=DfCuEXdc; dkim-atps=neutral Received: by mail-lf0-x23f.google.com with SMTP id o70sf37899919lfg.1 for ; Mon, 30 May 2016 11:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references: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=JiTmr74gePiZHNglnLgy9o1uCJzmgYCX8VZvj7S4Qn4=; b=DfCuEXdc72lZQH3cs8mZJaUuFLaU+Tw/C8kk3f1+IFy6LdLepjb2iuSrVg+xdB6LmQ n/Ka3zVyxeVUyWmbJvSoB1VVe8rgw/n4ZXlV01c3xaYJ9CYg9bliyywjLoSRsuU7RPvq MIzuBLVVw8Ojaia8kxSTbX6y5qFLvRkCnFULPvy8vUGe0rv68f5IRAQZAcnH1vOlUhvD gdwR1/kKi1nA8hTYZWT6jIHKxxDNBNlP2CRScozC3s5Myg+ei884Vcuzk/0mQoze8Cii k77HmhC+8Mo4Qpvh0HyJodxS0WqSpfmQcRHH+H2CFSJepbfH0nvxWIJPIDltw2pZRp8F BjTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references: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=JiTmr74gePiZHNglnLgy9o1uCJzmgYCX8VZvj7S4Qn4=; b=lshrI3MDQLnZvuZ1QgXcYoFQKl41TaOmEsHX8opmgpbdH7xlyKrN93vpKmBpiTM4rx Zqi6fML5uBFPHGuHAYgZ3oPdPkv8Us8S5sTGFSiCkbQudgPzcamYrq4OD59r1WcrVNKw TnquaIe+jimHNV2yrin+JdULpaono5o5tA2OWPCEKNJIyK1bINx/0DPl6sBhKnpkSCvh a+cmNIg9ZWSAaqGQAKpzGxtxJvS2V2tTfsjyxJyecaeORSOKe/R9QVNKmtxM8fJoj9md wnXD9m1x8/xL7VzbABivpGZG51enFm4v0ipdlL0M37gIWsZV3RPZJ1agoBr7k4Am2Lu5 oMRw== Sender: rtc-linux@googlegroups.com X-Gm-Message-State: ALyK8tIzkGt6ke6N6D0Bdj3D0+fS1aO/5gDfhoEY/60MLcArRDbppjIkGe7QLbiGFgdyAQ== X-Received: by 10.28.152.195 with SMTP id a186mr32790wme.3.1464634685861; Mon, 30 May 2016 11:58:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.28.154.83 with SMTP id c80ls865980wme.10.canary; Mon, 30 May 2016 11:58:05 -0700 (PDT) X-Received: by 10.28.35.9 with SMTP id j9mr1196025wmj.7.1464634685365; Mon, 30 May 2016 11:58:05 -0700 (PDT) Received: from mout.kundenserver.de (mout.kundenserver.de. [217.72.192.73]) by gmr-mx.google.com with ESMTPS id l68si1161827wmd.3.2016.05.30.11.58.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 May 2016 11:58:05 -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.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MTxeT-1az2Cm3Bon-00QnVn; Mon, 30 May 2016 20:58:02 +0200 From: Arnd Bergmann To: Alexandre Belloni Cc: Arnd Bergmann , geert@linux-m68k.org, gregkh@linuxfoundation.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: [rtc-linux] [PATCH v4 10/16] rtc: m68k: provide ioctl for q40 Date: Mon, 30 May 2016 20:57:58 +0200 Message-Id: <1464634684-1248135-11-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1464634684-1248135-1-git-send-email-arnd@arndb.de> References: <1464634684-1248135-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:gHIkoH1ulTlAW4drwalu3Aq1cX6DSBjBf4x1GaEqfDQV4MjZbxe BZ3FDqtKMgsvGpnq4rKSdZhGKQtAMWsosbgn/hsZgPHOvoWraZ0pO2zrHWGqD3CTw03WrQu xErDHmJTQwbWTC0FPUH4eXPXIx2b21hzQrTMHv4tRZITHQE1RN7/7PfdHGq02oFnDmFJrZX AtYz9i19TAFsSpENXnF8Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:ur4YYMqA46w=:ogt8yCwt4e3TtUvZWALOV5 +BbjIa/KG8/A4+iG/d1AGaiEdb3WZRC3P6HkqNpH6W31ZhIpyuqjQ+RwShXEO32pNYlUYQi+Y htXnViT1nTw9hVRon2ukNB8sR0RHG36rwXtKbmTDMH2zwTJyoh7wlMFqTnb4fRM+2qunPv4Gf wxAu5toVkgkHNieYzHIloZkRs4fwv+JJGTsK3HnRjaBRzdw0CplFwRUGExIn12jAsDgyFmLKI Py8Y+5Lrc0Xl8m6lMqnPjVOg3JQRCiYWnFV/08xojaJNSsknkjUSHTIY16Ck3+eu4NiKcjd19 sqpBIHSxKQmWrowHmnN+Eq5fcTmjJsVEeXIMfxjKNLcEMeh4ScG0RLaVC1wBGeGkQREz7tLx/ 5YFFSdHZ2G6Gzt10ZwPMz6i2SYEGEp0Jo/NWRBoTCBEVsprnrt6aPBQ59DVmwQeZTJ5RLysJn BzRpTe5TMUZtzWJilQnepuu5Ggg1Um8JmVifxh4IVfBuvTKCklqksY4Q1juwD5/oQga0ZjJrK fH1mYfK13vb1jB2QuHBE1EAQrcHnHjMhcVUes1cFv9ijaPiC2VSwaZlSVD0VqmYOOXDy0okRx LjWb0dJggvyVbTqxaBzEjg4UCuH6ahr7k40oTCZLUgNvZm0wr8R4PTq1m8GZAB332LQ4yUFGB DiNhdBON+KHLJI+bHeVAtfE2CjHuMdeMjaCQTnhZUyvopXa0ex3JRvW+IkXx6TtEW52Q= 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: , 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(+) diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index bd6417d38d5a..4e5aa2f4f522 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, };