From patchwork Tue Mar 22 20:51:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 8645211 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DEDCEC0553 for ; Tue, 22 Mar 2016 20:52:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D510F202E5 for ; Tue, 22 Mar 2016 20:52:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C48802021F for ; Tue, 22 Mar 2016 20:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751772AbcCVUwB (ORCPT ); Tue, 22 Mar 2016 16:52:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59283 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751449AbcCVUvy (ORCPT ); Tue, 22 Mar 2016 16:51:54 -0400 Received: from akpm3.mtv.corp.google.com (unknown [104.132.1.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 817E074; Tue, 22 Mar 2016 20:51:53 +0000 (UTC) Date: Tue, 22 Mar 2016 13:51:52 -0700 From: Andrew Morton To: Dmitry Torokhov Cc: Andy Lutomirski , Andy Lutomirski , Al Viro , Linus Torvalds , X86 ML , linux-arch , David Miller , "linux-s390@vger.kernel.org" , Chris Metcalf , linux-parisc@vger.kernel.org, "linux-mips@linux-mips.org" , sparclinux@vger.kernel.org Subject: Re: [PATCH v2 14/16] input: Redefine INPUT_COMPAT_TEST as in_compat_syscall() Message-Id: <20160322135152.78d21ee6d56b702f06c5e01f@linux-foundation.org> In-Reply-To: <20160127210610.GB28687@dtor-ws> References: <64480084bc652d5fa91bf5cd4be979e2f1e4cf11.1453759363.git.luto@kernel.org> <20160127210610.GB28687@dtor-ws> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 27 Jan 2016 13:06:10 -0800 Dmitry Torokhov wrote: > On Wed, Jan 27, 2016 at 12:29:14PM -0800, Andy Lutomirski wrote: > > On Wed, Jan 27, 2016 at 11:17 AM, Dmitry Torokhov > > wrote: > > > Hi Andy, > > > > > > On Mon, Jan 25, 2016 at 2:24 PM, Andy Lutomirski wrote: > > >> The input compat code should work like all other compat code: for > > >> 32-bit syscalls, use the 32-bit ABI and for 64-bit syscalls, use the > > >> 64-bit ABI. We have a helper for that (in_compat_syscall()): just > > >> use it. > > >> > > >> Signed-off-by: Andy Lutomirski > > >> --- > > >> drivers/input/input-compat.h | 12 +----------- > > >> 1 file changed, 1 insertion(+), 11 deletions(-) > > >> > > >> diff --git a/drivers/input/input-compat.h b/drivers/input/input-compat.h > > >> index 148f66fe3205..0f25878d5fa2 100644 > > >> --- a/drivers/input/input-compat.h > > >> +++ b/drivers/input/input-compat.h > > >> @@ -17,17 +17,7 @@ > > >> > > >> #ifdef CONFIG_COMPAT > > >> > > >> -/* Note to the author of this code: did it ever occur to > > >> - you why the ifdefs are needed? Think about it again. -AK */ > > >> -#if defined(CONFIG_X86_64) || defined(CONFIG_TILE) > > >> -# define INPUT_COMPAT_TEST is_compat_task() > > >> -#elif defined(CONFIG_S390) > > >> -# define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT) > > >> -#elif defined(CONFIG_MIPS) > > >> -# define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT_ADDR) > > >> -#else > > >> -# define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT) > > >> -#endif > > >> +#define INPUT_COMPAT_TEST in_compat_syscall() > > >> > > > > > > > > > If we now have function that works on all arches I'd prefer if we used > > > it directly instead of continuing using INPUT_COMPAT_TEST. > > > > I'll write a followup patch for that if you don't beat me to it. > > I promise I wont ;) Well someone needs beating! I'm prepping this patch for Linus now. I shall queue up the below for later. From: Andrew Morton Subject: drivers/input: eliminate INPUT_COMPAT_TEST macro INPUT_COMPAT_TEST became much simpler after "input: redefine INPUT_COMPAT_TEST as in_compat_syscall()" so we can cleanly eliminate it altogether. Cc: Dmitry Torokhov Cc: Andy Lutomirski Cc: Andy Lutomirski Signed-off-by: Andrew Morton Acked-by: Dmitry Torokhov --- drivers/input/input-compat.c | 6 +++--- drivers/input/input-compat.h | 4 +--- drivers/input/input.c | 2 +- drivers/input/misc/uinput.c | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff -puN drivers/input/input-compat.h~a drivers/input/input-compat.h --- a/drivers/input/input-compat.h~a +++ a/drivers/input/input-compat.h @@ -17,8 +17,6 @@ #ifdef CONFIG_COMPAT -#define INPUT_COMPAT_TEST in_compat_syscall() - struct input_event_compat { struct compat_timeval time; __u16 type; @@ -57,7 +55,7 @@ struct ff_effect_compat { static inline size_t input_event_size(void) { - return (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) ? + return (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) ? sizeof(struct input_event_compat) : sizeof(struct input_event); } diff -puN drivers/input/misc/uinput.c~a drivers/input/misc/uinput.c --- a/drivers/input/misc/uinput.c~a +++ a/drivers/input/misc/uinput.c @@ -664,7 +664,7 @@ struct uinput_ff_upload_compat { static int uinput_ff_upload_to_user(char __user *buffer, const struct uinput_ff_upload *ff_up) { - if (INPUT_COMPAT_TEST) { + if (in_compat_syscall()) { struct uinput_ff_upload_compat ff_up_compat; ff_up_compat.request_id = ff_up->request_id; @@ -695,7 +695,7 @@ static int uinput_ff_upload_to_user(char static int uinput_ff_upload_from_user(const char __user *buffer, struct uinput_ff_upload *ff_up) { - if (INPUT_COMPAT_TEST) { + if (in_compat_syscall()) { struct uinput_ff_upload_compat ff_up_compat; if (copy_from_user(&ff_up_compat, buffer, diff -puN drivers/input/input-compat.c~a drivers/input/input-compat.c --- a/drivers/input/input-compat.c~a +++ a/drivers/input/input-compat.c @@ -17,7 +17,7 @@ int input_event_from_user(const char __user *buffer, struct input_event *event) { - if (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) { + if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) { struct input_event_compat compat_event; if (copy_from_user(&compat_event, buffer, @@ -41,7 +41,7 @@ int input_event_from_user(const char __u int input_event_to_user(char __user *buffer, const struct input_event *event) { - if (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) { + if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) { struct input_event_compat compat_event; compat_event.time.tv_sec = event->time.tv_sec; @@ -65,7 +65,7 @@ int input_event_to_user(char __user *buf int input_ff_effect_from_user(const char __user *buffer, size_t size, struct ff_effect *effect) { - if (INPUT_COMPAT_TEST) { + if (in_compat_syscall()) { struct ff_effect_compat *compat_effect; if (size != sizeof(struct ff_effect_compat)) diff -puN drivers/input/input.c~a drivers/input/input.c --- a/drivers/input/input.c~a +++ a/drivers/input/input.c @@ -1015,7 +1015,7 @@ static int input_bits_to_string(char *bu { int len = 0; - if (INPUT_COMPAT_TEST) { + if (in_compat_syscall()) { u32 dword = bits >> 32; if (dword || !skip_empty) len += snprintf(buf, buf_size, "%x ", dword);