From patchwork Tue Mar 31 13:01:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 6129701 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C47499F1BE for ; Tue, 31 Mar 2015 13:06:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D459F20142 for ; Tue, 31 Mar 2015 13:06:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 825B1201E4 for ; Tue, 31 Mar 2015 13:06:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ycvoj-0000JK-1z; Tue, 31 Mar 2015 13:02:53 +0000 Received: from eusmtp01.atmel.com ([212.144.249.243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ycvob-0000Ck-BT for linux-arm-kernel@lists.infradead.org; Tue, 31 Mar 2015 13:02:49 +0000 Received: from tenerife.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server id 14.2.347.0; Tue, 31 Mar 2015 15:02:20 +0200 From: Nicolas Ferre To: , , "David S. Miller" Subject: [PATCH v2 1/8] net/macb: only probe queues once and use stored values Date: Tue, 31 Mar 2015 15:01:59 +0200 Message-ID: <1427806926-18887-2-git-send-email-nicolas.ferre@atmel.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1427806926-18887-1-git-send-email-nicolas.ferre@atmel.com> References: <1427806926-18887-1-git-send-email-nicolas.ferre@atmel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150331_060245_810031_98EDB724 X-CRM114-Status: GOOD ( 12.29 ) X-Spam-Score: -2.3 (--) Cc: Boris BREZILLON , Nicolas Ferre , linux-kernel@vger.kernel.org, michal.simek@xilinx.com, Alexandre Belloni , punnaia@xilinx.com, Cyrille Pitchen X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When merging at91_ether and macb driver during 421d9df0628b (net/macb: merge at91_ether driver into macb driver) the probe function has been split. The code dealing with initialization of queues is now moved in macb_init() which needs information computed in the parent macb_probe() function. So, add the queue_mask information to the private structure and use it when needed in macb_init(). Signed-off-by: Nicolas Ferre Acked-by: Boris Brezillon Cc: Cyrille Pitchen --- Changes in v2: - address Cyrille comment about exit condition of queue configuration loop drivers/net/ethernet/cadence/macb.c | 7 +++---- drivers/net/ethernet/cadence/macb.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index a0a04b3638e6..ac1f18142f7e 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -2180,7 +2180,7 @@ static void macb_probe_queues(void __iomem *mem, static int macb_init(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); - unsigned int hw_q, queue_mask, q, num_queues; + unsigned int hw_q, q; struct macb *bp = netdev_priv(dev); struct macb_queue *queue; int err; @@ -2226,10 +2226,8 @@ static int macb_init(struct platform_device *pdev) * register mapping but we don't want to test the queue index then * compute the corresponding register offset at run time. */ - macb_probe_queues(bp->regs, &queue_mask, &num_queues); - for (hw_q = 0, q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) { - if (!(queue_mask & (1 << hw_q))) + if (!(bp->queue_mask & (1 << hw_q))) continue; queue = &bp->queues[q]; @@ -2715,6 +2713,7 @@ static int macb_probe(struct platform_device *pdev) bp->dev = dev; bp->regs = mem; bp->num_queues = num_queues; + bp->queue_mask = queue_mask; spin_lock_init(&bp->lock); platform_set_drvdata(pdev, dev); diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index bc6e35c40822..0b6afac91bfe 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -785,6 +785,7 @@ struct macb { size_t rx_buffer_size; unsigned int num_queues; + unsigned int queue_mask; struct macb_queue queues[MACB_MAX_QUEUES]; spinlock_t lock;