On 11/21/2023 23:19, Jesse Brandeburg wrote:
Refactor the igc 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 in a later patch.

@get@
constant shift,mask;
expression a;
@@
-((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: Marcin Szycik <marcin.szy...@linux.intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeb...@intel.com>
---
  drivers/net/ethernet/intel/igc/igc_base.c | 6 ++----
  drivers/net/ethernet/intel/igc/igc_i225.c | 5 ++---
  drivers/net/ethernet/intel/igc/igc_main.c | 6 ++----
  drivers/net/ethernet/intel/igc/igc_phy.c  | 4 ++--
  4 files changed, 8 insertions(+), 13 deletions(-)

Tested-by: Naama Meir <naamax.m...@linux.intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reply via email to