diff options
author | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | 2013-06-07 09:54:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-08 02:38:23 -0400 |
commit | afe391ad4b05f8f00ca955e165f3b37b480506b7 (patch) | |
tree | 24633fb5a0f36802af40581a23b5efc29369bfab /drivers/net/ethernet/renesas | |
parent | e8b265e8ba322a01bb746504f6f64b5506853eac (diff) |
sh_eth: create initial ID table
We are trying to get away from the current driver's scheme of identifying a SoC
based on #ifdef's and the platform device ID table matching seems to be a good
replacement -- we can use the 'driver_data' field of 'struct platform_device_id'
as a pointer to a 'struct sh_eth_cpu_data'. Start by creating the initial table
with driver's name as the only entry without the driver data. Check the driver
data in the probe() method and if it's not NULL override 'mdp->cd' from it.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/renesas')
-rw-r--r-- | drivers/net/ethernet/renesas/sh_eth.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 0699b1ec7e32..cf062de40b65 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -2519,6 +2519,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
2519 | struct net_device *ndev = NULL; | 2519 | struct net_device *ndev = NULL; |
2520 | struct sh_eth_private *mdp = NULL; | 2520 | struct sh_eth_private *mdp = NULL; |
2521 | struct sh_eth_plat_data *pd = pdev->dev.platform_data; | 2521 | struct sh_eth_plat_data *pd = pdev->dev.platform_data; |
2522 | const struct platform_device_id *id = platform_get_device_id(pdev); | ||
2522 | 2523 | ||
2523 | /* get base addr */ | 2524 | /* get base addr */ |
2524 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2525 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -2582,6 +2583,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
2582 | #else | 2583 | #else |
2583 | mdp->cd = &sh_eth_my_cpu_data; | 2584 | mdp->cd = &sh_eth_my_cpu_data; |
2584 | #endif | 2585 | #endif |
2586 | if (id->driver_data) | ||
2587 | mdp->cd = (struct sh_eth_cpu_data *)id->driver_data; | ||
2585 | sh_eth_set_default_cpu_data(mdp->cd); | 2588 | sh_eth_set_default_cpu_data(mdp->cd); |
2586 | 2589 | ||
2587 | /* set function */ | 2590 | /* set function */ |
@@ -2696,9 +2699,16 @@ static const struct dev_pm_ops sh_eth_dev_pm_ops = { | |||
2696 | #define SH_ETH_PM_OPS NULL | 2699 | #define SH_ETH_PM_OPS NULL |
2697 | #endif | 2700 | #endif |
2698 | 2701 | ||
2702 | static struct platform_device_id sh_eth_id_table[] = { | ||
2703 | { CARDNAME }, | ||
2704 | { } | ||
2705 | }; | ||
2706 | MODULE_DEVICE_TABLE(platform, sh_eth_id_table); | ||
2707 | |||
2699 | static struct platform_driver sh_eth_driver = { | 2708 | static struct platform_driver sh_eth_driver = { |
2700 | .probe = sh_eth_drv_probe, | 2709 | .probe = sh_eth_drv_probe, |
2701 | .remove = sh_eth_drv_remove, | 2710 | .remove = sh_eth_drv_remove, |
2711 | .id_table = sh_eth_id_table, | ||
2702 | .driver = { | 2712 | .driver = { |
2703 | .name = CARDNAME, | 2713 | .name = CARDNAME, |
2704 | .pm = SH_ETH_PM_OPS, | 2714 | .pm = SH_ETH_PM_OPS, |