netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 10/16] drivers/net: stmmac: don't treat NULL clk as an error
       [not found] <1294749833-32019-1-git-send-email-jamie@jamieiles.com>
@ 2011-01-11 12:43 ` Jamie Iles
  2011-01-12  8:00   ` Peppe CAVALLARO
  2011-01-11 12:43 ` [PATCH 11/16] drivers/net: sh_irda: " Jamie Iles
  2011-01-11 12:43 ` [PATCH 14/16] can: mpc5xxx_can: " Jamie Iles
  2 siblings, 1 reply; 5+ messages in thread
From: Jamie Iles @ 2011-01-11 12:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jamie Iles, Giuseppe Cavallaro, netdev

clk_get() returns a struct clk cookie to the driver and some platforms
may return NULL if they only support a single clock.  clk_get() has only
failed if it returns a ERR_PTR() encoded pointer.

Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/stmmac/stmmac_timer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c
index 2a0e1ab..ebb1b37 100644
--- a/drivers/net/stmmac/stmmac_timer.c
+++ b/drivers/net/stmmac/stmmac_timer.c
@@ -91,6 +91,7 @@ int stmmac_close_ext_timer(void)
 
 #elif defined(CONFIG_STMMAC_TMU_TIMER)
 #include <linux/clk.h>
+#include <linux/err.h>
 #define TMU_CHANNEL "tmu2_clk"
 static struct clk *timer_clock;
 
@@ -109,7 +110,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
 {
 	timer_clock = clk_get(NULL, TMU_CHANNEL);
 
-	if (timer_clock == NULL)
+	if (IS_ERR(timer_clock))
 		return -1;
 
 	if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) {
-- 
1.7.3.4

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

* [PATCH 11/16] drivers/net: sh_irda: don't treat NULL clk as an error
       [not found] <1294749833-32019-1-git-send-email-jamie@jamieiles.com>
  2011-01-11 12:43 ` [PATCH 10/16] drivers/net: stmmac: don't treat NULL clk as an error Jamie Iles
@ 2011-01-11 12:43 ` Jamie Iles
  2011-01-11 12:43 ` [PATCH 14/16] can: mpc5xxx_can: " Jamie Iles
  2 siblings, 0 replies; 5+ messages in thread
From: Jamie Iles @ 2011-01-11 12:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jamie Iles, Samuel Ortiz, netdev

clk_get() returns a struct clk cookie to the driver and some platforms
may return NULL if they only support a single clock.  clk_get() has only
failed if it returns a ERR_PTR() encoded pointer.

Cc: Samuel Ortiz <samuel@sortiz.org>
Cc: netdev@vger.kernel.org
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/irda/sh_sir.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c
index 52a7c86..56ba91a 100644
--- a/drivers/net/irda/sh_sir.c
+++ b/drivers/net/irda/sh_sir.c
@@ -12,6 +12,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
@@ -278,9 +279,9 @@ static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate)
 	}
 
 	clk = clk_get(NULL, "irda_clk");
-	if (!clk) {
+	if (IS_ERR(clk)) {
 		dev_err(dev, "can not get irda_clk\n");
-		return -EIO;
+		return PTR_ERR(clk);
 	}
 
 	clk_set_rate(clk, sh_sir_find_sclk(clk));
-- 
1.7.3.4

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

* [PATCH 14/16] can: mpc5xxx_can: don't treat NULL clk as an error
       [not found] <1294749833-32019-1-git-send-email-jamie@jamieiles.com>
  2011-01-11 12:43 ` [PATCH 10/16] drivers/net: stmmac: don't treat NULL clk as an error Jamie Iles
  2011-01-11 12:43 ` [PATCH 11/16] drivers/net: sh_irda: " Jamie Iles
@ 2011-01-11 12:43 ` Jamie Iles
  2011-01-11 15:18   ` Wolfram Sang
  2 siblings, 1 reply; 5+ messages in thread
From: Jamie Iles @ 2011-01-11 12:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jamie Iles, netdev

clk_get() returns a struct clk cookie to the driver and some platforms
may return NULL if they only support a single clock.  clk_get() has only
failed if it returns a ERR_PTR() encoded pointer.

Cc: netdev@vger.kernel.org
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/can/mscan/mpc5xxx_can.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index 312b9c8..15377c0 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -29,6 +29,7 @@
 #include <linux/of_platform.h>
 #include <sysdev/fsl_soc.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 #include <linux/io.h>
 #include <asm/mpc52xx.h>
 
@@ -181,7 +182,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
 
 		if (!clock_name || !strcmp(clock_name, "sys")) {
 			sys_clk = clk_get(&ofdev->dev, "sys_clk");
-			if (!sys_clk) {
+			if (IS_ERR(sys_clk)) {
 				dev_err(&ofdev->dev, "couldn't get sys_clk\n");
 				goto exit_unmap;
 			}
@@ -204,7 +205,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
 
 		if (clocksrc < 0) {
 			ref_clk = clk_get(&ofdev->dev, "ref_clk");
-			if (!ref_clk) {
+			if (IS_ERR(ref_clk)) {
 				dev_err(&ofdev->dev, "couldn't get ref_clk\n");
 				goto exit_unmap;
 			}
-- 
1.7.3.4

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

* Re: [PATCH 14/16] can: mpc5xxx_can: don't treat NULL clk as an error
  2011-01-11 12:43 ` [PATCH 14/16] can: mpc5xxx_can: " Jamie Iles
@ 2011-01-11 15:18   ` Wolfram Sang
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2011-01-11 15:18 UTC (permalink / raw)
  To: Jamie Iles; +Cc: linux-kernel, netdev

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

On Tue, Jan 11, 2011 at 12:43:51PM +0000, Jamie Iles wrote:
> clk_get() returns a struct clk cookie to the driver and some platforms
> may return NULL if they only support a single clock.  clk_get() has only
> failed if it returns a ERR_PTR() encoded pointer.
> 
> Cc: netdev@vger.kernel.org
> Signed-off-by: Jamie Iles <jamie@jamieiles.com>

Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 10/16] drivers/net: stmmac: don't treat NULL clk as an error
  2011-01-11 12:43 ` [PATCH 10/16] drivers/net: stmmac: don't treat NULL clk as an error Jamie Iles
@ 2011-01-12  8:00   ` Peppe CAVALLARO
  0 siblings, 0 replies; 5+ messages in thread
From: Peppe CAVALLARO @ 2011-01-12  8:00 UTC (permalink / raw)
  To: Jamie Iles; +Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org

Hello

On 1/11/2011 1:43 PM, Jamie Iles wrote:
>
> clk_get() returns a struct clk cookie to the driver and some platforms
> may return NULL if they only support a single clock.  clk_get() has only
> failed if it returns a ERR_PTR() encoded pointer.
>
Thanks for the patch that actually useful.
I'm going to rework this part of the driver.
At any rate, all my new changes can be done on top of this patch.

Regards,
Peppe
>
>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
> ---
>  drivers/net/stmmac/stmmac_timer.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/stmmac/stmmac_timer.c
> b/drivers/net/stmmac/stmmac_timer.c
> index 2a0e1ab..ebb1b37 100644
> --- a/drivers/net/stmmac/stmmac_timer.c
> +++ b/drivers/net/stmmac/stmmac_timer.c
> @@ -91,6 +91,7 @@ int stmmac_close_ext_timer(void)
>
>  #elif defined(CONFIG_STMMAC_TMU_TIMER)
>  #include <linux/clk.h>
> +#include <linux/err.h>
>  #define TMU_CHANNEL "tmu2_clk"
>  static struct clk *timer_clock;
>
> @@ -109,7 +110,7 @@ int stmmac_open_ext_timer(struct net_device *dev,
> struct stmmac_timer *tm)
>  {
>         timer_clock = clk_get(NULL, TMU_CHANNEL);
>
> -       if (timer_clock == NULL)
> +       if (IS_ERR(timer_clock))
>                 return -1;
>
>         if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) {
> --
> 1.7.3.4
>

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

end of thread, other threads:[~2011-01-12  8:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1294749833-32019-1-git-send-email-jamie@jamieiles.com>
2011-01-11 12:43 ` [PATCH 10/16] drivers/net: stmmac: don't treat NULL clk as an error Jamie Iles
2011-01-12  8:00   ` Peppe CAVALLARO
2011-01-11 12:43 ` [PATCH 11/16] drivers/net: sh_irda: " Jamie Iles
2011-01-11 12:43 ` [PATCH 14/16] can: mpc5xxx_can: " Jamie Iles
2011-01-11 15:18   ` Wolfram Sang

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