[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 25 Dec 2023 09:36:22 +0000
From: Simon Horman <horms@...nel.org>
To: Jesse Brandeburg <jesse.brandeburg@...el.com>
Cc: intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
aleksander.lobakin@...el.com, przemyslaw.kitszel@...el.com,
marcin.szycik@...ux.intel.com
Subject: Re: [PATCH iwl-next v2 15/15] idpf: refactor some missing field
get/prep conversions
On Tue, Dec 05, 2023 at 05:01:14PM -0800, Jesse Brandeburg wrote:
> Most of idpf correctly uses FIELD_GET and FIELD_PREP, but a couple spots
> were missed so fix those.
>
> Automated conversion with coccinelle script and manually fixed up,
> including audits for opportunities to convert to {get,encode,replace}
> bits functions.
>
> Add conversions to le16_get/encode/replace_bits where appropriate. And
> in one place fix up a cast from a u16 to a u16.
>
> @prep2@
> constant shift,mask;
> type T;
> expression a;
> @@
> -(((T)(a) << shift) & mask)
> +FIELD_PREP(mask, a)
>
> @prep@
> constant shift,mask;
> type T;
> expression a;
> @@
> -((T)((a) << shift) & mask)
> +FIELD_PREP(mask, a)
>
> @get@
> constant shift,mask;
> 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: Alexander Lobakin <aleksander.lobakin@...el.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@...el.com>
Reviewed-by: Simon Horman <horms@...nel.org>
Powered by blists - more mailing lists