From patchwork Wed May 31 07:18:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9755987 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 DE317602BF for ; Wed, 31 May 2017 07:22:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0ACC2848B for ; Wed, 31 May 2017 07:22:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5271284A6; Wed, 31 May 2017 07:22:22 +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 97FCB2848B for ; Wed, 31 May 2017 07:22:21 +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=qpBKXkYzzHIPmbQ5zRRpeSsNacErr4m6GsJpmtGKjMw=; b=GK77PJBbvOqH9QGNJ8JSTeuKGq lJDd9WtCcdZQd/oZLxknCxqyxraECBlagfDt7ElQ9if4iXXD6wJq+hmyPeH6sf+kSS6pSCbxTPAYD jcotwoOzbPi/bCknL+IfVBZwp3pqw3ZRS354g3Ykk0af9Lq2ey2Vc9ns1qqYHfjF1T2WBEW1cWuLX bAiHDCsRs9/To5fjawW6F/bjJT5WPHoWHUu+kQgnz2a4VLcQBZ/dHlr5XmlQoX/uZT6pt+4Uyd+Y7 UERbvL9NTEKYT6AhwcvH20vzZsV+D4aL52lpAAflTOj0MionkqI3pVWP/vS0e4i9K7HAq3DqUte9G XAM+G5sg==; 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 1dFxxU-00077G-Gn; Wed, 31 May 2017 07:22:20 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dFxxP-0006xu-0M for linux-arm-kernel@lists.infradead.org; Wed, 31 May 2017 07:22:18 +0000 Received: by mail-wr0-x241.google.com with SMTP id v104so689306wrb.0 for ; Wed, 31 May 2017 00:21:54 -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=DtJ6eBmCXx2vyePpgfXxtXroti/7IA/TObW8DrC/sHE=; b=AJBiy99cwuHrv4YLYm06yrzdt2azxidoPNRf9Ti1z7my1O+ee4C+Ih7x1MOvjwW65P JTSMjjbXNZCkqci2wHhcTt8nXJ9YZvPHXzc2GnW6eYZvsOi57S+pSL1rK+V2vywSGvHG syC5eI2/Nbjawqw8Ate3Zwai/s09YRKzTXvnEL9oknpu0GU/mmZ21aKdpQYxlmsgnVuY xaVVYFcmYwOxAllhvdZi/huw3V7uSI1NHhjHPHFKOY+o/ThCbZR6qiBVMxsrmj5L4ylj mXKuQwbaP/Vn4RqRSM1T+6Ke+KhdwZuWMfhHmcNGpMj0bQz3/5BYPUv7a3FNQ7u9HogM bhVA== 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=DtJ6eBmCXx2vyePpgfXxtXroti/7IA/TObW8DrC/sHE=; b=lYFHtNMk/1//ogWLyUv77itWlVNH+WwIzYd4lxLBn9Wov80umJP6bgJTYLuMFcy449 2NajWdQGKWfzPbvllN1e84Xs/Yhq4dE0zu99Ng9TohR55cenNJyLuidRPCpQuXAe6OGU PD0bNx4kTp8qIQt6oXlRWRuzEtAXheem+A5SILW7dTbmqMhc0c4GWVC0zNuoPEKEv1DR Ow2j4t3/uMKJAI+edR+DIooK/ZgHcg3NxwnoXpRwTv62sJd+T2QCJ5AduLEpWRImAd8e cPBIaDDgvw1CquQRi1AaemH+U44JUvfhXDEJr+z2vsWAxQcVI+wkty1W39nhuVOg5fjf gFzQ== X-Gm-Message-State: AODbwcDy3G0Z0VS4S9wvdAhuCl8rnD9WaYIAJb47QFr1CBIRGe3YG/j4 BOJEzjNMf2RInw== X-Received: by 10.223.177.219 with SMTP id r27mr16805701wra.148.1496215313129; Wed, 31 May 2017 00:21:53 -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 r130sm12528169wmg.4.2017.05.31.00.21.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 May 2017 00:21:52 -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 v6 02/21] net-next: stmmac: add optional setup function Date: Wed, 31 May 2017 09:18:33 +0200 Message-Id: <20170531071852.12422-3-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170531071852.12422-1-clabbe.montjoie@gmail.com> References: <20170531071852.12422-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170531_002215_205809_502BA291 X-CRM114-Status: GOOD ( 12.69 ) 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 f158273eab9b..c80c9c3b67db 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3933,7 +3933,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 3921cb9dfadb..8bb550bca96d 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;