Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2911044imu; Mon, 19 Nov 2018 07:59:03 -0800 (PST) X-Google-Smtp-Source: AJdET5fJf0Bxksm1jc1Ad1qBfU33UKDNjHpo+5HLLPrZHbfyZuHA0mjpzofKVbOrC7lmAyfbgL7W X-Received: by 2002:a62:4105:: with SMTP id o5-v6mr23020800pfa.85.1542643143701; Mon, 19 Nov 2018 07:59:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542643143; cv=none; d=google.com; s=arc-20160816; b=feVVLaa1xhwHPuVwNbSy1BPY6TWjPP8NuiSoDilJgNfC4snj08nIGNfdmWxJunVs0Q ByJUnoj336GeDJw6CfV5D0Ky5ULTd76Pkvv06PB3T0wwWKjtWq6qDYVYYKelUz8sXPSc QAX8v5L/ZXjFZLhHt7IBcjrw/jYPTDOIssRecIGPii+5JZ1OmsGz8Hw8/itZR2Su988P xUjyCPvXETNMon/K6fnSjMRO6RWI393nX+6ZqWEp16GvCUnDHjbAG88Q/M8dzTf0ddPq NThGYtakU5rZL15F7PmAVsXSpjhlw1wNVPu84kF+M5HdZa3vqxqjJ1x2ynARQNE+kK0q iEjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=gKVycHfx9VTyJfwD26xokE+/t85CmcDhT6zn9T7WMW8=; b=pJBhfGoHDjN7+jyS/Sctd4MK2vpGXiDYudPQ6NgVlpaJgOYpVwbVVnUcZk4Eph6xXg 3oRy6T6+kg8b98w75fmK6whyiNIIysWHOlJtXW5y3HHBvxeTeK3dTG/sq8DSWPgVZOK6 aGf4Gu16tzlQ0ylHXqMOV1BanS/Nz8DSL9k7crU16yS/LxFrQKuZtXw2Q4PPq/TaFX4g 19GNUZMLtDJF5i6teFBnvQa4rqopnH6L76etbG0yzux/CpaWpYiZqx5S0iAGW7+53tJk XFgESg7Jtnlxo1mwBgyHf0RB1cRIczenNH90EByvUNNzLEjcjXgUJQKFq0ZIpwTfrkvV lBFQ== 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 a18si39715717pgj.77.2018.11.19.07.58.49; Mon, 19 Nov 2018 07:59:03 -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 S1729935AbeKTCVu (ORCPT + 99 others); Mon, 19 Nov 2018 21:21:50 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:38821 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729825AbeKTCVu (ORCPT ); Mon, 19 Nov 2018 21:21:50 -0500 Received: by mail-qk1-f196.google.com with SMTP id d19so49326542qkg.5; Mon, 19 Nov 2018 07:57:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gKVycHfx9VTyJfwD26xokE+/t85CmcDhT6zn9T7WMW8=; b=YKQMNoRNTo1dZBOjYeC3fB4S7a0QTaNViDStennrWoiPPsGK1oKx8a06Z0GygejPwF VhOJi9v1uI7ygdjPLaDVEk3zhebWcuGBzXLui6SiUNa/G5uIfIZ6XwGgZcOQz0Yz54hd fh1f5mgqYtfMDlbzqvARS3cXhkf/Kw/XzFKh7uu5aCxJpL430nzvJBEzQqHrgm1HqiNC 5SIbEtptk0/7t6TzNdFyL/TLtF17IFK2SeiHWkwbTdbUjSY2+w90ChHQflvx3HhKteRY UlLQB7CzV0cPpndZIwH2u5nMiuSEGhedQ8L7+4KPHvee3DtmLyVvtjsKDj1p9JK8jXhR Yc2w== X-Gm-Message-State: AGRZ1gK+/D69YI593GapyPzolFYlmT1HyS5mJe+cnd4gJD/aepNRKcpa TayaWN3MtOknkXq1QgnzWMsA/MAjy5FCnxQKkHo= X-Received: by 2002:ae9:d8c2:: with SMTP id u185mr19976776qkf.107.1542643069437; Mon, 19 Nov 2018 07:57:49 -0800 (PST) MIME-Version: 1.0 References: <1542262461-29024-1-git-send-email-firoz.khan@linaro.org> <1542262461-29024-3-git-send-email-firoz.khan@linaro.org> In-Reply-To: <1542262461-29024-3-git-send-email-firoz.khan@linaro.org> From: Arnd Bergmann Date: Mon, 19 Nov 2018 16:57:32 +0100 Message-ID: Subject: Re: [PATCH v2 2/5] mips: add +1 to __NR_syscalls in uapi header To: Firoz Khan Cc: Ralf Baechle , Paul Burton , James Hogan , "open list:RALINK MIPS ARCHITECTURE" , Thomas Gleixner , gregkh , Philippe Ombredanne , Kate Stewart , y2038 Mailman List , Linux Kernel Mailing List , linux-arch , Deepa Dinamani , Marcin Juszkiewicz Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 15, 2018 at 7:15 AM Firoz Khan wrote: > > All other architectures are hold a value for __NR_syscalls will > be equal to the last system call number +1. > > But in mips architecture, __NR_syscalls hold the value equal to > total number of system exits in the architecture. One of the > patch in this patch series will genarate uapi header files. > > In order to make the implementation common across all architect- > ures, add +1 to __NR_syscalls, which will be equal to the last > system call number +1. > > Signed-off-by: Firoz Khan The patch looks correct to me, and is a nice cleanup, but I found a couple of things remaining that could be done slightly better. > diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h > index c68b8ae..16f21c3 100644 > --- a/arch/mips/include/asm/unistd.h > +++ b/arch/mips/include/asm/unistd.h > @@ -15,11 +15,11 @@ > #include > > #ifdef CONFIG_MIPS32_N32 > -#define NR_syscalls (__NR_N32_Linux + __NR_N32_Linux_syscalls) > +#define NR_syscalls (__NR_N32_Linux + __NR_N32_Linux_syscalls - 1) > #elif defined(CONFIG_64BIT) > -#define NR_syscalls (__NR_64_Linux + __NR_64_Linux_syscalls) > +#define NR_syscalls (__NR_64_Linux + __NR_64_Linux_syscalls - 1) > #else > -#define NR_syscalls (__NR_O32_Linux + __NR_O32_Linux_syscalls) > +#define NR_syscalls (__NR_O32_Linux + __NR_O32_Linux_syscalls - 1) > #endif I suppose these can simply get removed, there are no users of NR_syscalls in MIPS kernels. > diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c > index 7f3dfdb..add4301 100644 > --- a/arch/mips/kernel/ftrace.c > +++ b/arch/mips/kernel/ftrace.c > @@ -410,13 +410,13 @@ unsigned long __init arch_syscall_addr(int nr) > unsigned long __init arch_syscall_addr(int nr) > { > #ifdef CONFIG_MIPS32_N32 > - if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls) > + if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls - 1) > return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux]; > #endif > - if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls) > + if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls - 1) > return (unsigned long)sys_call_table[nr - __NR_64_Linux]; > #ifdef CONFIG_MIPS32_O32 > - if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls) > + if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls - 1) > return (unsigned long)sys32_call_table[nr - __NR_O32_Linux]; > #endif Here I would drop the '-1' and instead replace the '<=' with '<' for better readability > diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S > index 91d3c8c..a9b895f 100644 > --- a/arch/mips/kernel/scall32-o32.S > +++ b/arch/mips/kernel/scall32-o32.S > @@ -23,7 +23,7 @@ > #include > > /* Highest syscall used of any syscall flavour */ > -#define MAX_SYSCALL_NO __NR_O32_Linux + __NR_O32_Linux_syscalls > +#define MAX_SYSCALL_NO __NR_O32_Linux + __NR_O32_Linux_syscalls - 1 This is also unused as of commit 2957c9e61ee9 ("[MIPS] IRIX: Goodbye and thanks for all the fish"), eight years ago, so I'd remove this as well. I'd suggest doing one patch for the removal of the unused macros, and another patch for the other changes. Arnd