From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1FA918BED for ; Fri, 24 Nov 2023 11:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Xd57WlrC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F8F8C433C7; Fri, 24 Nov 2023 11:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700823731; bh=TAuekQvbUIp2kEg0QV2/67OHSWj/+A92G8o3FKcZjl4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xd57WlrC/NQSShYN73rii/vQvmF2T2EXZ2Y3G3MMxnBv64vDctYn5wm+Id0e1FC+A Qz+nvgEg09GvcoCoSfwaluYL3kUKv31ienO+tiszxqhKbQi5Bi0qDIaAn/UQf6CJ3f VXH+WvESKkeOjIyP++cY45AXIfG+t+xn/+IKJD0q6c/ego2sH0xptWVpL6yJG7ViQ5 95tcT/D+1TIcM9iUv8DMZMWP7Tbt4gGmTMBD9qaqbLRhuQ028ezwFuUs06jijDjJbE 4qf0eQKlvZP7XW4Oz75lfxN6Nzl9J4i+YAoCG3ddE+w+oGn1fRMZEx+q8Xvt7gMrlG GrJOXDkAPE22w== Date: Fri, 24 Nov 2023 11:02:07 +0000 From: Simon Horman To: Jesse Brandeburg Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Julia Lawall , Aleksandr Loktionov , Marcin Szycik Subject: Re: [PATCH iwl-next v1 11/13] i40e: field get conversion Message-ID: <20231124110207.GK50352@kernel.org> References: <20231121211921.19834-1-jesse.brandeburg@intel.com> <20231121211921.19834-12-jesse.brandeburg@intel.com> Precedence: bulk X-Mailing-List: netdev@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: <20231121211921.19834-12-jesse.brandeburg@intel.com> On Tue, Nov 21, 2023 at 01:19:19PM -0800, Jesse Brandeburg wrote: > Refactor the i40e driver to use FIELD_GET() for mask and shift reads, > which reduces lines of code and adds clarity of intent. > > This code was generated by the following coccinelle/spatch script and > then manually repaired. > > While making one of the conversions, an if() check was inverted to > return early and avoid un-necessary indentation of the remainder of the > function. In some other cases a stack variable was moved inside the > block where it was used while doing cleanups/review. > > @get@ > constant shift,mask; > metavariable type T; > expression a; > @@ > -(((T)(a) & mask) >> shift) > +FIELD_GET(mask, a) > > and applied via: > spatch --sp-file field_prep.cocci --in-place --dir \ > drivers/net/ethernet/intel/ > > Cc: Julia Lawall > Reviewed-by: Aleksandr Loktionov > Reviewed-by: Marcin Szycik > Signed-off-by: Jesse Brandeburg Reviewed-by: Simon Horman