diff mbox series

[v2,3/5] mt76: mt7663s: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx path

Message ID b65e861da1a54871c6358766edc81e2f3d9d8233.1624003282.git.lorenzo@kernel.org (mailing list archive)
State Accepted
Delegated to: Felix Fietkau
Headers show
Series mt7663s: enable runtime-pm support | expand

Commit Message

Lorenzo Bianconi June 18, 2021, 8:08 a.m. UTC
Similar to mt7663e, rely on mt76_connac_pm_ref/mt76_connac_pm_unref to
check PM state and increment/decrement wake counter

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7615/mac.c  | 14 ++++++++++----
 .../wireless/mediatek/mt76/mt7615/sdio_txrx.c    | 16 ++++++++++++----
 2 files changed, 22 insertions(+), 8 deletions(-)

Comments

kernel test robot June 18, 2021, 12:27 p.m. UTC | #1
Hi Lorenzo,

I love your patch! Yet something to improve:

[auto build test ERROR on wireless-drivers/master]
[also build test ERROR on v5.13-rc6 next-20210617]
[cannot apply to wireless-drivers-next/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/mt7663s-enable-runtime-pm-support/20210618-161033
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git master
config: arm-randconfig-r024-20210618 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/80a27acf098f3392d9b7392c1af5678aa154da72
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Lorenzo-Bianconi/mt7663s-enable-runtime-pm-support/20210618-161033
        git checkout 80a27acf098f3392d9b7392c1af5678aa154da72
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c:322:35: error: too many arguments to function call, expected single argument 'pm', have 2 arguments
           mt76_connac_pm_unref(&dev->mphy, &dev->pm);
           ~~~~~~~~~~~~~~~~~~~~             ^~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7615/../mt76_connac.h:119:1: note: 'mt76_connac_pm_unref' declared here
   mt76_connac_pm_unref(struct mt76_connac_pm *pm)
   ^
   1 error generated.


vim +/pm +322 drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c

   281	
   282	void mt7663s_txrx_worker(struct mt76_worker *w)
   283	{
   284		struct mt76_sdio *sdio = container_of(w, struct mt76_sdio,
   285						      txrx_worker);
   286		struct mt76_dev *mdev = container_of(sdio, struct mt76_dev, sdio);
   287		struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
   288		int i, nframes, ret;
   289	
   290		if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
   291			queue_work(mdev->wq, &dev->pm.wake_work);
   292			return;
   293		}
   294	
   295		/* disable interrupt */
   296		sdio_claim_host(sdio->func);
   297		sdio_writel(sdio->func, WHLPCR_INT_EN_CLR, MCR_WHLPCR, NULL);
   298	
   299		do {
   300			nframes = 0;
   301	
   302			/* tx */
   303			for (i = 0; i <= MT_TXQ_PSD; i++) {
   304				ret = mt7663s_tx_run_queue(mdev, mdev->phy.q_tx[i]);
   305				if (ret > 0)
   306					nframes += ret;
   307			}
   308			ret = mt7663s_tx_run_queue(mdev, mdev->q_mcu[MT_MCUQ_WM]);
   309			if (ret > 0)
   310				nframes += ret;
   311	
   312			/* rx */
   313			ret = mt7663s_rx_handler(mdev);
   314			if (ret > 0)
   315				nframes += ret;
   316		} while (nframes > 0);
   317	
   318		/* enable interrupt */
   319		sdio_writel(sdio->func, WHLPCR_INT_EN_SET, MCR_WHLPCR, NULL);
   320		sdio_release_host(sdio->func);
   321	
 > 322		mt76_connac_pm_unref(&dev->mphy, &dev->pm);
   323	}
   324	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index f540b6188ba1..c7d0b2e52d60 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -1904,12 +1904,18 @@  void mt7615_pm_wake_work(struct work_struct *work)
 	mphy = dev->phy.mt76;
 
 	if (!mt7615_mcu_set_drv_ctrl(dev)) {
+		struct mt76_dev *mdev = &dev->mt76;
 		int i;
 
-		mt76_for_each_q_rx(&dev->mt76, i)
-			napi_schedule(&dev->mt76.napi[i]);
-		mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
-		mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], false);
+		if (mt76_is_sdio(mdev)) {
+			mt76_worker_schedule(&mdev->sdio.txrx_worker);
+		} else {
+			mt76_for_each_q_rx(mdev, i)
+				napi_schedule(&mdev->napi[i]);
+			mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
+			mt76_queue_tx_cleanup(dev, mdev->q_mcu[MT_MCUQ_WM],
+					      false);
+		}
 		if (test_bit(MT76_STATE_RUNNING, &mphy->state))
 			ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
 						     MT7615_WATCHDOG_TIME);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
index 4393dd21ebbb..04f4c89b7499 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
@@ -283,9 +283,15 @@  void mt7663s_txrx_worker(struct mt76_worker *w)
 {
 	struct mt76_sdio *sdio = container_of(w, struct mt76_sdio,
 					      txrx_worker);
-	struct mt76_dev *dev = container_of(sdio, struct mt76_dev, sdio);
+	struct mt76_dev *mdev = container_of(sdio, struct mt76_dev, sdio);
+	struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
 	int i, nframes, ret;
 
+	if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
+		queue_work(mdev->wq, &dev->pm.wake_work);
+		return;
+	}
+
 	/* disable interrupt */
 	sdio_claim_host(sdio->func);
 	sdio_writel(sdio->func, WHLPCR_INT_EN_CLR, MCR_WHLPCR, NULL);
@@ -295,16 +301,16 @@  void mt7663s_txrx_worker(struct mt76_worker *w)
 
 		/* tx */
 		for (i = 0; i <= MT_TXQ_PSD; i++) {
-			ret = mt7663s_tx_run_queue(dev, dev->phy.q_tx[i]);
+			ret = mt7663s_tx_run_queue(mdev, mdev->phy.q_tx[i]);
 			if (ret > 0)
 				nframes += ret;
 		}
-		ret = mt7663s_tx_run_queue(dev, dev->q_mcu[MT_MCUQ_WM]);
+		ret = mt7663s_tx_run_queue(mdev, mdev->q_mcu[MT_MCUQ_WM]);
 		if (ret > 0)
 			nframes += ret;
 
 		/* rx */
-		ret = mt7663s_rx_handler(dev);
+		ret = mt7663s_rx_handler(mdev);
 		if (ret > 0)
 			nframes += ret;
 	} while (nframes > 0);
@@ -312,6 +318,8 @@  void mt7663s_txrx_worker(struct mt76_worker *w)
 	/* enable interrupt */
 	sdio_writel(sdio->func, WHLPCR_INT_EN_SET, MCR_WHLPCR, NULL);
 	sdio_release_host(sdio->func);
+
+	mt76_connac_pm_unref(&dev->mphy, &dev->pm);
 }
 
 void mt7663s_sdio_irq(struct sdio_func *func)