diff mbox

[V2,2/4] net-next: mediatek: don't use intermediate variables to store IRQ masks

Message ID 1467200291-60106-3-git-send-email-john@phrozen.org (mailing list archive)
State New, archived
Headers show

Commit Message

John Crispin June 29, 2016, 11:38 a.m. UTC
The code currently uses variables to store and never modify the bit masks
of interrupts. This is legacy code from an early version of the driver
that supported MIPS based SoCs where the IRQ bits depended on the actual
SoC. As the bits are the same for all ARM based SoCs using this driver we
can remove the intermediate variables.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

Comments

kernel test robot June 30, 2016, 6:03 a.m. UTC | #1
Hi,

[auto build test ERROR on net/master]
[also build test ERROR on v4.7-rc5 next-20160629]
[cannot apply to net-next/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/John-Crispin/net-next-mediatek-IRQ-cleanups-fixes-and-grouping/20160629-194341
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

Note: the linux-review/John-Crispin/net-next-mediatek-IRQ-cleanups-fixes-and-grouping/20160629-194341 HEAD e8462c612b33003fba7c1a70328c7fb7872d8507 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function 'mtk_poll':
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c:1003:16: error: 'tx_intr' undeclared (first use in this function)
     if (status & (tx_intr | rx_intr))
                   ^
   drivers/net/ethernet/mediatek/mtk_eth_soc.c:1003:16: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c:1003:26: error: 'rx_intr' undeclared (first use in this function)
     if (status & (tx_intr | rx_intr))
                             ^

vim +/tx_intr +1003 drivers/net/ethernet/mediatek/mtk_eth_soc.c

656e7052 John Crispin 2016-03-08   997  	}
656e7052 John Crispin 2016-03-08   998  
656e7052 John Crispin 2016-03-08   999  	if (tx_again || rx_done == budget)
656e7052 John Crispin 2016-03-08  1000  		return budget;
656e7052 John Crispin 2016-03-08  1001  
656e7052 John Crispin 2016-03-08  1002  	status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
656e7052 John Crispin 2016-03-08 @1003  	if (status & (tx_intr | rx_intr))
656e7052 John Crispin 2016-03-08  1004  		return budget;
656e7052 John Crispin 2016-03-08  1005  
656e7052 John Crispin 2016-03-08  1006  	napi_complete(napi);

:::::: The code at line 1003 was first introduced by commit
:::::: 656e705243fd0c2864b89634ea16ed444ef64dc6 net-next: mediatek: add support for MT7623 ethernet

:::::: TO: John Crispin <blogic@openwrt.org>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
John Crispin June 30, 2016, 7:33 a.m. UTC | #2
On 30/06/2016 08:03, kbuild test robot wrote:
> Hi,
> 
> [auto build test ERROR on net/master]
> [also build test ERROR on v4.7-rc5 next-20160629]
> [cannot apply to net-next/master]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/John-Crispin/net-next-mediatek-IRQ-cleanups-fixes-and-grouping/20160629-194341
> config: arm-allmodconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=arm 
> 
> Note: the linux-review/John-Crispin/net-next-mediatek-IRQ-cleanups-fixes-and-grouping/20160629-194341 HEAD e8462c612b33003fba7c1a70328c7fb7872d8507 builds fine.
>       It only hurts bisectibility.
> 
> All errors (new ones prefixed by >>):
> 
>    drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function 'mtk_poll':
>>> drivers/net/ethernet/mediatek/mtk_eth_soc.c:1003:16: error: 'tx_intr' undeclared (first use in this function)
>      if (status & (tx_intr | rx_intr))
>                    ^
>    drivers/net/ethernet/mediatek/mtk_eth_soc.c:1003:16: note: each undeclared identifier is reported only once for each function it appears in
>>> drivers/net/ethernet/mediatek/mtk_eth_soc.c:1003:26: error: 'rx_intr' undeclared (first use in this function)
>      if (status & (tx_intr | rx_intr))
>                              ^
> 
> vim +/tx_intr +1003 drivers/net/ethernet/mediatek/mtk_eth_soc.c
> 
> 656e7052 John Crispin 2016-03-08   997  	}
> 656e7052 John Crispin 2016-03-08   998  
> 656e7052 John Crispin 2016-03-08   999  	if (tx_again || rx_done == budget)
> 656e7052 John Crispin 2016-03-08  1000  		return budget;
> 656e7052 John Crispin 2016-03-08  1001  
> 656e7052 John Crispin 2016-03-08  1002  	status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
> 656e7052 John Crispin 2016-03-08 @1003  	if (status & (tx_intr | rx_intr))
> 656e7052 John Crispin 2016-03-08  1004  		return budget;
> 656e7052 John Crispin 2016-03-08  1005  
> 656e7052 John Crispin 2016-03-08  1006  	napi_complete(napi);
> 
> :::::: The code at line 1003 was first introduced by commit
> :::::: 656e705243fd0c2864b89634ea16ed444ef64dc6 net-next: mediatek: add support for MT7623 ethernet
> 
> :::::: TO: John Crispin <blogic@openwrt.org>
> :::::: CC: David S. Miller <davem@davemloft.net>
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Hi,

This series depends on a previous series currently sitting in net.git
starting with
	commit 562c5a70400c ("net: mediatek: only wake the queue if it is stopped")
up to
	commit 82c6544dddc6 ("net: mediatek: remove superfluous queue wake up
call")

i just double checked and with the series applied this compile error is gone

	John
diff mbox

Patch

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 5a3a4e9..d6c3a17 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -794,7 +794,7 @@  drop:
 }
 
 static int mtk_poll_rx(struct napi_struct *napi, int budget,
-		       struct mtk_eth *eth, u32 rx_intr)
+		       struct mtk_eth *eth)
 {
 	struct mtk_rx_ring *ring = &eth->rx_ring;
 	int idx = ring->calc_idx;
@@ -882,7 +882,7 @@  release_desc:
 	}
 
 	if (done < budget)
-		mtk_w32(eth, rx_intr, MTK_QMTK_INT_STATUS);
+		mtk_w32(eth, MTK_RX_DONE_INT, MTK_QMTK_INT_STATUS);
 
 	return done;
 }
@@ -967,28 +967,26 @@  static int mtk_poll_tx(struct mtk_eth *eth, int budget, bool *tx_again)
 static int mtk_poll(struct napi_struct *napi, int budget)
 {
 	struct mtk_eth *eth = container_of(napi, struct mtk_eth, rx_napi);
-	u32 status, status2, mask, tx_intr, rx_intr, status_intr;
+	u32 status, status2, mask;
 	int tx_done, rx_done;
 	bool tx_again = false;
 
 	status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
 	status2 = mtk_r32(eth, MTK_INT_STATUS2);
-	tx_intr = MTK_TX_DONE_INT;
-	rx_intr = MTK_RX_DONE_INT;
-	status_intr = (MTK_GDM1_AF | MTK_GDM2_AF);
 	tx_done = 0;
 	rx_done = 0;
 	tx_again = 0;
 
-	if (status & tx_intr)
+	if (status & MTK_TX_DONE_INT)
 		tx_done = mtk_poll_tx(eth, budget, &tx_again);
 
-	if (status & rx_intr)
-		rx_done = mtk_poll_rx(napi, budget, eth, rx_intr);
+	if (status & MTK_RX_DONE_INT)
+		rx_done = mtk_poll_rx(napi, budget, eth);
 
-	if (unlikely(status2 & status_intr)) {
+	if (unlikely(status2 & (MTK_GDM1_AF | MTK_GDM2_AF))) {
 		mtk_stats_update(eth);
-		mtk_w32(eth, status_intr, MTK_INT_STATUS2);
+		mtk_w32(eth, (MTK_GDM1_AF | MTK_GDM2_AF),
+			MTK_INT_STATUS2);
 	}
 
 	if (unlikely(netif_msg_intr(eth))) {
@@ -1006,7 +1004,7 @@  static int mtk_poll(struct napi_struct *napi, int budget)
 		return budget;
 
 	napi_complete(napi);
-	mtk_irq_enable(eth, tx_intr | rx_intr);
+	mtk_irq_enable(eth, MTK_RX_DONE_INT | MTK_RX_DONE_INT);
 
 	return rx_done;
 }