Commit af80425e authored by Thomas Bogendoerfer's avatar Thomas Bogendoerfer Committed by David S. Miller

net: korina: Only pass mac address via platform data

Get rid of access to struct korina_device by just passing the mac
address via platform data and use drvdata for passing netdev to remove
function.
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0fc96939
...@@ -105,6 +105,9 @@ static struct platform_device korina_dev0 = { ...@@ -105,6 +105,9 @@ static struct platform_device korina_dev0 = {
.name = "korina", .name = "korina",
.resource = korina_dev0_res, .resource = korina_dev0_res,
.num_resources = ARRAY_SIZE(korina_dev0_res), .num_resources = ARRAY_SIZE(korina_dev0_res),
.dev = {
.platform_data = &korina_dev0_data.mac,
}
}; };
static struct resource cf_slot0_res[] = { static struct resource cf_slot0_res[] = {
...@@ -299,8 +302,6 @@ static int __init plat_setup_devices(void) ...@@ -299,8 +302,6 @@ static int __init plat_setup_devices(void)
/* set the uart clock to the current cpu frequency */ /* set the uart clock to the current cpu frequency */
rb532_uart_res[0].uartclk = idt_cpu_freq; rb532_uart_res[0].uartclk = idt_cpu_freq;
dev_set_drvdata(&korina_dev0.dev, &korina_dev0_data);
gpiod_add_lookup_table(&cf_slot0_gpio_table); gpiod_add_lookup_table(&cf_slot0_gpio_table);
return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs)); return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));
} }
......
...@@ -1055,7 +1055,7 @@ static const struct net_device_ops korina_netdev_ops = { ...@@ -1055,7 +1055,7 @@ static const struct net_device_ops korina_netdev_ops = {
static int korina_probe(struct platform_device *pdev) static int korina_probe(struct platform_device *pdev)
{ {
struct korina_device *bif = platform_get_drvdata(pdev); u8 *mac_addr = dev_get_platdata(&pdev->dev);
struct korina_private *lp; struct korina_private *lp;
struct net_device *dev; struct net_device *dev;
void __iomem *p; void __iomem *p;
...@@ -1068,8 +1068,7 @@ static int korina_probe(struct platform_device *pdev) ...@@ -1068,8 +1068,7 @@ static int korina_probe(struct platform_device *pdev)
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
lp = netdev_priv(dev); lp = netdev_priv(dev);
bif->dev = dev; memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
memcpy(dev->dev_addr, bif->mac, ETH_ALEN);
lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx"); lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx");
lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx"); lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx");
...@@ -1123,6 +1122,8 @@ static int korina_probe(struct platform_device *pdev) ...@@ -1123,6 +1122,8 @@ static int korina_probe(struct platform_device *pdev)
lp->mii_if.phy_id_mask = 0x1f; lp->mii_if.phy_id_mask = 0x1f;
lp->mii_if.reg_num_mask = 0x1f; lp->mii_if.reg_num_mask = 0x1f;
platform_set_drvdata(pdev, dev);
rc = register_netdev(dev); rc = register_netdev(dev);
if (rc < 0) { if (rc < 0) {
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
...@@ -1140,9 +1141,9 @@ static int korina_probe(struct platform_device *pdev) ...@@ -1140,9 +1141,9 @@ static int korina_probe(struct platform_device *pdev)
static int korina_remove(struct platform_device *pdev) static int korina_remove(struct platform_device *pdev)
{ {
struct korina_device *bif = platform_get_drvdata(pdev); struct net_device *dev = platform_get_drvdata(pdev);
unregister_netdev(bif->dev); unregister_netdev(dev);
return 0; return 0;
} }
......
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