Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752733AbdFVGSP (ORCPT ); Thu, 22 Jun 2017 02:18:15 -0400 Received: from david.siemens.de ([192.35.17.14]:44769 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbdFVGSL (ORCPT ); Thu, 22 Jun 2017 02:18:11 -0400 From: Jan Kiszka To: Giuseppe Cavallaro , Alexandre Torgue , David Miller Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v5 4/5] stmmac: pci: Select quark_pci_dmi_data from quark_default_data Date: Thu, 22 Jun 2017 08:18:00 +0200 Message-Id: <30fa1840d915f2cfa83647c908afce29e6c0e4a1.1498112281.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4355 Lines: 157 From: Jan Kiszka No need to carry this reference in stmmac_pci_info - the Quark-specific setup handler knows that it needs to use the Quark-specific DMI table. This also allows to drop the stmmac_pci_info reference from the setup handler parameter list. Signed-off-by: Jan Kiszka Reviewed-by: Andy Shevchenko --- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 83 +++++++++++------------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index f44ae49eb11c..a6e10d3ced5c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -38,13 +38,11 @@ struct stmmac_pci_dmi_data { }; struct stmmac_pci_info { - int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat, - const struct stmmac_pci_info *info); - struct stmmac_pci_dmi_data *dmi; + int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat); }; static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, - const struct stmmac_pci_info *info) + struct stmmac_pci_dmi_data *dmi_data) { const char *name = dmi_get_system_info(DMI_BOARD_NAME); const char *asset_tag = dmi_get_system_info(DMI_BOARD_ASSET_TAG); @@ -54,7 +52,7 @@ static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, if (!name) return -ENODEV; - for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) { + for (dmi = dmi_data; dmi->name && *dmi->name; dmi++) { if (!strcmp(dmi->name, name) && dmi->func == func) { /* If asset tag is provided, match on it as well. */ if (dmi->asset_tag && strcmp(dmi->asset_tag, asset_tag)) @@ -97,8 +95,7 @@ static void common_default_data(struct plat_stmmacenet_data *plat) } static int stmmac_default_data(struct pci_dev *pdev, - struct plat_stmmacenet_data *plat, - const struct stmmac_pci_info *info) + struct plat_stmmacenet_data *plat) { /* Set common default data first */ common_default_data(plat); @@ -118,9 +115,40 @@ static const struct stmmac_pci_info stmmac_pci_info = { .setup = stmmac_default_data, }; +static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = { + { + .name = "Galileo", + .func = 6, + .phy_addr = 1, + }, + { + .name = "GalileoGen2", + .func = 6, + .phy_addr = 1, + }, + { + .name = "SIMATIC IOT2000", + .asset_tag = "6ES7647-0AA00-0YA2", + .func = 6, + .phy_addr = 1, + }, + { + .name = "SIMATIC IOT2000", + .asset_tag = "6ES7647-0AA00-1YA2", + .func = 6, + .phy_addr = 1, + }, + { + .name = "SIMATIC IOT2000", + .asset_tag = "6ES7647-0AA00-1YA2", + .func = 7, + .phy_addr = 1, + }, + {} +}; + static int quark_default_data(struct pci_dev *pdev, - struct plat_stmmacenet_data *plat, - const struct stmmac_pci_info *info) + struct plat_stmmacenet_data *plat) { int ret; @@ -131,7 +159,7 @@ static int quark_default_data(struct pci_dev *pdev, * Refuse to load the driver and register net device if MAC controller * does not connect to any PHY interface. */ - ret = stmmac_pci_find_phy_addr(pdev, info); + ret = stmmac_pci_find_phy_addr(pdev, quark_pci_dmi_data); if (ret < 0) { /* Return error to the caller on DMI enabled boards. */ if (dmi_get_system_info(DMI_BOARD_NAME)) @@ -157,41 +185,8 @@ static int quark_default_data(struct pci_dev *pdev, return 0; } -static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = { - { - .name = "Galileo", - .func = 6, - .phy_addr = 1, - }, - { - .name = "GalileoGen2", - .func = 6, - .phy_addr = 1, - }, - { - .name = "SIMATIC IOT2000", - .asset_tag = "6ES7647-0AA00-0YA2", - .func = 6, - .phy_addr = 1, - }, - { - .name = "SIMATIC IOT2000", - .asset_tag = "6ES7647-0AA00-1YA2", - .func = 6, - .phy_addr = 1, - }, - { - .name = "SIMATIC IOT2000", - .asset_tag = "6ES7647-0AA00-1YA2", - .func = 7, - .phy_addr = 1, - }, - {} -}; - static const struct stmmac_pci_info quark_pci_info = { .setup = quark_default_data, - .dmi = quark_pci_dmi_data, }; /** @@ -250,7 +245,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, pci_set_master(pdev); - ret = info->setup(pdev, plat, info); + ret = info->setup(pdev, plat); if (ret) return ret; -- 2.12.3