[PATCH 31/50] wifi: ath12k: add mac.c

Ping-Ke Shih
2022-08-15T06:09:40Z

> -----Original Message-----
> From: Kalle Valo <kvalo@kernel.org>
> Sent: Saturday, August 13, 2022 12:10 AM
> To: linux-wireless at vger.kernel.org
> Cc: ath12k at lists.infradead.org
> Subject: [PATCH 31/50] wifi: ath12k: add mac.c
>
> From: Kalle Valo <quic_kvalo@quicinc.com>
>
> (Patches split into one patch per file for easier review, but the final
> commit will be one big patch. See the cover letter for more info.)
>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
> ---
> drivers/net/wireless/ath/ath12k/mac.c | 7054 +++++++++++++++++++++++++++++++++
> 1 file changed, 7054 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> new file mode 100644
> index 000000000000..2ccbd83dc9ca
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -0,0 +1,7054 @@

[...]

> +
> +static int get_num_chains(u32 mask)
> +{
> + int num_chains = 0;
> +
> + while (mask) {
> + if (mask & BIT(0))
> + num_chains++;
> + mask >>= 1;
> + }
> +
> + return num_chains;
> +}

use hweight32()?

--
Ping-Ke