diff mbox series

[08/26] mt76: move mt76x2_wait_for_bbp in mt76x02-lib module

Message ID abcc5b975da9d834067c45420397db4e3ff11e3b.1538036134.git.lorenzo.bianconi@redhat.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series add mt76x0e hw initialization support | expand

Commit Message

Lorenzo Bianconi Sept. 27, 2018, 9:01 a.m. UTC
Move mt76x2_wait_for_bbp utility routine in mt76x02_util.h
in order to be resued by mt76x0 driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 7 +++++++
 drivers/net/wireless/mediatek/mt76/mt76x2.h       | 7 -------
 drivers/net/wireless/mediatek/mt76/mt76x2u_init.c | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

Comments

Stanislaw Gruszka Sept. 27, 2018, 10:10 a.m. UTC | #1
On Thu, Sep 27, 2018 at 11:01:37AM +0200, Lorenzo Bianconi wrote:
> Move mt76x2_wait_for_bbp utility routine in mt76x02_util.h
> in order to be resued by mt76x0 driver
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
> +static inline bool mt76x02_wait_for_bbp(struct mt76_dev *dev)
> +{
> +	return __mt76_poll_msec(dev, MT_MAC_STATUS,
> +				MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
> +				0, 100);
> +}

I think this should be renamed to 

mt76x02_wait_for_txrx_busy()

or similar name, to avoid confusion and should be also used
in mt76x0 to replace:

        if (!mt76_poll_msec(dev, MT_MAC_STATUS,
                            MT_MAC_STATUS_TX | MT_MAC_STATUS_RX, 0, 1000))


Regards
Stanislaw
Lorenzo Bianconi Sept. 27, 2018, 3:15 p.m. UTC | #2
On Sep 27, Stanislaw Gruszka wrote:
> On Thu, Sep 27, 2018 at 11:01:37AM +0200, Lorenzo Bianconi wrote:
> > Move mt76x2_wait_for_bbp utility routine in mt76x02_util.h
> > in order to be resued by mt76x0 driver
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> > ---
> > +static inline bool mt76x02_wait_for_bbp(struct mt76_dev *dev)
> > +{
> > +	return __mt76_poll_msec(dev, MT_MAC_STATUS,
> > +				MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
> > +				0, 100);
> > +}
> 
> I think this should be renamed to 
> 
> mt76x02_wait_for_txrx_busy()
> 
> or similar name, to avoid confusion and should be also used
> in mt76x0 to replace:
> 
>         if (!mt76_poll_msec(dev, MT_MAC_STATUS,
>                             MT_MAC_STATUS_TX | MT_MAC_STATUS_RX, 0, 1000))

ok, will do in v2

Regards,
Lorenzo


> 
> 
> Regards
> Stanislaw
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
index 479e7ffcc951..7ea77db99c01 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
@@ -66,4 +66,11 @@  static inline void mt76x02_irq_disable(struct mt76_dev *dev, u32 mask)
 	mt76x02_set_irq_mask(dev, mask, 0);
 }
 
+static inline bool mt76x02_wait_for_bbp(struct mt76_dev *dev)
+{
+	return __mt76_poll_msec(dev, MT_MAC_STATUS,
+				MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
+				0, 100);
+}
+
 #endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2.h
index c51d6e2a64ce..9bf8be5ea1cd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2.h
@@ -124,13 +124,6 @@  static inline bool mt76x2_channel_silent(struct mt76x2_dev *dev)
 		chan->dfs_state != NL80211_DFS_AVAILABLE);
 }
 
-static inline bool mt76x2_wait_for_bbp(struct mt76x2_dev *dev)
-{
-	return mt76_poll_msec(dev, MT_MAC_STATUS,
-			      MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
-			      0, 100);
-}
-
 extern const struct ieee80211_ops mt76x2_ops;
 
 struct mt76x2_dev *mt76x2_alloc_device(struct device *pdev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2u_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2u_init.c
index 4eb3fe657bd2..57669c7999ce 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2u_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2u_init.c
@@ -209,7 +209,7 @@  int mt76x2u_init_hardware(struct mt76x2_dev *dev)
 
 	mt76x2u_init_beacon_offsets(dev);
 
-	if (!mt76x2_wait_for_bbp(dev))
+	if (!mt76x02_wait_for_bbp(&dev->mt76))
 		return -ETIMEDOUT;
 
 	/* reset wcid table */