Re: [PATCH v3 10/10] net/macb: add pinctrl consumer support

2012-10-31 Thread Nicolas Ferre
On 10/30/2012 06:37 PM, Joachim Eastwood :
> On 30 October 2012 11:18, Nicolas Ferre  wrote:
>> From: Jean-Christophe PLAGNIOL-VILLARD 
>>
>> 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.fe...@atmel.com: adapt the error path]
>> Signed-off-by: Nicolas Ferre 
>> Cc: net...@vger.kernel.org
>> ---
>>  drivers/net/ethernet/cadence/macb.c | 13 +
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb.c 
>> b/drivers/net/ethernet/cadence/macb.c
>> index 4d51877..eae3d74 100644
>> --- a/drivers/net/ethernet/cadence/macb.c
>> +++ b/drivers/net/ethernet/cadence/macb.c
>> @@ -26,6 +26,9 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
> Why are these two headers added?
> I don't see anything from them used in the code added.
> 
> Wouldn't the pinctrl header by itself be sufficient?

It is: I will remove the two unneeded headers in my v4 patch series.

Thanks,

> 
>> +#include 
>>
>>  #include "macb.h"
>>
>> @@ -1472,6 +1475,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 +1483,15 @@ static int __init macb_probe(struct platform_device 
>> *pdev)
>> goto err_out;
>> }
>>
>> +   pinctrl = devm_pinctrl_get_select_default(>dev);
>> +   if (IS_ERR(pinctrl)) {
>> +   err = PTR_ERR(pinctrl);
>> +   if (err == -EPROBE_DEFER)
>> +   goto err_out;
>> +
>> +   dev_warn(>dev, "No pinctrl provided\n");
>> +   }
>> +
>> err = -ENOMEM;
>> dev = alloc_etherdev(sizeof(*bp));
>> if (!dev)

Best regards,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 10/10] net/macb: add pinctrl consumer support

2012-10-31 Thread Nicolas Ferre
On 10/30/2012 06:37 PM, Joachim Eastwood :
 On 30 October 2012 11:18, Nicolas Ferre nicolas.fe...@atmel.com wrote:
 From: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com

 If no pinctrl available just report a warning as some architecture may not
 need to do anything.

 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
 [nicolas.fe...@atmel.com: adapt the error path]
 Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com
 Cc: net...@vger.kernel.org
 ---
  drivers/net/ethernet/cadence/macb.c | 13 +
  1 file changed, 13 insertions(+)

 diff --git a/drivers/net/ethernet/cadence/macb.c 
 b/drivers/net/ethernet/cadence/macb.c
 index 4d51877..eae3d74 100644
 --- a/drivers/net/ethernet/cadence/macb.c
 +++ b/drivers/net/ethernet/cadence/macb.c
 @@ -26,6 +26,9 @@
  #include linux/of.h
  #include linux/of_device.h
  #include linux/of_net.h
 +#include linux/of_gpio.h
 +#include linux/gpio.h
 Why are these two headers added?
 I don't see anything from them used in the code added.
 
 Wouldn't the pinctrl header by itself be sufficient?

It is: I will remove the two unneeded headers in my v4 patch series.

Thanks,

 
 +#include linux/pinctrl/consumer.h

  #include macb.h

 @@ -1472,6 +1475,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 +1483,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)

Best regards,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 10/10] net/macb: add pinctrl consumer support

2012-10-30 Thread Joachim Eastwood
On 30 October 2012 11:18, Nicolas Ferre  wrote:
> From: Jean-Christophe PLAGNIOL-VILLARD 
>
> 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.fe...@atmel.com: adapt the error path]
> Signed-off-by: Nicolas Ferre 
> Cc: net...@vger.kernel.org
> ---
>  drivers/net/ethernet/cadence/macb.c | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/net/ethernet/cadence/macb.c 
> b/drivers/net/ethernet/cadence/macb.c
> index 4d51877..eae3d74 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -26,6 +26,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
Why are these two headers added?
I don't see anything from them used in the code added.

Wouldn't the pinctrl header by itself be sufficient?

> +#include 
>
>  #include "macb.h"
>
> @@ -1472,6 +1475,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 +1483,15 @@ static int __init macb_probe(struct platform_device 
> *pdev)
> goto err_out;
> }
>
> +   pinctrl = devm_pinctrl_get_select_default(>dev);
> +   if (IS_ERR(pinctrl)) {
> +   err = PTR_ERR(pinctrl);
> +   if (err == -EPROBE_DEFER)
> +   goto err_out;
> +
> +   dev_warn(>dev, "No pinctrl provided\n");
> +   }
> +
> err = -ENOMEM;
> dev = alloc_etherdev(sizeof(*bp));
> if (!dev)
> --

regards
Joachim Eastwood
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 10/10] net/macb: add pinctrl consumer support

2012-10-30 Thread Nicolas Ferre
From: Jean-Christophe PLAGNIOL-VILLARD 

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.fe...@atmel.com: adapt the error path]
Signed-off-by: Nicolas Ferre 
Cc: net...@vger.kernel.org
---
 drivers/net/ethernet/cadence/macb.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb.c 
b/drivers/net/ethernet/cadence/macb.c
index 4d51877..eae3d74 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -26,6 +26,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include "macb.h"
 
@@ -1472,6 +1475,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 +1483,15 @@ static int __init macb_probe(struct platform_device 
*pdev)
goto err_out;
}
 
+   pinctrl = devm_pinctrl_get_select_default(>dev);
+   if (IS_ERR(pinctrl)) {
+   err = PTR_ERR(pinctrl);
+   if (err == -EPROBE_DEFER)
+   goto err_out;
+
+   dev_warn(>dev, "No pinctrl provided\n");
+   }
+
err = -ENOMEM;
dev = alloc_etherdev(sizeof(*bp));
if (!dev)
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 10/10] net/macb: add pinctrl consumer support

2012-10-30 Thread Nicolas Ferre
From: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com

If no pinctrl available just report a warning as some architecture may not
need to do anything.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
[nicolas.fe...@atmel.com: adapt the error path]
Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com
Cc: net...@vger.kernel.org
---
 drivers/net/ethernet/cadence/macb.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb.c 
b/drivers/net/ethernet/cadence/macb.c
index 4d51877..eae3d74 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -26,6 +26,9 @@
 #include linux/of.h
 #include linux/of_device.h
 #include linux/of_net.h
+#include linux/of_gpio.h
+#include linux/gpio.h
+#include linux/pinctrl/consumer.h
 
 #include macb.h
 
@@ -1472,6 +1475,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 +1483,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)
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 10/10] net/macb: add pinctrl consumer support

2012-10-30 Thread Joachim Eastwood
On 30 October 2012 11:18, Nicolas Ferre nicolas.fe...@atmel.com wrote:
 From: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com

 If no pinctrl available just report a warning as some architecture may not
 need to do anything.

 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
 [nicolas.fe...@atmel.com: adapt the error path]
 Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com
 Cc: net...@vger.kernel.org
 ---
  drivers/net/ethernet/cadence/macb.c | 13 +
  1 file changed, 13 insertions(+)

 diff --git a/drivers/net/ethernet/cadence/macb.c 
 b/drivers/net/ethernet/cadence/macb.c
 index 4d51877..eae3d74 100644
 --- a/drivers/net/ethernet/cadence/macb.c
 +++ b/drivers/net/ethernet/cadence/macb.c
 @@ -26,6 +26,9 @@
  #include linux/of.h
  #include linux/of_device.h
  #include linux/of_net.h
 +#include linux/of_gpio.h
 +#include linux/gpio.h
Why are these two headers added?
I don't see anything from them used in the code added.

Wouldn't the pinctrl header by itself be sufficient?

 +#include linux/pinctrl/consumer.h

  #include macb.h

 @@ -1472,6 +1475,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 +1483,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)
 --

regards
Joachim Eastwood
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/