From patchwork Tue Apr 26 21:52: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: 615352 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-lf0-x23e.google.com (mail-lf0-x23e.google.com [IPv6:2a00:1450:4010:c07::23e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qvcK263Q3z9t6X for ; Wed, 27 Apr 2016 07:52:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b=GsN5H8F5; dkim-atps=neutral Received: by mail-lf0-x23e.google.com with SMTP id d131sf15386280lfd.1 for ; Tue, 26 Apr 2016 14:52:54 -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=eLpiOvHN8o/8r7cD88OsMnGqxSJifBjg+CBpM8O4Nis=; b=GsN5H8F5RTCOqYvZLt9k9h/1ppZs5KnNdxXQSBUoBv6sY+gNLbxp/hU1CF2/czOkVw +dyyqwluYFIOtIyLdzKUntfkUBp5G61bqT5EmDmzjDOJn+r5yl7QN3W6VykQgH+ogVTZ ksl1WQWblBIndyHye+8IhzeO9kf6nK6C7vH79jI2pYBtz8EpDA8fJBkLPUUmjblfmnxb g4pMSph3FCEa5Eu6cbhdBggMJ6nEZ2+42G089pNjWx7u20FmqoyEjHWr0O+DSAVkgSZG yO1wbLoa0qTvwgESrHheXLnLk3qEvEc++oWBWkDuhuBfH8MMCIE1Se4jf/aTjUIpZ9FF m52g== 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=eLpiOvHN8o/8r7cD88OsMnGqxSJifBjg+CBpM8O4Nis=; b=SaHzu+QZj/Qy9klQyNLFOpaGsaQuSIpKPSNYizCkaTm/IfficN4NnpN8npy6VVnoxa 1UecKGqZQt0U2hOJr4b/5sseb0W3dBMgssdJa0QEtpI30915+6ZeujiQGxReTKuetXWi HMOKvFsSBmZJUkRQWeXvfFVJV1TTvf8LDI6/a+NcIBXRYkRO4Qd38ROv1AaImhF6kAFI lI+VV04O63qHfdCJ1EkZdOCJf4GsqKrixR+azvn7e51fTw4Y+9VYEoHLHAqYke58+lBY etm4eI2BA1QjvDgbRI91tov8Sd0SR+horqn1YzYEtQ+npgsbJiEI7qFv1R3ukQ8gJAXl xnhw== Sender: rtc-linux@googlegroups.com X-Gm-Message-State: AOPr4FWzE6mDpJVrjokurr+IdJ3t0Bc/zYYEPgeX1MY0resPth56UZInypZRMhln9NJc2g== X-Received: by 10.25.141.70 with SMTP id p67mr108733lfd.4.1461707572420; Tue, 26 Apr 2016 14:52:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.25.216.131 with SMTP id r3ls319701lfi.69.gmail; Tue, 26 Apr 2016 14:52:51 -0700 (PDT) X-Received: by 10.112.156.100 with SMTP id wd4mr634530lbb.4.1461707571923; Tue, 26 Apr 2016 14:52:51 -0700 (PDT) Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.13]) by gmr-mx.google.com with ESMTPS id a65si762525wma.0.2016.04.26.14.52.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 14:52:51 -0700 (PDT) Received-SPF: neutral (google.com: 212.227.17.13 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.17.13; Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0LzHnN-1bps9y0mDB-014Xax; Tue, 26 Apr 2016 23:52:43 +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: [rtc-linux] [PATCH v2 2/6] rtc: m68k: provide ioctl for q40 Date: Tue, 26 Apr 2016 23:52:27 +0200 Message-Id: <1461707551-1337971-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461707551-1337971-1-git-send-email-arnd@arndb.de> References: <1461707551-1337971-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:bZrkVoRWw85RJj0mzAeNVRe2/3m37ZaxKL3N7wP0lTIeb9YygL7 eTBPheQFllo6mIbjVkaUbMgCQZeHlw1pMRsMNHc3NT6vhw4jWb+RFbIe1pjSEvnYLh/ilxz Zz6wAAoSHZlaaaW1FJRCktAG7Bmye88pOWr5xht91U+gI3ribdJEvrNz7mYVDC5Acca301G giMaPuHshqCpFRXIf7HRQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:rr7j+HUTrbY=:WuR09wj7egjikmSEB9LDEw 7/EV922Ee6IsqtpICqno/Q/OmlyXNkW9KhZF3WZKRF1gARCyOe2fNEnelYz1vy3zyDVp1tPSL ZlzMUM54LQGNw++4wVVmGujfkXM0zYyopHG8vPZ8G3P4aRimNfJQwFmri6cNvbOBMDcchaScm GXldqTP91TbBoGyGdZxDUqnBqR+Zp93BIn2VLkpTt6pIcvmHjR3TnRiHo7NHTVjVAyv5bBGy1 zvelYGrqo2DlUpelIg0z15pCmTagXr3MpImRTXfKTYJ8LPc88CzU3U+Pb1yXuqsB/Jlqkaie6 JIEl+puXZbxvRH/3BM9rDYfTThO7fAC7WzPAIn+D/a6ryHTL4Zq4UbKmQqTU70TTh3f43Ywax tGD2n2DN8uxFPfbf1/goiperdaokqZdf+nmbJM0JlbnNYdQyoF11hB3aZ1zqeGPkm5YszFI23 MFDxipMfizdEZH4GU5ymly97i1BGm6zlH+jcF0gw9nGs4kK0igwNO5JbUztXXE4O8gZ2TOzni i5i4yPhWJfRoZsecUhyRLFkC+72F7oR7fHcRtShzKsLqy19nMVE0+EuK3FLZhD1mi5k32YF9i zwBKo/86NFUS+n4IPD+0CSNJN2mKuDltSrEV/6HLZMUPmeGnF4ucvoQ8ViDC9j4usakqpW74b 52pso2Pii83QoZoOxObFZME7h4dcVLt1DIjHHZ5z46l3GgqdsyyNTWMoGZHRKyD7ljwU= X-Original-Sender: arnd@arndb.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.227.17.13 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 fe35890feede..5f0a5826a05e 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, };