From patchwork Mon May 1 12:45:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9706451 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 8A43260387 for ; Mon, 1 May 2017 12:49:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7945E22B27 for ; Mon, 1 May 2017 12:49:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D2F128066; Mon, 1 May 2017 12:49:14 +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 0862422B27 for ; Mon, 1 May 2017 12:49:14 +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=iUlqSnCHBUxxk13kjCpY4joUalX12GKEsuhRZH/xUY8=; b=gCJNZa7SvwK1EIuHouPSZwDxI1 XVrLgqDEWiQ1pKYGnaHvfE+UiQeJ0MrkFLC67joUN72V2B76V5Iu291PJj1eTE0IH3GWfMN3GXGbH KrXF4pbLVI0NBL8UcP9njcGudJR3/tCuM4Nu972I3M2oNiWzGRm9m4sfOxmir1gTTppdzF7ce5t5c CkkGJewlUqg1+lvZaI92+JYed9xF9HuYRlTvwaWZN1dCxI31rI7aCF2ZJwlHAUbqPK6OapgF7x2zw fFnMpdM17E6qr+WtHKN6QqwIHPr9ina5+G3AKsKdUGXwrOzCfN8kO/rGROhONuIA6lrltiyeLQIo7 ShIj8xfQ==; 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 1d5AlM-00037N-Pr; Mon, 01 May 2017 12:49:12 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d5Akg-0002JK-TM for linux-arm-kernel@lists.infradead.org; Mon, 01 May 2017 12:48:33 +0000 Received: by mail-wr0-x243.google.com with SMTP id w50so13709274wrc.0 for ; Mon, 01 May 2017 05:48: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=qQzFcXdl8EZuiiseWuDBPB313MQIzYghCJwrnZLJZuA=; b=ot25FRxkAdo4bDzHAZ5zevndV4HJ5EtX0xV5KE9iDs4q4UgTwAD+2BCgOG2szlgw/r 4PmbH/ZJyOEtGU+T2f4Kq2hx+qfRq/aMhv7Mhs+umn5u85INdXI8G0QYLThCYvt/CPm7 LSCtZe4ZUTAoFxUa7nQPRwyq8M+jAg2zJKIC8ETC+RDfiN1AlsyhK9zxIfZmiwhFSDpa VMuHKfhFgJuvUhLU31d0xXiwEflqWmJHRwPQ92L8RxKBE9mKNZBkTWcrfSyNZVNjqkR+ cEcKYnhD3K3Q6Ii8C6xuqGCxMM23tCk7ayOuIDVEB3a4AoRseRxbPUD20/il7GugqVrB hnFQ== 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=qQzFcXdl8EZuiiseWuDBPB313MQIzYghCJwrnZLJZuA=; b=QGjnEqBVoC8yddVa8U4IfVoD2tiqE/qgIBzcUu1HXEKeKchJzTKJ0pmLkn0dL46Lwt 4e4GbJeCp1IRMdvuyx2oJ58P+QUW/k423i4n1wTEQD1vcudoIceGgj7JrG1QYAV+K1cm E7TnwGiy2GmX2Ex623b6UpJZWoOgIGv2vYEqKCZTOnyEJ5oZyrPPQKzqDd9H5V6C4Wz1 h4MJT51s0mHW12mwcEyGHdK56B/hylE2LRErkUoROIQkc8/7E1UM7PfcKrebLMg5rrLm eNrKwJ6sCefdncdLiIOdfiee596sx9Yx8JYgItTjA+W+dRcAlpGbyuiqqPoeYrct+TXD lPFg== X-Gm-Message-State: AN3rC/78T1x9jKvZLOw5u1ehovvDyMuUH2FTCUw/7aZ9mfsSQd9qeq3o S6ssqaNBaREn3A== X-Received: by 10.223.151.6 with SMTP id r6mr15929572wrb.189.1493642889165; Mon, 01 May 2017 05:48: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 4sm3364514wrv.33.2017.05.01.05.48.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 May 2017 05:48:08 -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 v5 02/20] net: stmmac: add optional setup function Date: Mon, 1 May 2017 14:45:02 +0200 Message-Id: <20170501124520.3769-3-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170501124520.3769-1-clabbe.montjoie@gmail.com> References: <20170501124520.3769-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170501_054831_098144_88E9C330 X-CRM114-Status: GOOD ( 12.54 ) 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, Corentin Labbe , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.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 cd8c601..b82ab64 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3947,7 +3947,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;