linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
@ 2012-06-20 10:25 Marc Kleine-Budde
  2012-06-20 13:04 ` Marc Kleine-Budde
  0 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2012-06-20 10:25 UTC (permalink / raw)
  To: linux-can; +Cc: Marc Kleine-Budde, Federico Vaga

In commit:

  5b92da0 c_can_pci: generic module for C_CAN/D_CAN on PCI

the c_can_pci driver has been added. It uses clk_*() functions
resulting in a link error on archs without clock support. This
patch removed these clk_() functions as these parts of the driver
hasn't been tested.

Cc: Federico Vaga <federico.vaga@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Hello Federico,

please test on your hardware. If it works please send me your:
Tested-by.

Thanks, Marc

 drivers/net/can/c_can/c_can_pci.c |   29 +++++++----------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
index 914aecf..1011146 100644
--- a/drivers/net/can/c_can/c_can_pci.c
+++ b/drivers/net/can/c_can/c_can_pci.c
@@ -13,7 +13,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
-#include <linux/clk.h>
 #include <linux/pci.h>
 
 #include <linux/can/dev.h>
@@ -30,7 +29,7 @@ struct c_can_pci_data {
 	enum c_can_dev_id type;
 	/* Set the register alignment in the memory */
 	enum c_can_pci_reg_align reg_align;
-	/* Set the frequency if clk is not usable */
+	/* Set the frequency */
 	unsigned int freq;
 };
 
@@ -71,7 +70,6 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 	struct c_can_priv *priv;
 	struct net_device *dev;
 	void __iomem *addr;
-	struct clk *clk;
 	int ret;
 
 	ret = pci_enable_device(pdev);
@@ -113,18 +111,11 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 	priv->base = addr;
 
 	if (!c_can_pci_data->freq) {
-		/* get the appropriate clk */
-		clk = clk_get(&pdev->dev, NULL);
-		if (IS_ERR(clk)) {
-			dev_err(&pdev->dev, "no clock defined\n");
-			ret = -ENODEV;
-			goto out_free_c_can;
-		}
-		priv->can.clock.freq = clk_get_rate(clk);
-		priv->priv = clk;
+		dev_err(&pdev->dev, "no clock frequency defined\n");
+		ret = -ENODEV;
+		goto out_free_c_can;
 	} else {
 		priv->can.clock.freq = c_can_pci_data->freq;
-		priv->priv = NULL;
 	}
 
 	/* Configure CAN type */
@@ -138,7 +129,7 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 		break;
 	default:
 		ret = -EINVAL;
-		goto out_free_clock;
+		goto out_free_c_can;
 	}
 
 	/* Configure access to registers */
@@ -153,14 +144,14 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 		break;
 	default:
 		ret = -EINVAL;
-		goto out_free_clock;
+		goto out_free_c_can;
 	}
 
 	ret = register_c_can_dev(dev);
 	if (ret) {
 		dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
 			KBUILD_MODNAME, ret);
-		goto out_free_clock;
+		goto out_free_c_can;
 	}
 
 	dev_dbg(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
@@ -168,9 +159,6 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 
 	return 0;
 
-out_free_clock:
-	if (priv->priv)
-		clk_put(priv->priv);
 out_free_c_can:
 	pci_set_drvdata(pdev, NULL);
 	free_c_can_dev(dev);
@@ -193,9 +181,6 @@ static void __devexit c_can_pci_remove(struct pci_dev *pdev)
 
 	unregister_c_can_dev(dev);
 
-	if (priv->priv)
-		clk_put(priv->priv);
-
 	pci_set_drvdata(pdev, NULL);
 	free_c_can_dev(dev);
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
  2012-06-20 10:25 [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs Marc Kleine-Budde
@ 2012-06-20 13:04 ` Marc Kleine-Budde
       [not found]   ` <CAH5GJ0pGNx9qD6snF1d0J7QYpreapA2KaPdieKL_z06CdjHYVg@mail.gmail.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2012-06-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, Federico Vaga

[-- Attachment #1: Type: text/plain, Size: 3888 bytes --]

Hello Federico,

have you found Time to test the patch?

Marc
On 06/20/2012 12:25 PM, Marc Kleine-Budde wrote:
> In commit:
> 
>   5b92da0 c_can_pci: generic module for C_CAN/D_CAN on PCI
> 
> the c_can_pci driver has been added. It uses clk_*() functions
> resulting in a link error on archs without clock support. This
> patch removed these clk_() functions as these parts of the driver
> hasn't been tested.
> 
> Cc: Federico Vaga <federico.vaga@gmail.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> Hello Federico,
> 
> please test on your hardware. If it works please send me your:
> Tested-by.
> 
> Thanks, Marc
> 
>  drivers/net/can/c_can/c_can_pci.c |   29 +++++++----------------------
>  1 file changed, 7 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
> index 914aecf..1011146 100644
> --- a/drivers/net/can/c_can/c_can_pci.c
> +++ b/drivers/net/can/c_can/c_can_pci.c
> @@ -13,7 +13,6 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/netdevice.h>
> -#include <linux/clk.h>
>  #include <linux/pci.h>
>  
>  #include <linux/can/dev.h>
> @@ -30,7 +29,7 @@ struct c_can_pci_data {
>  	enum c_can_dev_id type;
>  	/* Set the register alignment in the memory */
>  	enum c_can_pci_reg_align reg_align;
> -	/* Set the frequency if clk is not usable */
> +	/* Set the frequency */
>  	unsigned int freq;
>  };
>  
> @@ -71,7 +70,6 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
>  	struct c_can_priv *priv;
>  	struct net_device *dev;
>  	void __iomem *addr;
> -	struct clk *clk;
>  	int ret;
>  
>  	ret = pci_enable_device(pdev);
> @@ -113,18 +111,11 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
>  	priv->base = addr;
>  
>  	if (!c_can_pci_data->freq) {
> -		/* get the appropriate clk */
> -		clk = clk_get(&pdev->dev, NULL);
> -		if (IS_ERR(clk)) {
> -			dev_err(&pdev->dev, "no clock defined\n");
> -			ret = -ENODEV;
> -			goto out_free_c_can;
> -		}
> -		priv->can.clock.freq = clk_get_rate(clk);
> -		priv->priv = clk;
> +		dev_err(&pdev->dev, "no clock frequency defined\n");
> +		ret = -ENODEV;
> +		goto out_free_c_can;
>  	} else {
>  		priv->can.clock.freq = c_can_pci_data->freq;
> -		priv->priv = NULL;
>  	}
>  
>  	/* Configure CAN type */
> @@ -138,7 +129,7 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
>  		break;
>  	default:
>  		ret = -EINVAL;
> -		goto out_free_clock;
> +		goto out_free_c_can;
>  	}
>  
>  	/* Configure access to registers */
> @@ -153,14 +144,14 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
>  		break;
>  	default:
>  		ret = -EINVAL;
> -		goto out_free_clock;
> +		goto out_free_c_can;
>  	}
>  
>  	ret = register_c_can_dev(dev);
>  	if (ret) {
>  		dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
>  			KBUILD_MODNAME, ret);
> -		goto out_free_clock;
> +		goto out_free_c_can;
>  	}
>  
>  	dev_dbg(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
> @@ -168,9 +159,6 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
>  
>  	return 0;
>  
> -out_free_clock:
> -	if (priv->priv)
> -		clk_put(priv->priv);
>  out_free_c_can:
>  	pci_set_drvdata(pdev, NULL);
>  	free_c_can_dev(dev);
> @@ -193,9 +181,6 @@ static void __devexit c_can_pci_remove(struct pci_dev *pdev)
>  
>  	unregister_c_can_dev(dev);
>  
> -	if (priv->priv)
> -		clk_put(priv->priv);
> -
>  	pci_set_drvdata(pdev, NULL);
>  	free_c_can_dev(dev);
>  


-- 
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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
@ 2012-06-20 15:58 Marc Kleine-Budde
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Kleine-Budde @ 2012-06-20 15:58 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can, Marc Kleine-Budde, Federico Vaga

In commit:

  5b92da0 c_can_pci: generic module for C_CAN/D_CAN on PCI

the c_can_pci driver has been added. It uses clk_*() functions
resulting in a link error on archs without clock support. This
patch removed these clk_() functions as these parts of the driver
are not tested.

Cc: Federico Vaga <federico.vaga@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/c_can/c_can_pci.c |   29 +++++++----------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
index 914aecf..1011146 100644
--- a/drivers/net/can/c_can/c_can_pci.c
+++ b/drivers/net/can/c_can/c_can_pci.c
@@ -13,7 +13,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
-#include <linux/clk.h>
 #include <linux/pci.h>
 
 #include <linux/can/dev.h>
@@ -30,7 +29,7 @@ struct c_can_pci_data {
 	enum c_can_dev_id type;
 	/* Set the register alignment in the memory */
 	enum c_can_pci_reg_align reg_align;
-	/* Set the frequency if clk is not usable */
+	/* Set the frequency */
 	unsigned int freq;
 };
 
@@ -71,7 +70,6 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 	struct c_can_priv *priv;
 	struct net_device *dev;
 	void __iomem *addr;
-	struct clk *clk;
 	int ret;
 
 	ret = pci_enable_device(pdev);
@@ -113,18 +111,11 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 	priv->base = addr;
 
 	if (!c_can_pci_data->freq) {
-		/* get the appropriate clk */
-		clk = clk_get(&pdev->dev, NULL);
-		if (IS_ERR(clk)) {
-			dev_err(&pdev->dev, "no clock defined\n");
-			ret = -ENODEV;
-			goto out_free_c_can;
-		}
-		priv->can.clock.freq = clk_get_rate(clk);
-		priv->priv = clk;
+		dev_err(&pdev->dev, "no clock frequency defined\n");
+		ret = -ENODEV;
+		goto out_free_c_can;
 	} else {
 		priv->can.clock.freq = c_can_pci_data->freq;
-		priv->priv = NULL;
 	}
 
 	/* Configure CAN type */
@@ -138,7 +129,7 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 		break;
 	default:
 		ret = -EINVAL;
-		goto out_free_clock;
+		goto out_free_c_can;
 	}
 
 	/* Configure access to registers */
@@ -153,14 +144,14 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 		break;
 	default:
 		ret = -EINVAL;
-		goto out_free_clock;
+		goto out_free_c_can;
 	}
 
 	ret = register_c_can_dev(dev);
 	if (ret) {
 		dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
 			KBUILD_MODNAME, ret);
-		goto out_free_clock;
+		goto out_free_c_can;
 	}
 
 	dev_dbg(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
@@ -168,9 +159,6 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
 
 	return 0;
 
-out_free_clock:
-	if (priv->priv)
-		clk_put(priv->priv);
 out_free_c_can:
 	pci_set_drvdata(pdev, NULL);
 	free_c_can_dev(dev);
@@ -193,9 +181,6 @@ static void __devexit c_can_pci_remove(struct pci_dev *pdev)
 
 	unregister_c_can_dev(dev);
 
-	if (priv->priv)
-		clk_put(priv->priv);
-
 	pci_set_drvdata(pdev, NULL);
 	free_c_can_dev(dev);
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
       [not found]   ` <CAH5GJ0pGNx9qD6snF1d0J7QYpreapA2KaPdieKL_z06CdjHYVg@mail.gmail.com>
@ 2012-06-20 18:24     ` Marc Kleine-Budde
  2012-06-21 17:51       ` Federico Vaga
  2012-06-22 11:42       ` Federico Vaga
  0 siblings, 2 replies; 9+ messages in thread
From: Marc Kleine-Budde @ 2012-06-20 18:24 UTC (permalink / raw)
  To: Federico Vaga; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

On 06/20/2012 07:20 PM, Federico Vaga wrote:
>> have you found Time to test the patch?
>>
> I don‘t have the hardware with me at the moment. I can test it tomorrow
> morning.

I've already sent the patch to David. However please test it.

Marc

-- 
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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
  2012-06-21 17:51       ` Federico Vaga
@ 2012-06-21 17:50         ` Marc Kleine-Budde
  2012-06-21 18:11           ` Federico Vaga
  0 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2012-06-21 17:50 UTC (permalink / raw)
  To: Federico Vaga; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

On 06/21/2012 07:51 PM, Federico Vaga wrote:
>> I've already sent the patch to David. However please test it.

He already had applied it, however testing is still a good idea.

> My development board don't boot. I'll test the patch when I can boot my 
> board or use a different one (hopefully soon).

Is the boot problems related to the patch?

Marc
-- 
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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
  2012-06-20 18:24     ` Marc Kleine-Budde
@ 2012-06-21 17:51       ` Federico Vaga
  2012-06-21 17:50         ` Marc Kleine-Budde
  2012-06-22 11:42       ` Federico Vaga
  1 sibling, 1 reply; 9+ messages in thread
From: Federico Vaga @ 2012-06-21 17:51 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

> I've already sent the patch to David. However please test it.

My development board don't boot. I'll test the patch when I can boot my 
board or use a different one (hopefully soon).

-- 
Federico Vaga

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
  2012-06-21 17:50         ` Marc Kleine-Budde
@ 2012-06-21 18:11           ` Federico Vaga
  0 siblings, 0 replies; 9+ messages in thread
From: Federico Vaga @ 2012-06-21 18:11 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

> >> I've already sent the patch to David. However please test it.
> 
> He already had applied it, however testing is still a good idea.

Sure

> > My development board don't boot. I'll test the patch when I can boot
> > my board or use a different one (hopefully soon).
> 
> Is the boot problems related to the patch?

No, it is a different problem. I explained why I didn't tested the patch 
yet.

-- 
Federico Vaga

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
  2012-06-22 11:42       ` Federico Vaga
@ 2012-06-22 11:40         ` Marc Kleine-Budde
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Kleine-Budde @ 2012-06-22 11:40 UTC (permalink / raw)
  To: Federico Vaga; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

On 06/22/2012 01:42 PM, Federico Vaga wrote:
>> I've already sent the patch to David. However please test it.
> 
> It works.

hooray \o/


-- 
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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs
  2012-06-20 18:24     ` Marc Kleine-Budde
  2012-06-21 17:51       ` Federico Vaga
@ 2012-06-22 11:42       ` Federico Vaga
  2012-06-22 11:40         ` Marc Kleine-Budde
  1 sibling, 1 reply; 9+ messages in thread
From: Federico Vaga @ 2012-06-22 11:42 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

> I've already sent the patch to David. However please test it.

It works.

-- 
Federico Vaga

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-06-22 11:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-20 10:25 [PATCH] can: c_can_pci: fix compilation on non HAVE_CLK archs Marc Kleine-Budde
2012-06-20 13:04 ` Marc Kleine-Budde
     [not found]   ` <CAH5GJ0pGNx9qD6snF1d0J7QYpreapA2KaPdieKL_z06CdjHYVg@mail.gmail.com>
2012-06-20 18:24     ` Marc Kleine-Budde
2012-06-21 17:51       ` Federico Vaga
2012-06-21 17:50         ` Marc Kleine-Budde
2012-06-21 18:11           ` Federico Vaga
2012-06-22 11:42       ` Federico Vaga
2012-06-22 11:40         ` Marc Kleine-Budde
  -- strict thread matches above, loose matches on Subject: below --
2012-06-20 15:58 Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).