diff mbox series

[3/5] mt76x2u: use common mt76x02_add_interface

Message ID 1541758814-2046-4-git-send-email-sgruszka@redhat.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series mt76x02: bssid setup corrections for STA | expand

Commit Message

Stanislaw Gruszka Nov. 9, 2018, 10:20 a.m. UTC
There is no need anymore to use custom add interface function
for mt76x02u.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x02.h         |  2 --
 drivers/net/wireless/mediatek/mt76/mt76x02_util.c    |  6 +++---
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | 12 +-----------
 3 files changed, 4 insertions(+), 16 deletions(-)

Comments

Lorenzo Bianconi Nov. 9, 2018, 11:18 a.m. UTC | #1
> There is no need anymore to use custom add interface function
> for mt76x02u.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt76x02.h         |  2 --
>  drivers/net/wireless/mediatek/mt76/mt76x02_util.c    |  6 +++---
>  drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | 12 +-----------
>  3 files changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
> index a8c5fdd903b9..f8e998ef8716 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
> @@ -115,8 +115,6 @@ int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  		      struct ieee80211_sta *sta);
>  
> -void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
> -		      unsigned int idx);
>  int mt76x02_add_interface(struct ieee80211_hw *hw,
>  			 struct ieee80211_vif *vif);
>  void mt76x02_remove_interface(struct ieee80211_hw *hw,
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> index 2aa3f4b15fd9..dbf9d89dd328 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> @@ -228,8 +228,9 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  }
>  EXPORT_SYMBOL_GPL(mt76x02_sta_remove);
>  
> -void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
> -		      unsigned int idx)
> +static void
> +mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
> +		 unsigned int idx)
>  {
>  	struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
>  
> @@ -238,7 +239,6 @@ void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
>  	mvif->group_wcid.hw_key_idx = -1;
>  	mt76x02_txq_init(dev, vif->txq);
>  }
> -EXPORT_SYMBOL_GPL(mt76x02_vif_init);
>  
>  int
>  mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
> index 977e74091a27..6b51dd749491 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
> @@ -46,16 +46,6 @@ static void mt76x2u_stop(struct ieee80211_hw *hw)
>  	mutex_unlock(&dev->mt76.mutex);
>  }
>  
> -static int mt76x2u_add_interface(struct ieee80211_hw *hw,
> -				 struct ieee80211_vif *vif)
> -{
> -	struct mt76x02_dev *dev = hw->priv;
> -	unsigned int idx = 8;
> -
> -	mt76x02_vif_init(dev, vif, idx);
> -	return 0;
> -}

This routines seems wrong since here we should have the possibility to change
the device mac address:
https://github.com/nbd168/wireless/blob/mt76/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c#L54

and IIRC I have not removed it in:
https://patchwork.kernel.org/patch/10670853/

Regards,
Lorenzo

> -
>  static int
>  mt76x2u_set_channel(struct mt76x02_dev *dev,
>  		    struct cfg80211_chan_def *chandef)
> @@ -122,7 +112,7 @@ static int mt76x2u_add_interface(struct ieee80211_hw *hw,
>  	.tx = mt76x02_tx,
>  	.start = mt76x2u_start,
>  	.stop = mt76x2u_stop,
> -	.add_interface = mt76x2u_add_interface,
> +	.add_interface = mt76x02_add_interface,
>  	.remove_interface = mt76x02_remove_interface,
>  	.sta_add = mt76x02_sta_add,
>  	.sta_remove = mt76x02_sta_remove,
> -- 
> 1.9.3
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index a8c5fdd903b9..f8e998ef8716 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -115,8 +115,6 @@  int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		      struct ieee80211_sta *sta);
 
-void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
-		      unsigned int idx);
 int mt76x02_add_interface(struct ieee80211_hw *hw,
 			 struct ieee80211_vif *vif);
 void mt76x02_remove_interface(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 2aa3f4b15fd9..dbf9d89dd328 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -228,8 +228,9 @@  int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(mt76x02_sta_remove);
 
-void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
-		      unsigned int idx)
+static void
+mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
+		 unsigned int idx)
 {
 	struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
 
@@ -238,7 +239,6 @@  void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
 	mvif->group_wcid.hw_key_idx = -1;
 	mt76x02_txq_init(dev, vif->txq);
 }
-EXPORT_SYMBOL_GPL(mt76x02_vif_init);
 
 int
 mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 977e74091a27..6b51dd749491 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -46,16 +46,6 @@  static void mt76x2u_stop(struct ieee80211_hw *hw)
 	mutex_unlock(&dev->mt76.mutex);
 }
 
-static int mt76x2u_add_interface(struct ieee80211_hw *hw,
-				 struct ieee80211_vif *vif)
-{
-	struct mt76x02_dev *dev = hw->priv;
-	unsigned int idx = 8;
-
-	mt76x02_vif_init(dev, vif, idx);
-	return 0;
-}
-
 static int
 mt76x2u_set_channel(struct mt76x02_dev *dev,
 		    struct cfg80211_chan_def *chandef)
@@ -122,7 +112,7 @@  static int mt76x2u_add_interface(struct ieee80211_hw *hw,
 	.tx = mt76x02_tx,
 	.start = mt76x2u_start,
 	.stop = mt76x2u_stop,
-	.add_interface = mt76x2u_add_interface,
+	.add_interface = mt76x02_add_interface,
 	.remove_interface = mt76x02_remove_interface,
 	.sta_add = mt76x02_sta_add,
 	.sta_remove = mt76x02_sta_remove,