> -----Original Message----- > From: Kalle Valo <kvalo@xxxxxxxxxx> > Sent: Saturday, August 13, 2022 12:10 AM > To: linux-wireless@xxxxxxxxxxxxxxx > Cc: ath12k@xxxxxxxxxxxxxxxxxxx > Subject: [PATCH 31/50] wifi: ath12k: add mac.c > > From: Kalle Valo <quic_kvalo@xxxxxxxxxxx> > > (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@xxxxxxxxxxx> > --- > 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