From patchwork Mon Dec 16 14:48:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181729 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4406717ile; Mon, 16 Dec 2019 06:49:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxPvEOxvX5aLthgLjMs1TqUgWdcxqUhPxk9mf9Sm3Qz3PuHDZx7Mx4T5DmhUtUOKrZWIMfR X-Received: by 2002:aca:120e:: with SMTP id 14mr9005347ois.135.1576507790585; Mon, 16 Dec 2019 06:49:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576507790; cv=none; d=google.com; s=arc-20160816; b=nTn4OrDQRJR2jcAHYfoev6ZweDaryNV/7/s0Ub3Hl0Q+fK15gpTRs876L/F5isi6Hc 5G6CqLEhN6na+bm0sXKevxNZXDv4yjgum9Bd7PkmFumCg2hF3I6r/86hSTohEjUjQj5r qrlAO9TDtFKQs+dnzDCZP4viXfKdmB5CES/09ejnn7NHBOo0FUy3TYCIbEdjJYTukylW fyIQXb5u5pER1psgm0t2J8Iwgkv74uTWZzwQEhJaxu4SkUnrS2qzKrufCZx2kiM4jxv7 YKkM3/byDb35WS5JE7OFzyaHLZoH4ZdIunWU86ikBIjEBPetWgHOAT1UpUwz9SPWD0K4 dogw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=RjWcHbS++OHSECt5loG1YsqK9tTkFAgdeK54whyTms0=; b=aE73kVeOvp21CodZNBmiMIyvCbNjPMu2j3OtBgKPy8+r/YUxIIEu88MLAob9vq/vce JsM9lxhzGAGcgurF/WQtirfxf0wLURX/Cvnck5ga7dVeKCT2Jtq8FqbVA+dZTgjMGOrH aMuOvvOQCPSPD8WVzdU0IZNHFX+NklsRrFse8AJgGN1FsMSxTsk3C7znyjPDbe/KH9sf SEcA3SyZCJDdNoS5ae9r6YTXZZK3jnZ32Er+JuBQduyg3w7isR46tFjj8o4HFpEyOZ/K ntlTAqwP8p06WMqds6pwFM33X6CEoOx4BvOkBdFdLeglvYE9yAIsGfrtOK5q0tyNufAv NOaQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i25si10476224oii.259.2019.12.16.06.49.50; Mon, 16 Dec 2019 06:49:50 -0800 (PST) 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 S1728190AbfLPOts (ORCPT + 27 others); Mon, 16 Dec 2019 09:49:48 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:38319 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728014AbfLPOts (ORCPT ); Mon, 16 Dec 2019 09:49:48 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mofst-1hwGO02HIf-00p79V; Mon, 16 Dec 2019 15:49:13 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: Julian Calaby , Arnd Bergmann , John Stultz , Thomas Gleixner , Stephen Boyd , "Eric W. Biederman" , Deepa Dinamani , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] y2038: sparc: remove use of struct timex Date: Mon, 16 Dec 2019 15:48:53 +0100 Message-Id: <20191216144907.1931511-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:SD9rTavFUocz6lTgBzyWJKCDwZMGx6GQHqRzwZ5WgDi5LT4Zg47 60bHxonI53Bup8EujS4+6F+AMH/CfRjJySvogLwX86fOQ7WmIUSun0AYvtDdbHi0DCOuoHc HQQtPAOoXE/b+7Nx/Fanu1Vkc3/zSWXyitoA3+dGpn3owdwtAOIrT9udBSwqYgwXJf0Vf55 Yki730p6PxSbIOZ/qRdXA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:A28Gjab46IU=:TUSBcmj2VLOO7RKETeVmBR 1tcCM3ko/hKnpa6Tdwxb21L+ZGs3s6yjR7fFX0/GwWMlqQh7pi3n1KHeKAxh6zJooB/3fa/5o 5BK9DD27o/1RJNfemhrKN1El8pk4PRC6G2juiuVHAjTViFMINEQaGa9Z6VTBVX+hyGVdJzQUf tK94d6+tIJgj6l0oVWL7TS1CtIwrTpGPQc75e2IrJesrvX2rapbVleWe1Dz05xW/1TDPkZcsD w7fPFX7winY5wLDW+E1zi6f3/5PlDDcVI28Bmb1Jh+AmGOE12lLqIU+DpDtSiWhfDCNnluwh5 pS4ROP79ZFWzR2Zg70YenCovyCw8lvKIyHZzacr3i5cyct592BX5Ghlu5HWIu04O16wbgkt+D o5dm8O+MzRAv+urpEoAFLca1oofWvS670IyDbnV8hhhJVjlSgfmX91W15B9+s1uyec+dbR7C+ knrvxqLhupx1Ls8rLg0LI/KzklBWl0uekrqlr84SzmxaDLeDROP1IrzGuFwfdJvppAF298IT5 1eH7toqXnK+9G9VCPENuC527adM8xmxhXoHbaeIQr3NdzW6ceg/QiUciJ8A/3Cp3+4UO82Vpq maxK/nq25gOOHCcldjRgb+sEOpbXgUIr8cbcKlt4Cnes7V+gUzRqzpjb35678QmHna3ovhiFO 4h0BCnH6gnugAhB+b8AwKzVzuCbybVFBQcP1ezetkovXJ/8nsZohGVinUEdW0UomZNXTw/bJm jSbY8FatMuxuMyqjlgZ81SdQwvaHAREzmw8LKAAoPNY2RZVUNmAOe4C5oLtvfX/lU/Utgwskc pB6mW8Hp8kmtekDFW1yiIeatoDsoP6j1q21uaIiM2qSJayLZX5qklURkysxFDplncRgEdSRyQ HV1TuGVr9Nu7s3cZHeWQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'struct timex' is one of the last users of 'struct timeval' and is only referenced in one place in the kernel any more, to convert the user space timex into the kernel-internal version on sparc64, with a different tv_usec member type. As a preparation for hiding the time_t definition and everything using that in the kernel, change the implementation once more to only convert the timeval member, and then enclose the struct definition in an #ifdef. Signed-off-by: Arnd Bergmann --- v2: send a version that it at least build tested this time If this looks ok to you, please queue it in the sparc git for v5.6 arch/sparc/kernel/sys_sparc_64.c | 33 ++++++++++++++++---------------- include/uapi/linux/timex.h | 2 ++ 2 files changed, 19 insertions(+), 16 deletions(-) -- 2.20.0 Reviewed-by: Julian Calaby diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index 9f41a6f5a032..34917617f258 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c @@ -548,34 +548,35 @@ SYSCALL_DEFINE2(getdomainname, char __user *, name, int, len) return err; } -SYSCALL_DEFINE1(sparc_adjtimex, struct timex __user *, txc_p) +SYSCALL_DEFINE1(sparc_adjtimex, struct __kernel_timex __user *, txc_p) { - struct timex txc; /* Local copy of parameter */ - struct __kernel_timex *kt = (void *)&txc; + struct __kernel_timex txc; + struct __kernel_old_timeval *tv = (void *)&txc_p->time; int ret; /* Copy the user data space into the kernel copy * structure. But bear in mind that the structures * may change */ - if (copy_from_user(&txc, txc_p, sizeof(struct timex))) + if (copy_from_user(&txc, txc_p, sizeof(txc))) return -EFAULT; /* * override for sparc64 specific timeval type: tv_usec * is 32 bit wide instead of 64-bit in __kernel_timex */ - kt->time.tv_usec = txc.time.tv_usec; - ret = do_adjtimex(kt); - txc.time.tv_usec = kt->time.tv_usec; + txc.time.tv_usec = tv->tv_usec; + ret = do_adjtimex(&txc); + tv->tv_usec = txc.time.tv_usec; - return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret; + return copy_to_user(txc_p, &txc, sizeof(txc)) ? -EFAULT : ret; } -SYSCALL_DEFINE2(sparc_clock_adjtime, const clockid_t, which_clock,struct timex __user *, txc_p) +SYSCALL_DEFINE2(sparc_clock_adjtime, const clockid_t, which_clock, + struct __kernel_timex __user *, txc_p) { - struct timex txc; /* Local copy of parameter */ - struct __kernel_timex *kt = (void *)&txc; + struct __kernel_timex txc; + struct __kernel_old_timeval *tv = (void *)&txc_p->time; int ret; if (!IS_ENABLED(CONFIG_POSIX_TIMERS)) { @@ -590,18 +591,18 @@ SYSCALL_DEFINE2(sparc_clock_adjtime, const clockid_t, which_clock,struct timex _ * structure. But bear in mind that the structures * may change */ - if (copy_from_user(&txc, txc_p, sizeof(struct timex))) + if (copy_from_user(&txc, txc_p, sizeof(txc))) return -EFAULT; /* * override for sparc64 specific timeval type: tv_usec * is 32 bit wide instead of 64-bit in __kernel_timex */ - kt->time.tv_usec = txc.time.tv_usec; - ret = do_clock_adjtime(which_clock, kt); - txc.time.tv_usec = kt->time.tv_usec; + txc.time.tv_usec = tv->tv_usec; + ret = do_clock_adjtime(which_clock, &txc); + tv->tv_usec = txc.time.tv_usec; - return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret; + return copy_to_user(txc_p, &txc, sizeof(txc)) ? -EFAULT : ret; } SYSCALL_DEFINE5(utrap_install, utrap_entry_t, type, diff --git a/include/uapi/linux/timex.h b/include/uapi/linux/timex.h index 9f517f9010bb..bd627c368d09 100644 --- a/include/uapi/linux/timex.h +++ b/include/uapi/linux/timex.h @@ -57,6 +57,7 @@ #define NTP_API 4 /* NTP API version */ +#ifndef __KERNEL__ /* * syscall interface - used (mainly by NTP daemon) * to discipline kernel clock oscillator @@ -91,6 +92,7 @@ struct timex { int :32; int :32; int :32; int :32; int :32; int :32; int :32; }; +#endif struct __kernel_timex_timeval { __kernel_time64_t tv_sec;