On 2018-10-02 00:19, Lorenzo Bianconi wrote: > Move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid utility routines in > mt76x02-lib module since it will be used by mt76x0 driver in order to > unify rxwi parsing > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@xxxxxxxxxx> > --- > .../net/wireless/mediatek/mt76/mt76x02_util.c | 29 +++++++++++++++++ > .../net/wireless/mediatek/mt76/mt76x02_util.h | 3 ++ > .../net/wireless/mediatek/mt76/mt76x2/mac.c | 32 ++----------------- > 3 files changed, 34 insertions(+), 30 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c > index b12db0a108d3..496be05e59a6 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c > @@ -531,4 +531,33 @@ void mt76x02_set_beacon_offsets(struct mt76_dev *dev) > } > EXPORT_SYMBOL_GPL(mt76x02_set_beacon_offsets); > > +struct mt76x02_sta * > +mt76x02_rx_get_sta(struct mt76_dev *dev, u8 idx) > +{ > + struct mt76_wcid *wcid; > + > + if (idx >= ARRAY_SIZE(dev->wcid)) > + return NULL; > + > + wcid = rcu_dereference(dev->wcid[idx]); > + if (!wcid) > + return NULL; > + > + return container_of(wcid, struct mt76x02_sta, wcid); > +} > +EXPORT_SYMBOL_GPL(mt76x02_rx_get_sta); > + > +struct mt76_wcid * > +mt76x02_rx_get_sta_wcid(struct mt76x02_sta *sta, bool unicast) > +{ > + if (!sta) > + return NULL; > + > + if (unicast) > + return &sta->wcid; > + else > + return &sta->vif->group_wcid; > +} > +EXPORT_SYMBOL_GPL(mt76x02_rx_get_sta_wcid); Both of these functions are trivial and should be inline. - Felix