Re: [PATCH] mt76: move mt76_rates in mt76 module

Felix Fietkau
2021-04-29T09:14:44Z

On 2021-04-29 10:32, Lorenzo Bianconi wrote:
> Move mt76_rates array in mt76 module and remove duplicated code since it
> is shared by all drivers
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> drivers/net/wireless/mediatek/mt76/mac80211.c | 16 +++++++++
> drivers/net/wireless/mediatek/mt76/mt76.h | 15 ++++++++
> .../net/wireless/mediatek/mt76/mt7603/init.c | 13 -------
> .../net/wireless/mediatek/mt76/mt7615/init.c | 33 ++---------------
> .../wireless/mediatek/mt76/mt7615/pci_init.c | 4 +--
> .../wireless/mediatek/mt76/mt7615/usb_sdio.c | 4 +--
> .../net/wireless/mediatek/mt76/mt76x02_util.c | 16 +++------
> .../net/wireless/mediatek/mt76/mt7915/init.c | 36 +++----------------
> .../net/wireless/mediatek/mt76/mt7921/init.c | 32 ++---------------
> 9 files changed, 48 insertions(+), 121 deletions(-)
>
> index e1b2cfa56074..b46097ea334a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
> @@ -304,19 +304,6 @@ mt7603_init_hardware(struct mt7603_dev *dev)
> return 0;
> }
>
> -#define CCK_RATE(_idx, _rate) { \
> - .bitrate = _rate, \
> - .flags = IEEE80211_RATE_SHORT_PREAMBLE, \
> - .hw_value = (MT_PHY_TYPE_CCK << 8) | (_idx), \
> - .hw_value_short = (MT_PHY_TYPE_CCK << 8) | (4 + _idx), \
> -}
> -
> -#define OFDM_RATE(_idx, _rate) { \
> - .bitrate = _rate, \
> - .hw_value = (MT_PHY_TYPE_OFDM << 8) | (_idx), \
> - .hw_value_short = (MT_PHY_TYPE_OFDM << 8) | (_idx), \
> -}
> -
> static struct ieee80211_rate mt7603_rates[] = {
> CCK_RATE(0, 10),
> CCK_RATE(1, 20),
I think you can drop mt7603_rates as well and replace it with
mt76_rates. The rest looks good to me.

- Felix