diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-04-02 05:35:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-02 16:43:09 -0400 |
commit | f9b124901cd7cf43f272b86008d813ec89d9508b (patch) | |
tree | fcc7190a0a30b3331f5b62609026ae7b35013559 /drivers/net/ethernet/cadence | |
parent | 65b3841b9cb5fe1b239f12dbf033f9827d73d032 (diff) |
net/cadence/at91_ether: Simplify OF dependencies
With of_get_mac_address() and of_get_phy_mode() now defined as dummy
functions if OF_NET is not configured, it is no longer necessary to
provide OF dependent functions as front-end. Also, the two functions
depend on OF_NET, not on OF, so the conditional code was not correct
anyway.
Drop the front-end functions and call of_get_mac_address() and
of_get_phy_mode() directly instead.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence')
-rw-r--r-- | drivers/net/ethernet/cadence/at91_ether.c | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index c6e40d65a3df..a5f499f53dd6 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c | |||
@@ -299,42 +299,7 @@ static const struct of_device_id at91ether_dt_ids[] = { | |||
299 | { .compatible = "cdns,emac" }, | 299 | { .compatible = "cdns,emac" }, |
300 | { /* sentinel */ } | 300 | { /* sentinel */ } |
301 | }; | 301 | }; |
302 | |||
303 | MODULE_DEVICE_TABLE(of, at91ether_dt_ids); | 302 | MODULE_DEVICE_TABLE(of, at91ether_dt_ids); |
304 | |||
305 | static int at91ether_get_phy_mode_dt(struct platform_device *pdev) | ||
306 | { | ||
307 | struct device_node *np = pdev->dev.of_node; | ||
308 | |||
309 | if (np) | ||
310 | return of_get_phy_mode(np); | ||
311 | |||
312 | return -ENODEV; | ||
313 | } | ||
314 | |||
315 | static int at91ether_get_hwaddr_dt(struct macb *bp) | ||
316 | { | ||
317 | struct device_node *np = bp->pdev->dev.of_node; | ||
318 | |||
319 | if (np) { | ||
320 | const char *mac = of_get_mac_address(np); | ||
321 | if (mac) { | ||
322 | memcpy(bp->dev->dev_addr, mac, ETH_ALEN); | ||
323 | return 0; | ||
324 | } | ||
325 | } | ||
326 | |||
327 | return -ENODEV; | ||
328 | } | ||
329 | #else | ||
330 | static int at91ether_get_phy_mode_dt(struct platform_device *pdev) | ||
331 | { | ||
332 | return -ENODEV; | ||
333 | } | ||
334 | static int at91ether_get_hwaddr_dt(struct macb *bp) | ||
335 | { | ||
336 | return -ENODEV; | ||
337 | } | ||
338 | #endif | 303 | #endif |
339 | 304 | ||
340 | /* Detect MAC & PHY and perform ethernet interface initialization */ | 305 | /* Detect MAC & PHY and perform ethernet interface initialization */ |
@@ -348,6 +313,7 @@ static int __init at91ether_probe(struct platform_device *pdev) | |||
348 | struct macb *lp; | 313 | struct macb *lp; |
349 | int res; | 314 | int res; |
350 | u32 reg; | 315 | u32 reg; |
316 | const char *mac; | ||
351 | 317 | ||
352 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 318 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
353 | if (!regs) | 319 | if (!regs) |
@@ -399,11 +365,13 @@ static int __init at91ether_probe(struct platform_device *pdev) | |||
399 | platform_set_drvdata(pdev, dev); | 365 | platform_set_drvdata(pdev, dev); |
400 | SET_NETDEV_DEV(dev, &pdev->dev); | 366 | SET_NETDEV_DEV(dev, &pdev->dev); |
401 | 367 | ||
402 | res = at91ether_get_hwaddr_dt(lp); | 368 | mac = of_get_mac_address(pdev->dev.of_node); |
403 | if (res < 0) | 369 | if (mac) |
370 | memcpy(lp->dev->dev_addr, mac, ETH_ALEN); | ||
371 | else | ||
404 | macb_get_hwaddr(lp); | 372 | macb_get_hwaddr(lp); |
405 | 373 | ||
406 | res = at91ether_get_phy_mode_dt(pdev); | 374 | res = of_get_phy_mode(pdev->dev.of_node); |
407 | if (res < 0) { | 375 | if (res < 0) { |
408 | if (board_data && board_data->is_rmii) | 376 | if (board_data && board_data->is_rmii) |
409 | lp->phy_interface = PHY_INTERFACE_MODE_RMII; | 377 | lp->phy_interface = PHY_INTERFACE_MODE_RMII; |