From patchwork Tue Aug 9 23:22:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 9272361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F029460CDC for ; Tue, 9 Aug 2016 23:26:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA84B26785 for ; Tue, 9 Aug 2016 23:26:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BED8F25227; Tue, 9 Aug 2016 23:26:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6782C26785 for ; Tue, 9 Aug 2016 23:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932745AbcHIXXd (ORCPT ); Tue, 9 Aug 2016 19:23:33 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:37439 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932719AbcHIXXa (ORCPT ); Tue, 9 Aug 2016 19:23:30 -0400 Received: by mail-wm0-f52.google.com with SMTP id i5so67096556wmg.0 for ; Tue, 09 Aug 2016 16:23:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aoNZ/lL1hX2vIaskFQvl+4uyBRaf/qDjlTBOzdKb5BE=; b=E6QV89YdxpI5h4h06kSz2NYXCL8meX0nCnb0ZaLl+P6uTVTW0OnVNmA1qy724ObxXN G/lJrTODGSg2k9mNYnHO7GjfSifDS6gSgnjRCX+LZmYRKAO1xaNAmxvbGjXBkx++cVa6 Cjt2Na/OL+0jzj+sok53nEt+9ZTvvxKNAEo4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aoNZ/lL1hX2vIaskFQvl+4uyBRaf/qDjlTBOzdKb5BE=; b=XIjq0dm/+KTm1iKIXC3QVKUi/SozSHUZQoGXz/+8jcXbKeFuKxDEwwh3Dduxt4Jvs5 2Hkk7uL0V5fXmcl9U4lJa0/eeVBJ3obrmcA0oAcgrMadJSpAqrIBoHSeRt64udvy6It+ s1mh++Fs2uOBxxXxYdZ1qUqV1DqwLXvmJe4nRq42HdruUW1XzoV256ILuAo7amqqG9G6 sq6f4FEwzR+om10nTRZ6JiRH2bmBS5TWqAWg65IVdqSPDZtu0Bksdfli4IY8NSX4kp4V kqXKe+u79lK3kPNJ/N5B3gdRzVDAgZqnW25QvDuqHPERJfyPJGGLQVc7Dy+apKLf+5wX /NHQ== X-Gm-Message-State: AEkoouuHAHhxF6XtjQfLQ3FiM0ZA2RmghUiIK3EHvKUAmLNVL4Wzfm3w8nv14ug0nGqFUu9W X-Received: by 10.25.1.133 with SMTP id 127mr150927lfb.54.1470785008892; Tue, 09 Aug 2016 16:23:28 -0700 (PDT) Received: from localhost.localdomain (88-203-94-178.pool.ukrtel.net. [178.94.203.88]) by smtp.gmail.com with ESMTPSA id s2sm904627lja.35.2016.08.09.16.23.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Aug 2016 16:23:28 -0700 (PDT) From: Ivan Khoronzhuk To: netdev@vger.kernel.org, mugunthanvnm@ti.com, grygorii.strashko@ti.com Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, dlide@ti.com, Ivan Khoronzhuk Subject: [PATCH v3 05/13] net: ethernet: ti: cpsw: don't check slave num in runtime Date: Wed, 10 Aug 2016 02:22:36 +0300 Message-Id: <1470784964-26440-6-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470784964-26440-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1470784964-26440-1-git-send-email-ivan.khoronzhuk@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP No need to check const slave num in runtime for every packet, and ndev for slaves w/o ndev is anyway NULL. So remove redundant check and macro. Reviewed-by: Mugunthan V N Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 0b6958d..cfbb1f2 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -497,9 +497,6 @@ static const struct cpsw_stats cpsw_gstrings_stats[] = { n; n--) \ (func)(slave++, ##arg); \ } while (0) -#define cpsw_get_slave_ndev(priv, __slave_no__) \ - ((__slave_no__ < priv->data.slaves) ? \ - priv->slaves[__slave_no__].ndev : NULL) #define cpsw_get_slave_priv(priv, __slave_no__) \ (((__slave_no__ < priv->data.slaves) && \ (priv->slaves[__slave_no__].ndev)) ? \ @@ -510,11 +507,11 @@ static const struct cpsw_stats cpsw_gstrings_stats[] = { if (!priv->data.dual_emac) \ break; \ if (CPDMA_RX_SOURCE_PORT(status) == 1) { \ - ndev = cpsw_get_slave_ndev(priv, 0); \ + ndev = priv->slaves[0].ndev; \ priv = netdev_priv(ndev); \ skb->dev = ndev; \ } else if (CPDMA_RX_SOURCE_PORT(status) == 2) { \ - ndev = cpsw_get_slave_ndev(priv, 1); \ + ndev = priv->slaves[1].ndev; \ priv = netdev_priv(ndev); \ skb->dev = ndev; \ } \ @@ -2561,7 +2558,7 @@ static int cpsw_remove(struct platform_device *pdev) } if (priv->data.dual_emac) - unregister_netdev(cpsw_get_slave_ndev(priv, 1)); + unregister_netdev(priv->slaves[1].ndev); unregister_netdev(ndev); cpsw_ale_destroy(priv->ale); @@ -2570,7 +2567,7 @@ static int cpsw_remove(struct platform_device *pdev) pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); if (priv->data.dual_emac) - free_netdev(cpsw_get_slave_ndev(priv, 1)); + free_netdev(priv->slaves[1].ndev); free_netdev(ndev); return 0; }