diff mbox

[2/3] can: at91_can: add pinctrl support

Message ID 1362763842-14924-3-git-send-email-ludovic.desroches@atmel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ludovic Desroches March 8, 2013, 5:30 p.m. UTC
From: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/net/can/at91_can.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Marc Kleine-Budde March 8, 2013, 5:37 p.m. UTC | #1
On 03/08/2013 06:30 PM, ludovic.desroches@atmel.com wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> ---
>  drivers/net/can/at91_can.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
> index c7f70d4..56fb2aa 100644
> --- a/drivers/net/can/at91_can.c
> +++ b/drivers/net/can/at91_can.c
> @@ -28,6 +28,7 @@
>  #include <linux/module.h>
>  #include <linux/netdevice.h>
>  #include <linux/of.h>
> +#include <linux/pinctrl/consumer.h>
>  #include <linux/platform_device.h>
>  #include <linux/rtnetlink.h>
>  #include <linux/skbuff.h>
> @@ -1292,6 +1293,7 @@ static int at91_can_probe(struct platform_device *pdev)
>  	struct clk *clk;
>  	void __iomem *addr;
>  	int err, irq;
> +	struct pinctrl *pinctrl;
>  
>  	devtype_data = at91_can_get_driver_data(pdev);
>  	if (!devtype_data) {
> @@ -1314,6 +1316,13 @@ static int at91_can_probe(struct platform_device *pdev)
>  		goto exit_put;
>  	}
>  
> +	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);

Is this still needed? I think the pinctrl framework automatically
enables the default pinctrl for a device if available.

Marc

> +	if (IS_ERR(pinctrl)) {
> +		dev_err(&pdev->dev, "Failed to request pinctrl\n");
> +		err = PTR_ERR(pinctrl);
> +		goto exit_put;
> +	}
> +
>  	if (!request_mem_region(res->start,
>  				resource_size(res),
>  				pdev->name)) {
>
Jean-Christophe PLAGNIOL-VILLARD March 8, 2013, 6:46 p.m. UTC | #2
On 18:37 Fri 08 Mar     , Marc Kleine-Budde wrote:
> On 03/08/2013 06:30 PM, ludovic.desroches@atmel.com wrote:
> > From: Ludovic Desroches <ludovic.desroches@atmel.com>
> > 
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > ---
> >  drivers/net/can/at91_can.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
> > index c7f70d4..56fb2aa 100644
> > --- a/drivers/net/can/at91_can.c
> > +++ b/drivers/net/can/at91_can.c
> > @@ -28,6 +28,7 @@
> >  #include <linux/module.h>
> >  #include <linux/netdevice.h>
> >  #include <linux/of.h>
> > +#include <linux/pinctrl/consumer.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/rtnetlink.h>
> >  #include <linux/skbuff.h>
> > @@ -1292,6 +1293,7 @@ static int at91_can_probe(struct platform_device *pdev)
> >  	struct clk *clk;
> >  	void __iomem *addr;
> >  	int err, irq;
> > +	struct pinctrl *pinctrl;
> >  
> >  	devtype_data = at91_can_get_driver_data(pdev);
> >  	if (!devtype_data) {
> > @@ -1314,6 +1316,13 @@ static int at91_can_probe(struct platform_device *pdev)
> >  		goto exit_put;
> >  	}
> >  
> > +	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> 
> Is this still needed? I think the pinctrl framework automatically
> enables the default pinctrl for a device if available.
yes this is useless

Best Regards,
J.
> 
> Marc
> 
> > +	if (IS_ERR(pinctrl)) {
> > +		dev_err(&pdev->dev, "Failed to request pinctrl\n");
> > +		err = PTR_ERR(pinctrl);
> > +		goto exit_put;
> > +	}
> > +
> >  	if (!request_mem_region(res->start,
> >  				resource_size(res),
> >  				pdev->name)) {
> > 
> 
> 
> -- 
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
>
diff mbox

Patch

diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index c7f70d4..56fb2aa 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -28,6 +28,7 @@ 
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
@@ -1292,6 +1293,7 @@  static int at91_can_probe(struct platform_device *pdev)
 	struct clk *clk;
 	void __iomem *addr;
 	int err, irq;
+	struct pinctrl *pinctrl;
 
 	devtype_data = at91_can_get_driver_data(pdev);
 	if (!devtype_data) {
@@ -1314,6 +1316,13 @@  static int at91_can_probe(struct platform_device *pdev)
 		goto exit_put;
 	}
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		dev_err(&pdev->dev, "Failed to request pinctrl\n");
+		err = PTR_ERR(pinctrl);
+		goto exit_put;
+	}
+
 	if (!request_mem_region(res->start,
 				resource_size(res),
 				pdev->name)) {