Skip to content

Commit

Permalink
net/macb: add pinctrl consumer support
Browse files Browse the repository at this point in the history
If no pinctrl available just report a warning as some architecture may not
need to do anything.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
[nicolas.ferre@atmel.com: adapt the error path, remove unneeded headers]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Tested-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jean-Christophe PLAGNIOL-VILLARD authored and David S. Miller committed Nov 1, 2012
1 parent 29bc2e1 commit 8ef29f8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_net.h>
#include <linux/pinctrl/consumer.h>

#include "macb.h"

Expand Down Expand Up @@ -1472,13 +1473,23 @@ static int __init macb_probe(struct platform_device *pdev)
struct phy_device *phydev;
u32 config;
int err = -ENXIO;
struct pinctrl *pinctrl;

regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs) {
dev_err(&pdev->dev, "no mmio resource defined\n");
goto err_out;
}

pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
if (IS_ERR(pinctrl)) {
err = PTR_ERR(pinctrl);
if (err == -EPROBE_DEFER)
goto err_out;

dev_warn(&pdev->dev, "No pinctrl provided\n");
}

err = -ENOMEM;
dev = alloc_etherdev(sizeof(*bp));
if (!dev)
Expand Down

0 comments on commit 8ef29f8

Please sign in to comment.