Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: Julia Lawall <Julia.Lawall@inria.fr>,
	netdev@vger.kernel.org, Sasha Neftin <sasha.neftin@intel.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Marcin Szycik <marcin.szycik@linux.intel.com>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 08/13] igc: field prep conversion
Date: Tue, 21 Nov 2023 13:19:16 -0800	[thread overview]
Message-ID: <20231121211921.19834-9-jesse.brandeburg@intel.com> (raw)
In-Reply-To: <20231121211921.19834-1-jesse.brandeburg@intel.com>

Refactor igc driver to use FIELD_PREP(), 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.

@prep@
constant shift,mask;
expression a;
@@
-((a << shift) & mask)
+FIELD_PREP(mask, a)

Cc: Julia Lawall <Julia.Lawall@inria.fr>
Cc: Sasha Neftin <sasha.neftin@intel.com>
Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 61db1d3bfa0b..d949289a3ddb 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -3452,8 +3452,8 @@ static int igc_write_flex_filter_ll(struct igc_adapter *adapter,
 
 	/* Configure filter */
 	queuing = input->length & IGC_FHFT_LENGTH_MASK;
-	queuing |= (input->rx_queue << IGC_FHFT_QUEUE_SHIFT) & IGC_FHFT_QUEUE_MASK;
-	queuing |= (input->prio << IGC_FHFT_PRIO_SHIFT) & IGC_FHFT_PRIO_MASK;
+	queuing |= FIELD_PREP(IGC_FHFT_QUEUE_MASK, input->rx_queue);
+	queuing |= FIELD_PREP(IGC_FHFT_PRIO_MASK, input->prio);
 
 	if (input->immediate_irq)
 		queuing |= IGC_FHFT_IMM_INT;
-- 
2.39.3

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

  parent reply	other threads:[~2023-11-21 21:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 21:19 [Intel-wired-lan] [PATCH iwl-next v1 00/13] intel: use FIELD_PREP and FIELD_GET Jesse Brandeburg
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 01/13] e1000e: make lost bits explicit Jesse Brandeburg
2023-11-24 10:59   ` Simon Horman
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 02/13] intel: add bit macro includes where needed Jesse Brandeburg
2023-11-24 10:59   ` Simon Horman
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 03/13] intel: legacy: field prep conversion Jesse Brandeburg
2023-11-24 10:59   ` Simon Horman
2023-12-05  6:15   ` Pucha, HimasekharX Reddy
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 04/13] i40e: " Jesse Brandeburg
2023-11-24 11:00   ` Simon Horman
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 05/13] iavf: " Jesse Brandeburg
2023-11-24 11:00   ` Simon Horman
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 06/13] ice: " Jesse Brandeburg
2023-11-24 11:00   ` Simon Horman
2023-12-05  6:29   ` Pucha, HimasekharX Reddy
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 07/13] ice: fix pre-shifted bit usage Jesse Brandeburg
2023-11-24 11:00   ` Simon Horman
2023-11-21 21:19 ` Jesse Brandeburg [this message]
2023-11-24 11:01   ` [Intel-wired-lan] [PATCH iwl-next v1 08/13] igc: field prep conversion Simon Horman
2023-12-05 11:16   ` naamax.meir
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 09/13] intel: legacy: field get conversion Jesse Brandeburg
2023-11-24 11:01   ` Simon Horman
2023-12-05  6:33   ` Pucha, HimasekharX Reddy
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 10/13] igc: " Jesse Brandeburg
2023-11-24 11:01   ` Simon Horman
2023-12-06  8:22   ` naamax.meir
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 11/13] i40e: " Jesse Brandeburg
2023-11-24 11:02   ` Simon Horman
2023-11-27  8:38   ` Loktionov, Aleksandr
2023-12-05  6:38   ` Pucha, HimasekharX Reddy
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 12/13] iavf: " Jesse Brandeburg
2023-11-24 11:02   ` Simon Horman
2023-11-21 21:19 ` [Intel-wired-lan] [PATCH iwl-next v1 13/13] ice: " Jesse Brandeburg
2023-11-24 11:03   ` Simon Horman
2023-11-29 22:31     ` Jesse Brandeburg
2023-11-30 16:26       ` Simon Horman
2023-12-05  6:41   ` Pucha, HimasekharX Reddy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231121211921.19834-9-jesse.brandeburg@intel.com \
    --to=jesse.brandeburg@intel.com \
    --cc=Julia.Lawall@inria.fr \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=marcin.szycik@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sasha.neftin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox