Chris Chiu <chiu@xxxxxxxxxxxx> writes: > On Wed, Oct 16, 2019 at 8:33 PM <yhchuang@xxxxxxxxxxx> wrote: >> >> From: Tzu-En Huang <tehuang@xxxxxxxxxxx> >> > >> + >> + band = hal->current_band_type; >> + if (band == RTW_BAND_2G) { >> + band = NL80211_BAND_2GHZ; >> + cfg_mask = mask->control[band].legacy; >> + } else if (band == RTW_BAND_5G) { >> + band = NL80211_BAND_5GHZ; >> + cfg_mask = mask->control[band].legacy << 4; >> + } >> + >> + if (!is_vht_enable) { >> + if (ra_mask & RA_MASK_HT_RATES_1SS) >> + cfg_mask |= mask->control[band].ht_mcs[0] << 12; >> + if (ra_mask & RA_MASK_HT_RATES_2SS) >> + cfg_mask |= mask->control[band].ht_mcs[1] << 20; >> + } else { >> + if (ra_mask & RA_MASK_VHT_RATES_1SS) >> + cfg_mask |= mask->control[band].vht_mcs[0] << 12; >> + if (ra_mask & RA_MASK_VHT_RATES_2SS) >> + cfg_mask |= mask->control[band].vht_mcs[1] << 22; >> + } >> + >> + ra_mask &= cfg_mask; >> + >> + return ra_mask; >> +} >> + > > I believe you can replace the 4, 12, 20, 22 with a more descriptive macro. Good point. GENMASK() and FIELD_PREP() are my favourites. Or maybe u64_encode_bits() is actually better than FIELD_PREP(), as cfg_mask is u64? -- https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches