Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp684046imm; Fri, 12 Oct 2018 05:10:17 -0700 (PDT) X-Google-Smtp-Source: ACcGV63V4t6SwTPigR3v5Id4rbEjVjdpY1Gt193zWc+9xnW3+S8XAanYneOdIY8HjcB/uwiazZ33 X-Received: by 2002:a62:cd45:: with SMTP id o66-v6mr5827764pfg.12.1539346217222; Fri, 12 Oct 2018 05:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539346217; cv=none; d=google.com; s=arc-20160816; b=sFehaqXjiF7GniFZzK3XfeV4VqPBNpxVxrnoo+xWIQtuHU57PAAOXgdQp9Cq3QlJzs P9YZ7IVlGmdJYHpK/uBFwFXf9TeKfzWEvxCD7Kt1Kpn+jyRIDXYIEguyKkfTozMWkgZX 6WNnpV90ncShMIg2IFjuV1P/pWSGz3svchcwC9IPzXI11Q0y9XHLeFYsSAy4dhfhZ7uB DSXS2AqtFA+W0ZdRnnlRISEk94PCSPNRS9brPxExL7GOr4iHY3aWuVctJye2n0yRGwe0 ytPzdRWs0riQd5TqgKbd5sMZ1bWgUihKLWFxK2Ua2iC/9NikMBGRC0rKB+tPkjbostfQ 3ftg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=otWaIsZ6nLE6/XE9GHB0qpPTFBA5iJocyIOp1wHO+7s=; b=ohsT6vDrroj8DIDj13kgrrNX89Y341HsBCkf6edoE+K3ueX7UTjD1wpTEBxPOc6EE5 wiy8Y9EjsOU9F0/QLN2QuadUji8ikv7xR3cuSazthZAAgHi6whkmW9adGhds7IRfH0Uw e2T6TcoxbzwpWtzlJQMlI3fo/r2wXWIXpbVx8YpepCuOma9kbilq3srduDuVyI+Yqw7J eUwce7jGM3GETP+YmZh+wLR/LJ2djRtsMKq/lW/bAqeqk0FU1uH30k1MwBZqhHYGeHnv OQkr2gJlg8JyHJwtWjhmbUMqZswybdIG6rJa6d/UAjGUTSAD4e6Hnzt8J3j2n8tMEb5e fD1w== 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 ca4-v6si1160514plb.406.2018.10.12.05.10.02; Fri, 12 Oct 2018 05:10:17 -0700 (PDT) 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 S1728531AbeJLTkA (ORCPT + 99 others); Fri, 12 Oct 2018 15:40:00 -0400 Received: from mail.sf-mail.de ([78.47.74.12]:37399 "EHLO mail.sf-mail.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728040AbeJLTkA (ORCPT ); Fri, 12 Oct 2018 15:40:00 -0400 Received: (qmail 6568 invoked from network); 12 Oct 2018 12:07:49 -0000 Received: from mail.sf-mail.de ([::ffff:78.47.74.12]:50458 HELO webmail.sf-mail.de) (auth=eike@sf-mail.de) by mail.sf-mail.de (Qsmtpd 0.34dev) with (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPSA for ; Fri, 12 Oct 2018 14:07:49 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 12 Oct 2018 14:07:47 +0200 From: Rolf Eike Beer To: Firoz Khan Cc: linux-parisc@vger.kernel.org, "James E . J . Bottomley" , Helge Deller , Thomas Gleixner , Greg Kroah-Hartman , Philippe Ombredanne , Kate Stewart , y2038@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, arnd@arndb.de, deepa.kernel@gmail.com, marcin.juszkiewicz@linaro.org, linux-parisc-owner@vger.kernel.org Subject: Re: [PATCH v4 3/6] parisc: add system call table generation support In-Reply-To: <1539337442-3676-4-git-send-email-firoz.khan@linaro.org> References: <1539337442-3676-1-git-send-email-firoz.khan@linaro.org> <1539337442-3676-4-git-send-email-firoz.khan@linaro.org> Message-ID: X-Sender: eike-kernel@sf-tec.de User-Agent: Roundcube Webmail/1.3.7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Firoz Khan wrote: > diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh > b/arch/parisc/kernel/syscalls/syscallhdr.sh > new file mode 100644 > index 0000000..607d4ca > --- /dev/null > +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh > @@ -0,0 +1,35 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +in="$1" > +out="$2" > +my_abis=`echo "($3)" | tr ',' '|'` Any reason not to use $() instead of backticks? > +prefix="$4" > +offset="$5" > + > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \ > + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ > + -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( > + echo "#ifndef ${fileguard}" > + echo "#define ${fileguard}" > + echo "" > + > + nxt=0 > + while read nr abi name entry compat ; do > + if [ -z "$offset" ]; then > + echo -e "#define __NR_${prefix}${name}\t$nr" This mixed indentation with both tabs and spaces is a bit messy. > + else > + echo -e "#define __NR_${prefix}${name}\t($offset + $nr)" > + fi > + nxt=$nr > + let nxt=nxt+1 Why do you use let here when you do $(()) calculations at other places? > + done > + > + echo "" > + echo "#ifdef __KERNEL__" > + echo -e "#define __NR_syscalls\t$nxt" > + echo "#endif" > + echo "" > + echo "#endif /* ${fileguard} */" > +) > "$out" > diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh > b/arch/parisc/kernel/syscalls/syscalltbl.sh > new file mode 100644 > index 0000000..04abde7 > --- /dev/null > +++ b/arch/parisc/kernel/syscalls/syscalltbl.sh > @@ -0,0 +1,46 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +in="$1" > +out="$2" > +my_abis=`echo "($3)" | tr ',' '|'` > +offset="$4" > + > +emit() { > + nxt="$1" > + if [ -z "$offset" ]; then > + nr="$2" > + else > + nr="$2" > + nr=$((nr+offset)) This could be one line, no? Or just set offset to 0 if it is empty and avoid that if alltogether. > + fi > + entry="$3" > + > + while [ $nxt -lt $nr ]; do > + echo "__SYSCALL($nxt, sys_ni_syscall, )" > + let nxt=nxt+1 > + done > + echo "__SYSCALL($nxt, $entry, )" > +} > + > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( > + if [ -z "$offset" ]; then > + nxt=0 > + else > + nxt=$offset > + fi Another argument for offset=0 as default. > + > + my_abi="$(cut -d'|' -f2 <<< $my_abis)" "<<<" is a bash extension and will not work with /bin/sh. > + while read nr abi name entry compat ; do > + if [ $my_abi = "compat" ]; then > + if [ -z "$compat" ]; then > + emit $nxt $nr $entry > + else > + emit $nxt $nr $compat > + fi > + else > + emit $nxt $nr $entry > + fi I would go for a local variable being set to $compat or $entry and calling emit at only one place. And there should be only one if with 2 expressions, no need for 3 branches. > + let nxt=nxt+1 Inconsistent indentation. > + done > +) > "$out" Eike