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 <julia.law...@inria.fr>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktio...@intel.com>
> Reviewed-by: Marcin Szycik <marcin.szy...@linux.intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeb...@intel.com>

Reviewed-by: Simon Horman <ho...@kernel.org>

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reply via email to