Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp616029rdb; Thu, 15 Feb 2024 09:51:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXfKvScZqOegU0sOeDIqDf+Lz4Um3Fu00qK8jdDlxwMsXP5BX+bE5/qrOEj1mtsZcU1A/15hGusyCh1OQxq+FtQuNROe0IvD+dSGlWOIw== X-Google-Smtp-Source: AGHT+IHTlWlp/xBGEyqCpNz7k+6y65G1WSgdVTCbnzbJcOFi1Twf+u39Sw5pE5XJPS98A5Og/mnd X-Received: by 2002:a05:6808:14cb:b0:3c1:3956:668b with SMTP id f11-20020a05680814cb00b003c13956668bmr1859463oiw.12.1708019515708; Thu, 15 Feb 2024 09:51:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708019515; cv=pass; d=google.com; s=arc-20160816; b=N+PetgSa84KeJtawd9NVzJjIIEKoSJODQz0oQHzinNCjosF5ydtyAlSoxEmFR+F4l8 qLV3hBJLgMKBQws1vQFQjFqLohzQbT3qFRkqDzMqM0nkzCpGxs8BVdzarsh6P1UsDsoh CT9aJSVJO5LixwnOLRHnys9GwgpBMDx3FLUHN8h3i54z7nJ6xgAnNrgiy8qoMR1OedQk i+0KyV9gQ0v2+h9atTTuZLOoTA4FdodRn7oG8NXn72IVfoM3X4Fp33GeRnm91eWyU9sh V0BlGVYE5Q8llIHTSOMdJnI0HV04ELDHsRdjfoobP8Ucxyp2z36GtnBoLV9p4XZ/rjD2 0s8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=GG6Ulxh+r2vwDrd1myPyHalaQeRg4IYOcP2tfu6yPes=; fh=T7SgnvKK8mpF2MMT0uZszcoKK1qJi1azuIKzE7G2AHE=; b=AYItyTJ1LTv58lp3Uhmrfxu2+l8577q3jZkDA4lnCrKxsHrrAXx4Hci7PVG8pCroGD PJyoVyIkl4pjTBqIvjojmJs0OM+BxfmuzQ1T0/z+IZKMMVU22CnjDz5CTvWsvl81htSL u0IfJChZRWYZyzhSwPZPoJhywwkyAILi5uZ9SwJw4wds4veIwDlC/1loNEieGKLXPFM9 F0ezA5141uJ9F/oA6HGTj+L4bt8gRqF+u7U+Yze6HO+wGQ3mpPp/2ErqnDdK38uUSf64 doCevWMNMNuDJ2v4UeeX/4aaF0C7tp5OLLacMb7O4s7K6uZoZu6OmKT1mBKHPxDPaGaS MEsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QQdQ1WMe; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-67443-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67443-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d7-20020ac851c7000000b0042c6bebc514si1722130qtn.776.2024.02.15.09.51.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 09:51:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67443-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QQdQ1WMe; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-67443-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67443-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 91BA41C219F4 for ; Thu, 15 Feb 2024 17:51:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC6F0137C3A; Thu, 15 Feb 2024 17:51:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QQdQ1WMe" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E2A613667D for ; Thu, 15 Feb 2024 17:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708019499; cv=none; b=QmSO+lLIeXwRV2AzAxFSIFyjIs8JLW0F2HYy7mkbTnbonwuTVSPAP35KsTywyEOeNWKCMDCs3NbBPaMogoC4QbBwUzfB28CMolhQYAhDHliDeqZ65hXyTuHZNVUFGBo5uPBxaIxbxoQGhnVm18gANE/PWzpo5AN6rfsdHh8ghns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708019499; c=relaxed/simple; bh=uWn7JPvg51SksgaZWGKJtP5oLBDREUXXipDxKopFiXY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BzNdezVq31HWnUKV8G8N4BQNSYknVZDO67itsfHwBusPqT0G85pRqIAVXZPEVULPHcAHLe92349yMui57YT8fvyrzcffBRXgqICzIiAVAzJ3pcBEjfY8AsEKYoIwxENUi6w4B3mTubp+oiAbOrklbY2jymCGw+AQVBasRSI4Qfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QQdQ1WMe; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708019496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GG6Ulxh+r2vwDrd1myPyHalaQeRg4IYOcP2tfu6yPes=; b=QQdQ1WMeJI9SPRyYPtGFFwhbi9gv5jn5FfjLj08+880+kHEyPJw7aLHyuq+zf9xSevcTcQ 5IazelkOpQviVjf/BDG0/bFJGlQcE2wrx/LSA8+uq+/g2pN6XcKfJWb4Y4UnqucOW7IcQl X9bNT7yx0wr6ppkRdf3Yos8J1IyoxlY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-WaAN2ccvO1q6c7KHKvc2Xg-1; Thu, 15 Feb 2024 12:51:32 -0500 X-MC-Unique: WaAN2ccvO1q6c7KHKvc2Xg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7C20185A780; Thu, 15 Feb 2024 17:51:31 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.56]) by smtp.corp.redhat.com (Postfix) with SMTP id 3AFE3492BC6; Thu, 15 Feb 2024 17:51:28 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 15 Feb 2024 18:50:14 +0100 (CET) Date: Thu, 15 Feb 2024 18:50:11 +0100 From: Oleg Nesterov To: Geert Uytterhoeven Cc: Russell King , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] ARM: ptrace: Use bitfield helpers Message-ID: <20240215174945.GA29299@redhat.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 Sorry for the noise, can't resist... I am replying only because I wasn't aware of bitfield.h and useful helpers there. Thank you ;) On 02/15, Geert Uytterhoeven wrote: > > #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)) Reviewed-by: Oleg Nesterov