Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1134749pxj; Fri, 21 May 2021 07:15:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXAvJsxdc9NdsPiQ+5OvB1Ffphk73MAnYdaWd0mrgcJsxposnh7YoOnMuQJZhmbuGirH9N X-Received: by 2002:a05:6402:1d2c:: with SMTP id dh12mr8094727edb.237.1621606556149; Fri, 21 May 2021 07:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621606556; cv=none; d=google.com; s=arc-20160816; b=vljzYwZZJnkZJnDGk+RVF9EENVXVy9TZJKWzgq0aec5ydiWSrB4kdSCmi1ym/viGdJ cyTA9P20jxSP0hwJSXW6yOqB9gm+l+Vz21boz8R2c6Z46OuMrNf0fhGPXWz6E2VHihMK qhPZkdfKUAg8bbEPq/HEhGpo1n8tACwnJyuC3B/uEf9LDG0Bm5Zjl2CAhcvpmEzIqvJw DhqRp3WeHYYzVjTYLC0lpv6WVitRfbtUob5Xgfade86YOXAGTIJyYp6qA4f6S0ocTtaF 0sbecvLynCVPjJ9Zw7z2ZtYmI/NzZcjoOrKEJOJAAueVyCGaapVBeYzxZ53GIn0/d59k Jycg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=4T+Bh/8y2feu4NrjWo0ZdHchPF2ftVgdjY9wiO6M0Vs=; b=z+DqWeYeELpzapaKoytSIb4bKM8TfWFy2JIWOa/+Z5roiXftZHKr2WIZBdFMBh/Tvz M+w8RS2Wtf4B33mJOXvnM4XVlIyFq/yI9gJxGG0RloA1eFrSTRjnRs2iE2R8oXivMtAy 2UXNCO+HVuseMhijRty0ju+0IoLdAdaPU1XWjPjzz4eqHWmPFmWkYMNq5HbMHbJhU15z pP7wqo8e5ZA9uRFKdwJt1SkoewWypwlsJHDKdZZLAJUOJPdy460k/vxeykuTDhXGhfWj NkmDHcJ46dFLWGbSFEHkvBCfX1j6jG3pVQYnoZOVwASN8L9Dtu4QZ5BjUO20AU+XeW9d p/xA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si5023829edw.535.2021.05.21.07.15.25; Fri, 21 May 2021 07:15:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241252AbhETNwM (ORCPT + 99 others); Thu, 20 May 2021 09:52:12 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:46505 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241193AbhETNwH (ORCPT ); Thu, 20 May 2021 09:52:07 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4FmB2r0gBWz9sTj; Thu, 20 May 2021 15:50:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YkUNlopGdymH; Thu, 20 May 2021 15:50:44 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4FmB2m4ZnSz9sTN; Thu, 20 May 2021 15:50:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 776178B808; Thu, 20 May 2021 15:50:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id QyH_CX4cZUSU; Thu, 20 May 2021 15:50:40 +0200 (CEST) Received: from po15610vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.105]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 360E68B814; Thu, 20 May 2021 15:50:40 +0200 (CEST) Received: by po15610vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 2B85E64C40; Thu, 20 May 2021 13:50:40 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 03/12] powerpc/inst: Improve readability of get_user_instr() and friends To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , naveen.n.rao@linux.vnet.ibm.com, jniethe5@gmail.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 20 May 2021 13:50:40 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove unneeded line splits. And remove unneeded local variable initialisation. Signed-off-by: Christophe Leroy --- v2: Don't use get_op() for now as including asm/disassemble.h conflicts with drivers/staging/rtl8723bs/include/wifi.h --- arch/powerpc/include/asm/inst.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/inst.h b/arch/powerpc/include/asm/inst.h index 57c31e712e67..fc6adef528a5 100644 --- a/arch/powerpc/include/asm/inst.h +++ b/arch/powerpc/include/asm/inst.h @@ -8,7 +8,7 @@ #define ___get_user_instr(gu_op, dest, ptr) \ ({ \ - long __gui_ret = 0; \ + long __gui_ret; \ unsigned int __user *__gui_ptr = (unsigned int __user *)ptr; \ struct ppc_inst __gui_inst; \ unsigned int __prefix, __suffix; \ @@ -18,8 +18,7 @@ if (__gui_ret == 0) { \ if ((__prefix >> 26) == OP_PREFIX) { \ __gui_ret = gu_op(__suffix, __gui_ptr + 1); \ - __gui_inst = ppc_inst_prefix(__prefix, \ - __suffix); \ + __gui_inst = ppc_inst_prefix(__prefix, __suffix); \ } else { \ __gui_inst = ppc_inst(__prefix); \ } \ @@ -36,11 +35,9 @@ }) #endif /* CONFIG_PPC64 */ -#define get_user_instr(x, ptr) \ - ___get_user_instr(get_user, x, ptr) +#define get_user_instr(x, ptr) ___get_user_instr(get_user, x, ptr) -#define __get_user_instr(x, ptr) \ - ___get_user_instr(__get_user, x, ptr) +#define __get_user_instr(x, ptr) ___get_user_instr(__get_user, x, ptr) /* * Instruction data type for POWER @@ -75,13 +72,12 @@ static inline u32 ppc_inst_suffix(struct ppc_inst x) static inline bool ppc_inst_prefixed(struct ppc_inst x) { - return (ppc_inst_primary_opcode(x) == 1) && ppc_inst_suffix(x) != 0xff; + return ppc_inst_primary_opcode(x) == OP_PREFIX && ppc_inst_suffix(x) != 0xff; } static inline struct ppc_inst ppc_inst_swab(struct ppc_inst x) { - return ppc_inst_prefix(swab32(ppc_inst_val(x)), - swab32(ppc_inst_suffix(x))); + return ppc_inst_prefix(swab32(ppc_inst_val(x)), swab32(ppc_inst_suffix(x))); } static inline struct ppc_inst ppc_inst_read(const struct ppc_inst *ptr) -- 2.25.0