From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jose Abreu Subject: [PATCH v3 net-next 12/12] net: stmmac: Remove if condition by taking advantage of hwif return code Date: Fri, 18 May 2018 14:56:09 +0100 Message-ID: <5d5c17e1f82d649ce11416e84a76e170995b63d8.1526651009.git.joabreu@synopsys.com> References: Cc: Jose Abreu , "David S. Miller" , Joao Pinto , Vitor Soares , Giuseppe Cavallaro , Alexandre Torgue To: netdev@vger.kernel.org Return-path: Received: from smtprelay.synopsys.com ([198.182.37.59]:57792 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752703AbeERN5M (ORCPT ); Fri, 18 May 2018 09:57:12 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id E934A1E05ED for ; Fri, 18 May 2018 15:57:10 +0200 (CEST) In-Reply-To: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org List-ID: We can remove the if condition and check if return code is different than -EINVAL, meaning callback is present. Signed-off-by: Jose Abreu Cc: David S. Miller Cc: Joao Pinto Cc: Vitor Soares Cc: Giuseppe Cavallaro Cc: Alexandre Torgue --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 23 ++++++++++----------- 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f2687ec..c32de53 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3644,6 +3644,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) /* To handle GMAC own interrupts */ if ((priv->plat->has_gmac) || (priv->plat->has_gmac4)) { int status = stmmac_host_irq_status(priv, priv->hw, &priv->xstats); + int mtl_status; if (unlikely(status)) { /* For LPI we need to save the tx status */ @@ -3653,20 +3654,18 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) priv->tx_path_in_lpi_mode = false; } - if (priv->synopsys_id >= DWMAC_CORE_4_00) { - for (queue = 0; queue < queues_count; queue++) { - struct stmmac_rx_queue *rx_q = - &priv->rx_queue[queue]; + for (queue = 0; queue < queues_count; queue++) { + struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; - status |= stmmac_host_mtl_irq_status(priv, - priv->hw, queue); + mtl_status = stmmac_host_mtl_irq_status(priv, priv->hw, + queue); + if (mtl_status != -EINVAL) + status |= mtl_status; - if (status & CORE_IRQ_MTL_RX_OVERFLOW) - stmmac_set_rx_tail_ptr(priv, - priv->ioaddr, - rx_q->rx_tail_addr, - queue); - } + if (status & CORE_IRQ_MTL_RX_OVERFLOW) + stmmac_set_rx_tail_ptr(priv, priv->ioaddr, + rx_q->rx_tail_addr, + queue); } /* PCS link status */ -- 1.7.1