Commit b0377116 authored by Rob Herring's avatar Rob Herring Committed by David S. Miller

net: ethernet: Use device_get_match_data()

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4d177f49
...@@ -472,7 +472,7 @@ struct altera_tse_private { ...@@ -472,7 +472,7 @@ struct altera_tse_private {
/* ethtool msglvl option */ /* ethtool msglvl option */
u32 msg_enable; u32 msg_enable;
struct altera_dmaops *dmaops; const struct altera_dmaops *dmaops;
struct phylink *phylink; struct phylink *phylink;
struct phylink_config phylink_config; struct phylink_config phylink_config;
......
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/mdio/mdio-regmap.h> #include <linux/mdio/mdio-regmap.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/of_device.h> #include <linux/of.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/of_platform.h>
#include <linux/pcs-lynx.h> #include <linux/pcs-lynx.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
...@@ -82,8 +82,6 @@ MODULE_PARM_DESC(dma_tx_num, "Number of descriptors in the TX list"); ...@@ -82,8 +82,6 @@ MODULE_PARM_DESC(dma_tx_num, "Number of descriptors in the TX list");
#define TXQUEUESTOP_THRESHHOLD 2 #define TXQUEUESTOP_THRESHHOLD 2
static const struct of_device_id altera_tse_ids[];
static inline u32 tse_tx_avail(struct altera_tse_private *priv) static inline u32 tse_tx_avail(struct altera_tse_private *priv)
{ {
return priv->tx_cons + priv->tx_ring_size - priv->tx_prod - 1; return priv->tx_cons + priv->tx_ring_size - priv->tx_prod - 1;
...@@ -1133,7 +1131,6 @@ static int request_and_map(struct platform_device *pdev, const char *name, ...@@ -1133,7 +1131,6 @@ static int request_and_map(struct platform_device *pdev, const char *name,
*/ */
static int altera_tse_probe(struct platform_device *pdev) static int altera_tse_probe(struct platform_device *pdev)
{ {
const struct of_device_id *of_id = NULL;
struct regmap_config pcs_regmap_cfg; struct regmap_config pcs_regmap_cfg;
struct altera_tse_private *priv; struct altera_tse_private *priv;
struct mdio_regmap_config mrc; struct mdio_regmap_config mrc;
...@@ -1159,11 +1156,7 @@ static int altera_tse_probe(struct platform_device *pdev) ...@@ -1159,11 +1156,7 @@ static int altera_tse_probe(struct platform_device *pdev)
priv->dev = ndev; priv->dev = ndev;
priv->msg_enable = netif_msg_init(debug, default_msg_level); priv->msg_enable = netif_msg_init(debug, default_msg_level);
of_id = of_match_device(altera_tse_ids, &pdev->dev); priv->dmaops = device_get_match_data(&pdev->dev);
if (of_id)
priv->dmaops = (struct altera_dmaops *)of_id->data;
if (priv->dmaops && if (priv->dmaops &&
priv->dmaops->altera_dtype == ALTERA_DTYPE_SGDMA) { priv->dmaops->altera_dtype == ALTERA_DTYPE_SGDMA) {
......
...@@ -123,9 +123,7 @@ ...@@ -123,9 +123,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_device.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/acpi.h> #include <linux/acpi.h>
...@@ -135,17 +133,6 @@ ...@@ -135,17 +133,6 @@
#include "xgbe-common.h" #include "xgbe-common.h"
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static const struct acpi_device_id xgbe_acpi_match[];
static struct xgbe_version_data *xgbe_acpi_vdata(struct xgbe_prv_data *pdata)
{
const struct acpi_device_id *id;
id = acpi_match_device(xgbe_acpi_match, pdata->dev);
return id ? (struct xgbe_version_data *)id->driver_data : NULL;
}
static int xgbe_acpi_support(struct xgbe_prv_data *pdata) static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
{ {
struct device *dev = pdata->dev; struct device *dev = pdata->dev;
...@@ -173,11 +160,6 @@ static int xgbe_acpi_support(struct xgbe_prv_data *pdata) ...@@ -173,11 +160,6 @@ static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
return 0; return 0;
} }
#else /* CONFIG_ACPI */ #else /* CONFIG_ACPI */
static struct xgbe_version_data *xgbe_acpi_vdata(struct xgbe_prv_data *pdata)
{
return NULL;
}
static int xgbe_acpi_support(struct xgbe_prv_data *pdata) static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
{ {
return -EINVAL; return -EINVAL;
...@@ -185,17 +167,6 @@ static int xgbe_acpi_support(struct xgbe_prv_data *pdata) ...@@ -185,17 +167,6 @@ static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
#endif /* CONFIG_ACPI */ #endif /* CONFIG_ACPI */
#ifdef CONFIG_OF #ifdef CONFIG_OF
static const struct of_device_id xgbe_of_match[];
static struct xgbe_version_data *xgbe_of_vdata(struct xgbe_prv_data *pdata)
{
const struct of_device_id *id;
id = of_match_device(xgbe_of_match, pdata->dev);
return id ? (struct xgbe_version_data *)id->data : NULL;
}
static int xgbe_of_support(struct xgbe_prv_data *pdata) static int xgbe_of_support(struct xgbe_prv_data *pdata)
{ {
struct device *dev = pdata->dev; struct device *dev = pdata->dev;
...@@ -244,11 +215,6 @@ static struct platform_device *xgbe_of_get_phy_pdev(struct xgbe_prv_data *pdata) ...@@ -244,11 +215,6 @@ static struct platform_device *xgbe_of_get_phy_pdev(struct xgbe_prv_data *pdata)
return phy_pdev; return phy_pdev;
} }
#else /* CONFIG_OF */ #else /* CONFIG_OF */
static struct xgbe_version_data *xgbe_of_vdata(struct xgbe_prv_data *pdata)
{
return NULL;
}
static int xgbe_of_support(struct xgbe_prv_data *pdata) static int xgbe_of_support(struct xgbe_prv_data *pdata)
{ {
return -EINVAL; return -EINVAL;
...@@ -290,12 +256,6 @@ static struct platform_device *xgbe_get_phy_pdev(struct xgbe_prv_data *pdata) ...@@ -290,12 +256,6 @@ static struct platform_device *xgbe_get_phy_pdev(struct xgbe_prv_data *pdata)
return phy_pdev; return phy_pdev;
} }
static struct xgbe_version_data *xgbe_get_vdata(struct xgbe_prv_data *pdata)
{
return pdata->use_acpi ? xgbe_acpi_vdata(pdata)
: xgbe_of_vdata(pdata);
}
static int xgbe_platform_probe(struct platform_device *pdev) static int xgbe_platform_probe(struct platform_device *pdev)
{ {
struct xgbe_prv_data *pdata; struct xgbe_prv_data *pdata;
...@@ -321,7 +281,7 @@ static int xgbe_platform_probe(struct platform_device *pdev) ...@@ -321,7 +281,7 @@ static int xgbe_platform_probe(struct platform_device *pdev)
pdata->use_acpi = dev->of_node ? 0 : 1; pdata->use_acpi = dev->of_node ? 0 : 1;
/* Get the version data */ /* Get the version data */
pdata->vdata = xgbe_get_vdata(pdata); pdata->vdata = (struct xgbe_version_data *)device_get_match_data(dev);
phy_pdev = xgbe_get_phy_pdev(pdata); phy_pdev = xgbe_get_phy_pdev(pdata);
if (!phy_pdev) { if (!phy_pdev) {
......
...@@ -2018,7 +2018,6 @@ static int xgene_enet_probe(struct platform_device *pdev) ...@@ -2018,7 +2018,6 @@ static int xgene_enet_probe(struct platform_device *pdev)
struct xgene_enet_pdata *pdata; struct xgene_enet_pdata *pdata;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
void (*link_state)(struct work_struct *); void (*link_state)(struct work_struct *);
const struct of_device_id *of_id;
int ret; int ret;
ndev = alloc_etherdev_mqs(sizeof(struct xgene_enet_pdata), ndev = alloc_etherdev_mqs(sizeof(struct xgene_enet_pdata),
...@@ -2039,19 +2038,7 @@ static int xgene_enet_probe(struct platform_device *pdev) ...@@ -2039,19 +2038,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
NETIF_F_GRO | NETIF_F_GRO |
NETIF_F_SG; NETIF_F_SG;
of_id = of_match_device(xgene_enet_of_match, &pdev->dev); pdata->enet_id = (enum xgene_enet_id)device_get_match_data(&pdev->dev);
if (of_id) {
pdata->enet_id = (uintptr_t)of_id->data;
}
#ifdef CONFIG_ACPI
else {
const struct acpi_device_id *acpi_id;
acpi_id = acpi_match_device(xgene_enet_acpi_match, &pdev->dev);
if (acpi_id)
pdata->enet_id = (enum xgene_enet_id) acpi_id->driver_data;
}
#endif
if (!pdata->enet_id) { if (!pdata->enet_id) {
ret = -ENODEV; ret = -ENODEV;
goto err; goto err;
......
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
#include <linux/efi.h> #include <linux/efi.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of_platform.h> #include <linux/of.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/platform_device.h>
#include <linux/mdio/mdio-xgene.h> #include <linux/mdio/mdio-xgene.h>
#include <linux/module.h> #include <linux/module.h>
#include <net/ip.h> #include <net/ip.h>
......
...@@ -52,11 +52,11 @@ ...@@ -52,11 +52,11 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/mdio.h> #include <linux/mdio.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/fec.h> #include <linux/fec.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
...@@ -4292,14 +4292,13 @@ fec_probe(struct platform_device *pdev) ...@@ -4292,14 +4292,13 @@ fec_probe(struct platform_device *pdev)
phy_interface_t interface; phy_interface_t interface;
struct net_device *ndev; struct net_device *ndev;
int i, irq, ret = 0; int i, irq, ret = 0;
const struct of_device_id *of_id;
static int dev_id; static int dev_id;
struct device_node *np = pdev->dev.of_node, *phy_node; struct device_node *np = pdev->dev.of_node, *phy_node;
int num_tx_qs; int num_tx_qs;
int num_rx_qs; int num_rx_qs;
char irq_name[8]; char irq_name[8];
int irq_cnt; int irq_cnt;
struct fec_devinfo *dev_info; const struct fec_devinfo *dev_info;
fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs); fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);
...@@ -4314,10 +4313,9 @@ fec_probe(struct platform_device *pdev) ...@@ -4314,10 +4313,9 @@ fec_probe(struct platform_device *pdev)
/* setup board info structure */ /* setup board info structure */
fep = netdev_priv(ndev); fep = netdev_priv(ndev);
of_id = of_match_device(fec_dt_ids, &pdev->dev); dev_info = device_get_match_data(&pdev->dev);
if (of_id) if (!dev_info)
pdev->id_entry = of_id->data; dev_info = (const struct fec_devinfo *)pdev->id_entry->driver_data;
dev_info = (struct fec_devinfo *)pdev->id_entry->driver_data;
if (dev_info) if (dev_info)
fep->quirks = dev_info->quirks; fep->quirks = dev_info->quirks;
......
...@@ -35,10 +35,9 @@ ...@@ -35,10 +35,9 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/property.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/pgtable.h> #include <linux/pgtable.h>
...@@ -884,9 +883,9 @@ static const struct ethtool_ops fs_ethtool_ops = { ...@@ -884,9 +883,9 @@ static const struct ethtool_ops fs_ethtool_ops = {
/**************************************************************************************/ /**************************************************************************************/
#ifdef CONFIG_FS_ENET_HAS_FEC #ifdef CONFIG_FS_ENET_HAS_FEC
#define IS_FEC(match) ((match)->data == &fs_fec_ops) #define IS_FEC(ops) ((ops) == &fs_fec_ops)
#else #else
#define IS_FEC(match) 0 #define IS_FEC(ops) 0
#endif #endif
static const struct net_device_ops fs_enet_netdev_ops = { static const struct net_device_ops fs_enet_netdev_ops = {
...@@ -903,10 +902,9 @@ static const struct net_device_ops fs_enet_netdev_ops = { ...@@ -903,10 +902,9 @@ static const struct net_device_ops fs_enet_netdev_ops = {
#endif #endif
}; };
static const struct of_device_id fs_enet_match[];
static int fs_enet_probe(struct platform_device *ofdev) static int fs_enet_probe(struct platform_device *ofdev)
{ {
const struct of_device_id *match; const struct fs_ops *ops;
struct net_device *ndev; struct net_device *ndev;
struct fs_enet_private *fep; struct fs_enet_private *fep;
struct fs_platform_info *fpi; struct fs_platform_info *fpi;
...@@ -916,15 +914,15 @@ static int fs_enet_probe(struct platform_device *ofdev) ...@@ -916,15 +914,15 @@ static int fs_enet_probe(struct platform_device *ofdev)
const char *phy_connection_type; const char *phy_connection_type;
int privsize, len, ret = -ENODEV; int privsize, len, ret = -ENODEV;
match = of_match_device(fs_enet_match, &ofdev->dev); ops = device_get_match_data(&ofdev->dev);
if (!match) if (!ops)
return -EINVAL; return -EINVAL;
fpi = kzalloc(sizeof(*fpi), GFP_KERNEL); fpi = kzalloc(sizeof(*fpi), GFP_KERNEL);
if (!fpi) if (!fpi)
return -ENOMEM; return -ENOMEM;
if (!IS_FEC(match)) { if (!IS_FEC(ops)) {
data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len); data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
if (!data || len != 4) if (!data || len != 4)
goto out_free_fpi; goto out_free_fpi;
...@@ -986,7 +984,7 @@ static int fs_enet_probe(struct platform_device *ofdev) ...@@ -986,7 +984,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
fep->dev = &ofdev->dev; fep->dev = &ofdev->dev;
fep->ndev = ndev; fep->ndev = ndev;
fep->fpi = fpi; fep->fpi = fpi;
fep->ops = match->data; fep->ops = ops;
ret = fep->ops->setup_data(ndev); ret = fep->ops->setup_data(ndev);
if (ret) if (ret)
......
...@@ -30,9 +30,10 @@ ...@@ -30,9 +30,10 @@
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <linux/pgtable.h> #include <linux/pgtable.h>
#include <asm/irq.h> #include <asm/irq.h>
...@@ -96,20 +97,15 @@ static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location, ...@@ -96,20 +97,15 @@ static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location,
} }
static const struct of_device_id fs_enet_mdio_fec_match[];
static int fs_enet_mdio_probe(struct platform_device *ofdev) static int fs_enet_mdio_probe(struct platform_device *ofdev)
{ {
const struct of_device_id *match;
struct resource res; struct resource res;
struct mii_bus *new_bus; struct mii_bus *new_bus;
struct fec_info *fec; struct fec_info *fec;
int (*get_bus_freq)(struct device *); int (*get_bus_freq)(struct device *);
int ret = -ENOMEM, clock, speed; int ret = -ENOMEM, clock, speed;
match = of_match_device(fs_enet_mdio_fec_match, &ofdev->dev); get_bus_freq = device_get_match_data(&ofdev->dev);
if (!match)
return -EINVAL;
get_bus_freq = match->data;
new_bus = mdiobus_alloc(); new_bus = mdiobus_alloc();
if (!new_bus) if (!new_bus)
......
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_device.h> #include <linux/property.h>
#include <asm/io.h> #include <asm/io.h>
#if IS_ENABLED(CONFIG_UCC_GETH) #if IS_ENABLED(CONFIG_UCC_GETH)
...@@ -407,8 +408,6 @@ static void set_tbipa(const u32 tbipa_val, struct platform_device *pdev, ...@@ -407,8 +408,6 @@ static void set_tbipa(const u32 tbipa_val, struct platform_device *pdev,
static int fsl_pq_mdio_probe(struct platform_device *pdev) static int fsl_pq_mdio_probe(struct platform_device *pdev)
{ {
const struct of_device_id *id =
of_match_device(fsl_pq_mdio_match, &pdev->dev);
const struct fsl_pq_mdio_data *data; const struct fsl_pq_mdio_data *data;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct resource res; struct resource res;
...@@ -417,15 +416,12 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) ...@@ -417,15 +416,12 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
struct mii_bus *new_bus; struct mii_bus *new_bus;
int err; int err;
if (!id) { data = device_get_match_data(&pdev->dev);
if (!data) {
dev_err(&pdev->dev, "Failed to match device\n"); dev_err(&pdev->dev, "Failed to match device\n");
return -ENODEV; return -ENODEV;
} }
data = id->data;
dev_dbg(&pdev->dev, "found %s compatible node\n", id->compatible);
new_bus = mdiobus_alloc_size(sizeof(*priv)); new_bus = mdiobus_alloc_size(sizeof(*priv));
if (!new_bus) if (!new_bus)
return -ENOMEM; return -ENOMEM;
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of_device.h> #include <linux/property.h>
#include <linux/of.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/reset.h> #include <linux/reset.h>
...@@ -1094,7 +1095,6 @@ static int hix5hd2_dev_probe(struct platform_device *pdev) ...@@ -1094,7 +1095,6 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node; struct device_node *node = dev->of_node;
const struct of_device_id *of_id = NULL;
struct net_device *ndev; struct net_device *ndev;
struct hix5hd2_priv *priv; struct hix5hd2_priv *priv;
struct mii_bus *bus; struct mii_bus *bus;
...@@ -1110,12 +1110,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev) ...@@ -1110,12 +1110,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
priv->dev = dev; priv->dev = dev;
priv->netdev = ndev; priv->netdev = ndev;
of_id = of_match_device(hix5hd2_of_match, dev); priv->hw_cap = (unsigned long)device_get_match_data(dev);
if (!of_id) {
ret = -EINVAL;
goto out_free_netdev;
}
priv->hw_cap = (unsigned long)of_id->data;
priv->base = devm_platform_ioremap_resource(pdev, 0); priv->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->base)) { if (IS_ERR(priv->base)) {
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/stmmac.h> #include <linux/stmmac.h>
#include "dwmac4.h" #include "dwmac4.h"
...@@ -76,7 +76,6 @@ static int intel_eth_plat_probe(struct platform_device *pdev) ...@@ -76,7 +76,6 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
{ {
struct plat_stmmacenet_data *plat_dat; struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res; struct stmmac_resources stmmac_res;
const struct of_device_id *match;
struct intel_dwmac *dwmac; struct intel_dwmac *dwmac;
unsigned long rate; unsigned long rate;
int ret; int ret;
...@@ -98,10 +97,8 @@ static int intel_eth_plat_probe(struct platform_device *pdev) ...@@ -98,10 +97,8 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
dwmac->dev = &pdev->dev; dwmac->dev = &pdev->dev;
dwmac->tx_clk = NULL; dwmac->tx_clk = NULL;
match = of_match_device(intel_eth_plat_match, &pdev->dev); dwmac->data = device_get_match_data(&pdev->dev);
if (match && match->data) { if (dwmac->data) {
dwmac->data = (const struct intel_dwmac_data *)match->data;
if (dwmac->data->fix_mac_speed) if (dwmac->data->fix_mac_speed)
plat_dat->fix_mac_speed = dwmac->data->fix_mac_speed; plat_dat->fix_mac_speed = dwmac->data->fix_mac_speed;
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/semaphore.h> #include <linux/semaphore.h>
#include <linux/phy.h> #include <linux/phy.h>
...@@ -47,10 +48,7 @@ ...@@ -47,10 +48,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/davinci_emac.h> #include <linux/davinci_emac.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_irq.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
...@@ -1726,13 +1724,10 @@ static const struct net_device_ops emac_netdev_ops = { ...@@ -1726,13 +1724,10 @@ static const struct net_device_ops emac_netdev_ops = {
#endif #endif
}; };
static const struct of_device_id davinci_emac_of_match[];
static struct emac_platform_data * static struct emac_platform_data *
davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv)
{ {
struct device_node *np; struct device_node *np;
const struct of_device_id *match;
const struct emac_platform_data *auxdata; const struct emac_platform_data *auxdata;
struct emac_platform_data *pdata = NULL; struct emac_platform_data *pdata = NULL;
...@@ -1779,9 +1774,8 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) ...@@ -1779,9 +1774,8 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv)
pdata->interrupt_disable = auxdata->interrupt_disable; pdata->interrupt_disable = auxdata->interrupt_disable;
} }
match = of_match_device(davinci_emac_of_match, &pdev->dev); auxdata = device_get_match_data(&pdev->dev);
if (match && match->data) { if (auxdata) {
auxdata = match->data;
pdata->version = auxdata->version; pdata->version = auxdata->version;
pdata->hw_ram_addr = auxdata->hw_ram_addr; pdata->hw_ram_addr = auxdata->hw_ram_addr;
} }
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/of_platform.h> #include <linux/platform_device.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/property.h>
#include <linux/remoteproc/pruss.h> #include <linux/remoteproc/pruss.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/remoteproc.h> #include <linux/remoteproc.h>
...@@ -1934,8 +1934,6 @@ static void prueth_put_cores(struct prueth *prueth, int slice) ...@@ -1934,8 +1934,6 @@ static void prueth_put_cores(struct prueth *prueth, int slice)
pru_rproc_put(prueth->pru[slice]); pru_rproc_put(prueth->pru[slice]);
} }
static const struct of_device_id prueth_dt_match[];
static int prueth_probe(struct platform_device *pdev) static int prueth_probe(struct platform_device *pdev)
{ {
struct device_node *eth_node, *eth_ports_node; struct device_node *eth_node, *eth_ports_node;
...@@ -1944,7 +1942,6 @@ static int prueth_probe(struct platform_device *pdev) ...@@ -1944,7 +1942,6 @@ static int prueth_probe(struct platform_device *pdev)
struct genpool_data_align gp_data = { struct genpool_data_align gp_data = {
.align = SZ_64K, .align = SZ_64K,
}; };
const struct of_device_id *match;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np; struct device_node *np;
struct prueth *prueth; struct prueth *prueth;
...@@ -1954,17 +1951,13 @@ static int prueth_probe(struct platform_device *pdev) ...@@ -1954,17 +1951,13 @@ static int prueth_probe(struct platform_device *pdev)
np = dev->of_node; np = dev->of_node;
match = of_match_device(prueth_dt_match, dev);
if (!match)
return -ENODEV;
prueth = devm_kzalloc(dev, sizeof(*prueth), GFP_KERNEL); prueth = devm_kzalloc(dev, sizeof(*prueth), GFP_KERNEL);
if (!prueth) if (!prueth)
return -ENOMEM; return -ENOMEM;
dev_set_drvdata(dev, prueth); dev_set_drvdata(dev, prueth);
prueth->pdev = pdev; prueth->pdev = pdev;
prueth->pdata = *(const struct prueth_pdata *)match->data; prueth->pdata = *(const struct prueth_pdata *)device_get_match_data(dev);
prueth->dev = dev; prueth->dev = dev;
eth_ports_node = of_get_child_by_name(np, "ethernet-ports"); eth_ports_node = of_get_child_by_name(np, "ethernet-ports");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment