From patchwork Tue Nov 21 21:19:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 13463589 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fQQcevOv" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 020E6D50 for ; Tue, 21 Nov 2023 13:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700601584; x=1732137584; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OC03xYyoJPYBpU5DoEDlG43etSnZFhH3y1LKGe60NfU=; b=fQQcevOvG7FcTsJCKI1twbTVaZjHnsxZKSMnGm8ikJKl8kbZwI23kicb zIN6dACrjVuNNvgppfNAXZsJfvZbC5j2jpoI4bY/pyBfpqBPGHWKMKi/a bTz8y44uTtt7I4145vsG7F8rqNXIBsaNpCw6bVo2apGdnBfzvnOK5456z mBuE/42tCu/eXizYKGIWXb1Z/Uv6WYwqmKLB2JoQV9/Fr9SxhvuHCalGm MHTr0RO2i/W/XR6cF7yRVWIY96ZmWKR2iYUgc+Ry7nIQlSOfrn0UfiIEY UsbFIY3O+9JqH3fxKkiOZr3NOB09sOLh4VtXLg2LEqwvUhI+3/0/wYd2l w==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="423022090" X-IronPort-AV: E=Sophos;i="6.04,216,1695711600"; d="scan'208";a="423022090" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 13:19:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="716630553" X-IronPort-AV: E=Sophos;i="6.04,216,1695711600"; d="scan'208";a="716630553" Received: from jbrandeb-spr1.jf.intel.com ([10.166.28.233]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 13:19:38 -0800 From: Jesse Brandeburg To: intel-wired-lan@lists.osuosl.org Cc: Jesse Brandeburg , netdev@vger.kernel.org, Julia Lawall , Sasha Neftin , Marcin Szycik Subject: [PATCH iwl-next v1 08/13] igc: field prep conversion Date: Tue, 21 Nov 2023 13:19:16 -0800 Message-Id: <20231121211921.19834-9-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231121211921.19834-1-jesse.brandeburg@intel.com> References: <20231121211921.19834-1-jesse.brandeburg@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 Cc: Sasha Neftin Reviewed-by: Marcin Szycik Signed-off-by: Jesse Brandeburg Reviewed-by: Simon Horman Tested-by: Naama Meir --- 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;