Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp467133rdb; Thu, 15 Feb 2024 05:56:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWbhoGbW/aL+b3bjnm4eJKgf3MP8AwAzH3TyH/zYHZ3siT4HdON3imOePaOS3VBuzleWwirMN93zkbBGR9WFVC3f0L11+YGwLrhvKl7/w== X-Google-Smtp-Source: AGHT+IG+yE8sPJ9l9aqmN6o0EfRK5M3VJTRwocu60QA0rzJXngb7tUIgc5gFJYmsjY7yl2+tjdAk X-Received: by 2002:a0d:d78e:0:b0:607:7aac:6707 with SMTP id z136-20020a0dd78e000000b006077aac6707mr1677236ywd.12.1708005408337; Thu, 15 Feb 2024 05:56:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708005408; cv=pass; d=google.com; s=arc-20160816; b=oMoyJhBPcpgioXoGaBh0EipJ8vFXKU5NEbNxQ3qnkYZluU7rimZivLfGGVxgJP5zGs LVGXm2jlrzKd+ckUUL+kILk0Cth7DFnCbD1tZ9bzDgdPtRWeJxmfz+Va3z0d73oF5AkP Lg2Lq/e2VQwl/82MuQtBgOjCZ1BtXvb5E09paAJceazAITiZtC9uHi+EauLQUBjS+xzC SuhMEHJGXo/qkx1UlV7wLfizr68CPUPunOkbWCp8lnBVLPTSqHq+SN4yUcd4i2azl1Pb XWbTPwrUnC4W0pVXVeD1Ay+mCe3pnABzXrEPuCOPL5E3qagwFmcUJs06MHJCAeDoxodF /cOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=QdW2zAZOXZJx9OVgQJRX7RanDMp4FAD+bdgCbt1KIkM=; fh=4TgEE5rEJN/hMel8PgR7ADidRIXBg0Y0qDiWpKivi8Y=; b=nGZNzQiZSoYmDMxBJnSxh8K87uiMrO8my2ry7SyGIEcE3qZtIvd19mNElPSYSUhcsh XLUZffDcZTldH6JA+/cYsb4WxE53llI28lsHH8f/cTL+mDvg8S0ZWyYHSl5ya0BsgIqf q4YUJddLN/gahJvZoFNzHiAaqxrDXQjAWSsoZZT+l4J7SOVpRk5qg3iz6bu/Nj3ZM7nl Wx2sa6eA5K/VMhsZx7XrKyO1S5C5MHA7zj33EzqDWfRSJvvk8zcrxWk7mhgwZe3jUEj7 EEet1I6vDRX9zlB1eJsmhxSYbidl5tBiEzUeSzbvUimjA0R/NNqDMPNRi7kZiTEycwfc 7VWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-67029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67029-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h17-20020a05620a401100b00785a70ff265si1609565qko.710.2024.02.15.05.56.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 05:56:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-67029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67029-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9251B1C242A7 for ; Thu, 15 Feb 2024 13:56:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB7D1131E30; Thu, 15 Feb 2024 13:54:57 +0000 (UTC) Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 289DE13175A for ; Thu, 15 Feb 2024 13:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708005297; cv=none; b=e1D3kft4CEKFKSjbXQdRLCBaQHLWb4Gt5y9NNu3Qhw1fFHOZItOAFuCWIJCyUYi4Ld5hGFA+vtZMga/wF05HXFJMikoHQHIde3uhUSfpXZ1DgQus7mkYdptEcHVifS/ISgJXckn9etmjebP5ZUyenPohY9oVT8UrDeXG4QtvWyc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708005297; c=relaxed/simple; bh=kjVeQ0gnpy2r4nY0LxRCwKtkhl3CJTCOJ3DRKNTKLYw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Rqv3PCpasAw4lYTYLJvY2g+zx3p3aNvm2A8T5wEuKwEPWhXj8YIV7vJCBb5WTJnhNtBDnAdkvXXT7NtwE/vF6AoRCrPE+cIu2SnOR58V3ttW1yJJDPDMByxZjbuDyLkmq+xa2JqPb2Xb3Tnhg3Pr+7lvV3THXiKm8ELkf4I8G5Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:ac52:3a54:2a84:d65a]) by andre.telenet-ops.be with bizsmtp id nRus2B00J0LVNSS01Rusre; Thu, 15 Feb 2024 14:54:53 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1racCL-000hBv-8e; Thu, 15 Feb 2024 14:54:52 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1racCS-00Hacm-JG; Thu, 15 Feb 2024 14:54:52 +0100 From: Geert Uytterhoeven To: Oleg Nesterov , Russell King , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] ARM: ptrace: Use bitfield helpers Date: Thu, 15 Feb 2024 14:54:48 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The isa_mode() macro extracts two fields, and recombines them into a single value. Make this more obvious by using the FIELD_GET() helper, and shifting the result into its final resting place. Signed-off-by: Geert Uytterhoeven --- No changes in generated assembler code. v2: - Drop irrelevant comment about non-existing off-by-one error, - Remove unnecessary parens. --- arch/arm/include/asm/ptrace.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h index 7f44e88d1f25bcc5..14a38cc67e0bc966 100644 --- a/arch/arm/include/asm/ptrace.h +++ b/arch/arm/include/asm/ptrace.h @@ -10,6 +10,7 @@ #include #ifndef __ASSEMBLY__ +#include #include struct pt_regs { @@ -35,8 +36,8 @@ struct svc_pt_regs { #ifndef CONFIG_CPU_V7M #define isa_mode(regs) \ - ((((regs)->ARM_cpsr & PSR_J_BIT) >> (__ffs(PSR_J_BIT) - 1)) | \ - (((regs)->ARM_cpsr & PSR_T_BIT) >> (__ffs(PSR_T_BIT)))) + (FIELD_GET(PSR_J_BIT, (regs)->ARM_cpsr) << 1 | \ + FIELD_GET(PSR_T_BIT, (regs)->ARM_cpsr)) #else #define isa_mode(regs) 1 /* Thumb */ #endif -- 2.34.1