> -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-boun...@osuosl.org> On Behalf Of Jesse > Brandeburg > Sent: Wednesday, November 22, 2023 2:49 AM > To: intel-wired-...@lists.osuosl.org > Cc: Julia Lawall <julia.law...@inria.fr>; net...@vger.kernel.org; Marcin > Szycik <marcin.szy...@linux.intel.com>; Brandeburg, Jesse > <jesse.brandeb...@intel.com>; Loktionov, Aleksandr > <aleksandr.loktio...@intel.com> > 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 <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> > --- > 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 <himasekharx.reddy.pu...@intel.com> (A Contingent worker at Intel) _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan