From patchwork Wed Apr 12 11:13:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9677191 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 8C17660325 for ; Wed, 12 Apr 2017 11:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D6C42846F for ; Wed, 12 Apr 2017 11:17:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71F0A284BC; Wed, 12 Apr 2017 11:17:18 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CA4842846F for ; Wed, 12 Apr 2017 11:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=B+AsGPJkS/ynZc2zQI7Th0KXBVn8TwfvVP5uN3IhGFs=; b=skd40JGP1G7GXCS06hjveyjg7G +3DUny0Y2nwR7tvmGo6GGMoYO6ghZLGDN4Jac+WHmMIOEfYHjT5H1GVycpXlZ82ElMCUHe5TEB/HP e9zZckhRIPvt6qi31ph1ww2QVUNZMfIszLmZGH8819EYRSsq4rKKsdI2/Fi54YwHvcJ+sPQjdPcs+ SNjzJpVSjhUBkUif/4XJQWM18Umv0gj6rEjJzXeaddToyFKQYvk4oP+f/y7FuCCh4DGQKsmr8DB// VWNdmUjBUl/PPlKaMQKtc7r4acF7jVz8Q7B7AwlGxT9mfHiB7apZsRKaNsu7Y9TecyD25oU8XZD38 uN3IfxlQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cyGGy-0004dd-4m; Wed, 12 Apr 2017 11:17:16 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cyGGG-0003mH-OG for linux-arm-kernel@lists.infradead.org; Wed, 12 Apr 2017 11:16:36 +0000 Received: by mail-wm0-x244.google.com with SMTP id d79so5729719wmi.2 for ; Wed, 12 Apr 2017 04:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hyHv3QFk48f+d1ttI1dExsRiicBJYKtFsKbVvFIwMYM=; b=kZUxnqM/dYTztvXO7erQlo6VTfpaUd6cpSAxs9ZVwDvSPQEwcQ95h0wtL4AjcCBzsT qUZ+5xXz+4VzOTgrn4Y1BPOMr1vDxwXuf8Yf5vF3fQPIATOPYCly+s6S2DWfKcHX4yZY mUPEM9W6Cp3zBOQCPlHDo69A6gYJ/nSpqW/4ULCL0oXKtMRnqONDHw3bCz0CS1KMUtJH GXQKmlyI1e98Bo/QDUUEuLoBiUiMuCC+WWPe1NZYwGthraLpv7n0V44MJNwxNot+jifN nYDxyiLJvqMAhiy5mOos2EiqCfJdRR2+cOOt9qTdNPiQM5X3jJpOXuCCbmvG89kHW+qm U6gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hyHv3QFk48f+d1ttI1dExsRiicBJYKtFsKbVvFIwMYM=; b=m6VsFpku4GYHGgOGfkDciSpWLx/tZYX3hHEQyP+lzn6Qh2QUrVgUQkhnKsOvxv35m8 GDqPIB5N2kt2KOH+7BYGuczBWr1Y9MBe84LZVIiGm0fj2ZJiDnkc40OsLuUxTphXJkwn 3eOokdeHucQk7WAS6YOTXJ3HXxEsROc2FaCNdhrtuzMPi1iQxDkW2BUH2G61ydYOhvLw 45glUYHITxOK3S85TCZ1jx1yHNeFGQdRC56pu3XcqfPR/7cLhUAp7/1cVpgmwmQSmfW6 RFApgdPJ9LDchtHBp/yHiIR91JyhOhIJS345ktethSWHWXKVqPtCNxdDTnbI06Nyxwte xL5w== X-Gm-Message-State: AN3rC/4TKa1FgoaGiu7JfGPyb91ycPFhR9KXKUH8fYUVo8GGNJXKAYy8A+o/afxlJNDsrA== X-Received: by 10.28.151.81 with SMTP id z78mr2369490wmd.95.1491995769685; Wed, 12 Apr 2017 04:16:09 -0700 (PDT) Received: from Red.local (LFbn-1-7035-57.w90-116.abo.wanadoo.fr. [90.116.208.57]) by smtp.googlemail.com with ESMTPSA id z84sm4727104wmh.27.2017.04.12.04.16.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Apr 2017 04:16:09 -0700 (PDT) From: Corentin Labbe To: robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com Subject: [PATCH v4 02/18] net: stmmac: add optional setup function Date: Wed, 12 Apr 2017 13:13:44 +0200 Message-Id: <20170412111400.2296-3-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170412111400.2296-1-clabbe.montjoie@gmail.com> References: <20170412111400.2296-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170412_041633_148042_635AFD54 X-CRM114-Status: GOOD ( 13.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of adding more ifthen logic for adding a new mac_device_info setup function, it is easier to add a function pointer to the function needed. Signed-off-by: Corentin Labbe --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++- include/linux/stmmac.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a89f76b..72d371d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3946,7 +3946,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv) struct mac_device_info *mac; /* Identify the MAC HW device */ - if (priv->plat->has_gmac) { + if (priv->plat->setup) { + mac = priv->plat->setup(priv); + } else if (priv->plat->has_gmac) { priv->dev->priv_flags |= IFF_UNICAST_FLT; mac = dwmac1000_setup(priv->ioaddr, priv->plat->multicast_filter_bins, diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 3921cb9..8bb550b 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -177,6 +177,7 @@ struct plat_stmmacenet_data { void (*fix_mac_speed)(void *priv, unsigned int speed); int (*init)(struct platform_device *pdev, void *priv); void (*exit)(struct platform_device *pdev, void *priv); + struct mac_device_info *(*setup)(void *priv); void *bsp_priv; struct clk *stmmac_clk; struct clk *pclk;