From patchwork Sun Aug 12 12:57:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 10563649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BFDE1390 for ; Sun, 12 Aug 2018 13:00:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8267E29570 for ; Sun, 12 Aug 2018 13:00:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74BD72957A; Sun, 12 Aug 2018 13:00:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BEA4929570 for ; Sun, 12 Aug 2018 13:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=MDH5Ls9jdK2Wii26RKugUPQOaxGF72rwZ1NwrC4SjNA=; b=Yjm Oj4Dgw4xcHub2z88IiBJDBzBwDgbbVLuGaoIdIVwR9Rjgmnfr+ws5JwLTqFEwLHyoIcVEax65uA+M LOvph/ctyVTxEKJmWMIRufXzNsEtEmzXYwJYr3sYuzuJrBpjY1OjsWsekZjysqP1DGrEusoH1+QW+ jhjkxKVmJ9uEDD+5rlVWsZP9aWJy6O3uHHDuSwvgPMaVW35qjNd3cHhWt3PjYhREznZ22jYjVWbF/ eCXpIa4OEAbV4k3kgwSYkDChkCSM0tnTZT6mPC3oJCPwI/F1GI/maPXS0Z679neZALIH/mzq+Nu3D XIRXQUBMG8GRHY0xTDq+3B2TL+CVTuQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fopz6-0006yk-Gj; Sun, 12 Aug 2018 13:00:40 +0000 Received: from ozlabs.org ([203.11.71.1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fopz0-0005fX-5g for linux-arm-kernel@lists.infradead.org; Sun, 12 Aug 2018 13:00:37 +0000 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41pJnL1jGbz9s89; Sun, 12 Aug 2018 22:58:11 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1534078695; bh=/APs1eDgW+fU5PcDF9GfMaN4gd08S2CFliviNI1JDPM=; h=Date:From:To:Cc:Subject:From; b=fnZ72Ox2HiYG7IV6iPElfwcepPDggGKVcQ7ZnI/x6VWgICFvs1vNJ/Y7k9P7qb+wG JrY5n4iKXkJ/AOQTpFL/xJyeLrNtSFI1g+pFncboZKRsJM++B6B31iBbcziah0gX8/ PImFsyzckVze2XhJZfBspmNvyZpgZXw/lwFr0A0WJCdxTxV9lloO2Y3oDBlX9lbQ7i MrjT16gdrH/bZPV9D9Wqwowa0/DPTdkdLDXb3Cuarggdr9MKfU4Ghp7mQJ7OgdS5uQ xHokd3qzmBmINPr2b7Gx2S9ioqwHUAvqN+I08xWVdz4YHmOblCchirLc6mTrSEJkaD aQpcLmJxGTFZw== Date: Sun, 12 Aug 2018 22:57:42 +1000 From: Stephen Rothwell To: Russell King Subject: [PATCH] arm: simplify syscallnr.sh a bit Message-ID: <20180812225742.594c7705@canb.auug.org.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180812_060034_641647_443E4F90 X-CRM114-Status: UNSURE ( 9.10 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Al Viro , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP tested by comparing the output of /bin/sh ./arch/arm/tools/syscallnr.sh arch/arm/tools/syscall.tbl /tmp/xx.h common,oabi,eabi,compat Before and after this patch. Suggested-by: Al Viro Signed-off-by: Stephen Rothwell --- arch/arm/tools/syscallnr.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/arch/arm/tools/syscallnr.sh b/arch/arm/tools/syscallnr.sh index df3ccd0ca831..9c604697745e 100644 --- a/arch/arm/tools/syscallnr.sh +++ b/arch/arm/tools/syscallnr.sh @@ -9,26 +9,28 @@ fileguard=_ASM_ARM_`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 | tail -n1 | ( - echo "#ifndef ${fileguard} +nr=$(sed -n -E \ + 's/^([[:xdigit:]Xx]+)[[:space:]]+'"${my_abis}"'[[:space:]].*$/\1/p' "$in" | + sort -n | tail -n1) +nr=$(($nr + 1)) +while [ "$(($nr / (256 * $align) ))" -gt 0 ]; do + align=$(( $align * 4 )) +done +nr=$(( ($nr + $align - 1) & ~($align - 1) )) + +cat <"$out" +#ifndef ${fileguard} #define ${fileguard} 1 /* * This needs to be greater than __NR_last_syscall+1 in order to account * for the padding in the syscall table. */ -" - while read nr abi name entry; do - nr=$(($nr + 1)) - while [ "$(($nr / (256 * $align) ))" -gt 0 ]; do - align=$(( $align * 4 )) - done - nr=$(( ($nr + $align - 1) & ~($align - 1) )) - echo "/* aligned to $align */" - echo "#define __NR_syscalls $nr" - done +/* aligned to $align */ +#define __NR_syscalls $nr + +#endif /* ${fileguard} */ +EOF - echo "" - echo "#endif /* ${fileguard} */" -) > "$out" +exit 0