From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 31 Oct 2012 06:04:59 +0000 (+0000) Subject: net/macb: add pinctrl consumer support X-Git-Tag: v3.8-rc1~139^2~500 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ef29f8aae524bd51298fb10ac6a5ce6c4c5a3d8;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git net/macb: add pinctrl consumer support If no pinctrl available just report a warning as some architecture may not need to do anything. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD [nicolas.ferre@atmel.com: adapt the error path, remove unneeded headers] Signed-off-by: Nicolas Ferre Tested-by: Joachim Eastwood Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index c1f20b0..c374875 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "macb.h" @@ -1472,6 +1473,7 @@ 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) { @@ -1479,6 +1481,15 @@ static int __init macb_probe(struct platform_device *pdev) 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)