> -----Original Message----- > From: Intel-wired-lan <[email protected]> On Behalf Of Jesse > Brandeburg > Sent: Wednesday, November 22, 2023 2:49 AM > To: [email protected] > Cc: Julia Lawall <[email protected]>; [email protected]; Marcin > Szycik <[email protected]>; Brandeburg, Jesse > <[email protected]>; Loktionov, Aleksandr > <[email protected]> > Subject: [Intel-wired-lan] [PATCH iwl-next v1 11/13] i40e: field get > conversion > > 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 <[email protected]> > Reviewed-by: Aleksandr Loktionov <[email protected]> > Reviewed-by: Marcin Szycik <[email protected]> > Signed-off-by: Jesse Brandeburg <[email protected]> > --- > drivers/net/ethernet/intel/i40e/i40e_common.c | 56 +++---- > drivers/net/ethernet/intel/i40e/i40e_dcb.c | 158 +++++++----------- > drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c | 3 +- > drivers/net/ethernet/intel/i40e/i40e_ddp.c | 4 +- > .../net/ethernet/intel/i40e/i40e_ethtool.c | 7 +- > drivers/net/ethernet/intel/i40e/i40e_main.c | 73 ++++---- > drivers/net/ethernet/intel/i40e/i40e_nvm.c | 13 +- > drivers/net/ethernet/intel/i40e/i40e_ptp.c | 4 +- > drivers/net/ethernet/intel/i40e/i40e_txrx.c | 29 ++-- > .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 19 +-- > drivers/net/ethernet/intel/i40e/i40e_xsk.c | 3 +- > 11 files changed, 144 insertions(+), 225 deletions(-) >
Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
