All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-24 17:26 Masahiro Yamada
  0 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-08-24 17:26 UTC (permalink / raw)
  To: linux-clk
  Cc: Stephen Boyd, Ralf Baechle, Michael Turquette, Masahiro Yamada,
	linux-mips, Haojian Zhuang, Eric Miao, Florian Fainelli,
	linux-kernel, adi-buildroot-devel, Greg Ungerer, linux-m68k,
	bcm-kernel-feedback-list, Wan ZongShun, Geert Uytterhoeven,
	Steven Miao, Russell King, linux-arm-kernel

Many of clk_disable() implementations just return for NULL pointer,
but this check is missing from some.  Let's make it tree-wide
consistent.  It will allow clock consumers to call clk_disable()
without NULL pointer check.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Wan Zongshun <mcuos.com@gmail.com>
---

I came back after a long pause.
You can see the discussion about the previous version:
https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html


Changes in v3:
  - Return only when clk is NULL.  Do not take care of error pointer.

Changes in v2:
  - Rebase on Linux 4.6-rc1

 arch/arm/mach-mmp/clock.c        | 3 +++
 arch/arm/mach-w90x900/clock.c    | 3 +++
 arch/blackfin/mach-bf609/clock.c | 3 +++
 arch/m68k/coldfire/clk.c         | 4 ++++
 arch/mips/bcm63xx/clk.c          | 3 +++
 5 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index ac6633d..28fe64c 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -67,6 +67,9 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return;
+
 	WARN_ON(clk->enabled == 0);
 
 	spin_lock_irqsave(&clocks_lock, flags);
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index 2c371ff..ac6fd1a 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -46,6 +46,9 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return;
+
 	WARN_ON(clk->enabled == 0);
 
 	spin_lock_irqsave(&clocks_lock, flags);
diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
index 3783058..392a59b 100644
--- a/arch/blackfin/mach-bf609/clock.c
+++ b/arch/blackfin/mach-bf609/clock.c
@@ -97,6 +97,9 @@ EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	if (clk->ops && clk->ops->disable)
 		clk->ops->disable(clk);
 }
diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
index fddfdcc..1e3c7e9 100644
--- a/arch/m68k/coldfire/clk.c
+++ b/arch/m68k/coldfire/clk.c
@@ -101,6 +101,10 @@ EXPORT_SYMBOL(clk_enable);
 void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
+
+	if (!clk)
+		return;
+
 	spin_lock_irqsave(&clk_lock, flags);
 	if ((--clk->enabled == 0) && clk->clk_ops)
 		clk->clk_ops->disable(clk);
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 6375652..b49fc9c 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -326,6 +326,9 @@ EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	mutex_lock(&clocks_mutex);
 	clk_disable_unlocked(clk);
 	mutex_unlock(&clocks_mutex);
-- 
1.9.1

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
  2016-09-16  7:44     ` Masahiro Yamada
  (?)
  (?)
@ 2016-09-16 23:11       ` Stephen Boyd
  -1 siblings, 0 replies; 21+ messages in thread
From: Stephen Boyd @ 2016-09-16 23:11 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michael Turquette, linux-clk, linux-mips, Eric Miao,
	Wan ZongShun, Steven Miao, Russell King,
	Linux Kernel Mailing List, Haojian Zhuang, adi-buildroot-devel,
	linux-m68k, Broadcom Kernel Feedback List, Ralf Baechle,
	Geert Uytterhoeven, Greg Ungerer, linux-arm-kernel,
	Florian Fainelli, Andrew Morton

On 09/16, Masahiro Yamada wrote:
> Hi Stephen, Michael,
> 
> 2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> > On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
> >> Many of clk_disable() implementations just return for NULL pointer,
> >> but this check is missing from some.  Let's make it tree-wide
> >> consistent.  It will allow clock consumers to call clk_disable()
> >> without NULL pointer check.
> >>
> >> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> >> Acked-by: Greg Ungerer <gerg@uclinux.org>
> >> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
> >> ---
> >>
> >> I came back after a long pause.
> >> You can see the discussion about the previous version:
> >> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
> >>
> >>
> >> Changes in v3:
> >>   - Return only when clk is NULL.  Do not take care of error pointer.
> >>
> >> Changes in v2:
> >>   - Rebase on Linux 4.6-rc1
> >>
> >>  arch/arm/mach-mmp/clock.c        | 3 +++
> >>  arch/arm/mach-w90x900/clock.c    | 3 +++
> >>  arch/blackfin/mach-bf609/clock.c | 3 +++
> >>  arch/m68k/coldfire/clk.c         | 4 ++++
> >>  arch/mips/bcm63xx/clk.c          | 3 +++
> >
> 
> 
> Gentle ping...
> 
> 
> If you are not keen on this,
> shall I split it per-arch and send to each arch subsystem?
> 

If we get acks from more arch maintainers we could take it
through clk tree, but we really don't maintain these other clk
implementations so it isn't very appropriate to take it through
clk tree anyway. Perhaps splitting it up per arch and sending it
that way and then Ccing akpm (aka the patch collector) would make
sure things get merged in a timely manner. Or Andrew could just
pick up this patch as is.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-09-16 23:11       ` Stephen Boyd
  0 siblings, 0 replies; 21+ messages in thread
From: Stephen Boyd @ 2016-09-16 23:11 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michael Turquette, linux-clk, linux-mips, Eric Miao,
	Wan ZongShun, Steven Miao, Russell King,
	Linux Kernel Mailing List, Haojian Zhuang, adi-buildroot-devel,
	linux-m68k, Broadcom Kernel Feedback List, Ralf Baechle,
	Geert Uytterhoeven, Greg Ungerer, linux-arm-kernel,
	Florian Fainelli, Andrew Morton

On 09/16, Masahiro Yamada wrote:
> Hi Stephen, Michael,
> 
> 2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> > On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
> >> Many of clk_disable() implementations just return for NULL pointer,
> >> but this check is missing from some.  Let's make it tree-wide
> >> consistent.  It will allow clock consumers to call clk_disable()
> >> without NULL pointer check.
> >>
> >> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> >> Acked-by: Greg Ungerer <gerg@uclinux.org>
> >> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
> >> ---
> >>
> >> I came back after a long pause.
> >> You can see the discussion about the previous version:
> >> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
> >>
> >>
> >> Changes in v3:
> >>   - Return only when clk is NULL.  Do not take care of error pointer.
> >>
> >> Changes in v2:
> >>   - Rebase on Linux 4.6-rc1
> >>
> >>  arch/arm/mach-mmp/clock.c        | 3 +++
> >>  arch/arm/mach-w90x900/clock.c    | 3 +++
> >>  arch/blackfin/mach-bf609/clock.c | 3 +++
> >>  arch/m68k/coldfire/clk.c         | 4 ++++
> >>  arch/mips/bcm63xx/clk.c          | 3 +++
> >
> 
> 
> Gentle ping...
> 
> 
> If you are not keen on this,
> shall I split it per-arch and send to each arch subsystem?
> 

If we get acks from more arch maintainers we could take it
through clk tree, but we really don't maintain these other clk
implementations so it isn't very appropriate to take it through
clk tree anyway. Perhaps splitting it up per arch and sending it
that way and then Ccing akpm (aka the patch collector) would make
sure things get merged in a timely manner. Or Andrew could just
pick up this patch as is.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-09-16 23:11       ` Stephen Boyd
  0 siblings, 0 replies; 21+ messages in thread
From: Stephen Boyd @ 2016-09-16 23:11 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michael Turquette, linux-clk, linux-mips, Eric Miao,
	Wan ZongShun, Steven Miao, Russell King,
	Linux Kernel Mailing List, Haojian Zhuang, adi-buildroot-devel,
	linux-m68k, Broadcom Kernel Feedback List, Ralf Baechle,
	Geert Uytterhoeven, Greg Ungerer, linux-arm-kernel,
	Florian Fainelli, Andrew Morton

On 09/16, Masahiro Yamada wrote:
> Hi Stephen, Michael,
> 
> 2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> > On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
> >> Many of clk_disable() implementations just return for NULL pointer,
> >> but this check is missing from some.  Let's make it tree-wide
> >> consistent.  It will allow clock consumers to call clk_disable()
> >> without NULL pointer check.
> >>
> >> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> >> Acked-by: Greg Ungerer <gerg@uclinux.org>
> >> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
> >> ---
> >>
> >> I came back after a long pause.
> >> You can see the discussion about the previous version:
> >> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
> >>
> >>
> >> Changes in v3:
> >>   - Return only when clk is NULL.  Do not take care of error pointer.
> >>
> >> Changes in v2:
> >>   - Rebase on Linux 4.6-rc1
> >>
> >>  arch/arm/mach-mmp/clock.c        | 3 +++
> >>  arch/arm/mach-w90x900/clock.c    | 3 +++
> >>  arch/blackfin/mach-bf609/clock.c | 3 +++
> >>  arch/m68k/coldfire/clk.c         | 4 ++++
> >>  arch/mips/bcm63xx/clk.c          | 3 +++
> >
> 
> 
> Gentle ping...
> 
> 
> If you are not keen on this,
> shall I split it per-arch and send to each arch subsystem?
> 

If we get acks from more arch maintainers we could take it
through clk tree, but we really don't maintain these other clk
implementations so it isn't very appropriate to take it through
clk tree anyway. Perhaps splitting it up per arch and sending it
that way and then Ccing akpm (aka the patch collector) would make
sure things get merged in a timely manner. Or Andrew could just
pick up this patch as is.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-09-16 23:11       ` Stephen Boyd
  0 siblings, 0 replies; 21+ messages in thread
From: Stephen Boyd @ 2016-09-16 23:11 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/16, Masahiro Yamada wrote:
> Hi Stephen, Michael,
> 
> 2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> > On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
> >> Many of clk_disable() implementations just return for NULL pointer,
> >> but this check is missing from some.  Let's make it tree-wide
> >> consistent.  It will allow clock consumers to call clk_disable()
> >> without NULL pointer check.
> >>
> >> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> >> Acked-by: Greg Ungerer <gerg@uclinux.org>
> >> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
> >> ---
> >>
> >> I came back after a long pause.
> >> You can see the discussion about the previous version:
> >> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
> >>
> >>
> >> Changes in v3:
> >>   - Return only when clk is NULL.  Do not take care of error pointer.
> >>
> >> Changes in v2:
> >>   - Rebase on Linux 4.6-rc1
> >>
> >>  arch/arm/mach-mmp/clock.c        | 3 +++
> >>  arch/arm/mach-w90x900/clock.c    | 3 +++
> >>  arch/blackfin/mach-bf609/clock.c | 3 +++
> >>  arch/m68k/coldfire/clk.c         | 4 ++++
> >>  arch/mips/bcm63xx/clk.c          | 3 +++
> >
> 
> 
> Gentle ping...
> 
> 
> If you are not keen on this,
> shall I split it per-arch and send to each arch subsystem?
> 

If we get acks from more arch maintainers we could take it
through clk tree, but we really don't maintain these other clk
implementations so it isn't very appropriate to take it through
clk tree anyway. Perhaps splitting it up per arch and sending it
that way and then Ccing akpm (aka the patch collector) would make
sure things get merged in a timely manner. Or Andrew could just
pick up this patch as is.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
  2016-08-25 15:27   ` Florian Fainelli
  (?)
  (?)
@ 2016-09-16  7:44     ` Masahiro Yamada
  -1 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-09-16  7:44 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-mips, Eric Miao, Wan ZongShun, Steven Miao,
	Russell King, Linux Kernel Mailing List, Haojian Zhuang,
	adi-buildroot-devel, linux-m68k, Broadcom Kernel Feedback List,
	Ralf Baechle, Geert Uytterhoeven, Greg Ungerer, linux-arm-kernel,
	Florian Fainelli

Hi Stephen, Michael,

2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
>> Many of clk_disable() implementations just return for NULL pointer,
>> but this check is missing from some.  Let's make it tree-wide
>> consistent.  It will allow clock consumers to call clk_disable()
>> without NULL pointer check.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Acked-by: Greg Ungerer <gerg@uclinux.org>
>> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
>> ---
>>
>> I came back after a long pause.
>> You can see the discussion about the previous version:
>> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
>>
>>
>> Changes in v3:
>>   - Return only when clk is NULL.  Do not take care of error pointer.
>>
>> Changes in v2:
>>   - Rebase on Linux 4.6-rc1
>>
>>  arch/arm/mach-mmp/clock.c        | 3 +++
>>  arch/arm/mach-w90x900/clock.c    | 3 +++
>>  arch/blackfin/mach-bf609/clock.c | 3 +++
>>  arch/m68k/coldfire/clk.c         | 4 ++++
>>  arch/mips/bcm63xx/clk.c          | 3 +++
>


Gentle ping...


If you are not keen on this,
shall I split it per-arch and send to each arch subsystem?



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
  2016-08-25 15:27   ` Florian Fainelli
  (?)
  (?)
@ 2016-09-16  7:44   ` Masahiro Yamada
  -1 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-09-16  7:44 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-mips, Eric Miao, Wan ZongShun, Steven Miao,
	Russell King, Linux Kernel Mailing List, Haojian Zhuang,
	adi-buildroot-devel, linux-m68k, Broadcom Kernel Feedback List,
	Ralf Baechle, Geert Uytterhoeven, Greg Ungerer, linux-arm-kernel,
	Florian Fainelli

Hi Stephen, Michael,

2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
>> Many of clk_disable() implementations just return for NULL pointer,
>> but this check is missing from some.  Let's make it tree-wide
>> consistent.  It will allow clock consumers to call clk_disable()
>> without NULL pointer check.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Acked-by: Greg Ungerer <gerg@uclinux.org>
>> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
>> ---
>>
>> I came back after a long pause.
>> You can see the discussion about the previous version:
>> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
>>
>>
>> Changes in v3:
>>   - Return only when clk is NULL.  Do not take care of error pointer.
>>
>> Changes in v2:
>>   - Rebase on Linux 4.6-rc1
>>
>>  arch/arm/mach-mmp/clock.c        | 3 +++
>>  arch/arm/mach-w90x900/clock.c    | 3 +++
>>  arch/blackfin/mach-bf609/clock.c | 3 +++
>>  arch/m68k/coldfire/clk.c         | 4 ++++
>>  arch/mips/bcm63xx/clk.c          | 3 +++
>


Gentle ping...


If you are not keen on this,
shall I split it per-arch and send to each arch subsystem?



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-09-16  7:44     ` Masahiro Yamada
  0 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-09-16  7:44 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-mips, Eric Miao, Wan ZongShun, Steven Miao,
	Russell King, Linux Kernel Mailing List, Haojian Zhuang,
	adi-buildroot-devel, linux-m68k, Broadcom Kernel Feedback List,
	Ralf Baechle, Geert Uytterhoeven, Greg Ungerer, linux-arm-kernel,
	Florian Fainelli

Hi Stephen, Michael,

2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
>> Many of clk_disable() implementations just return for NULL pointer,
>> but this check is missing from some.  Let's make it tree-wide
>> consistent.  It will allow clock consumers to call clk_disable()
>> without NULL pointer check.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Acked-by: Greg Ungerer <gerg@uclinux.org>
>> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
>> ---
>>
>> I came back after a long pause.
>> You can see the discussion about the previous version:
>> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
>>
>>
>> Changes in v3:
>>   - Return only when clk is NULL.  Do not take care of error pointer.
>>
>> Changes in v2:
>>   - Rebase on Linux 4.6-rc1
>>
>>  arch/arm/mach-mmp/clock.c        | 3 +++
>>  arch/arm/mach-w90x900/clock.c    | 3 +++
>>  arch/blackfin/mach-bf609/clock.c | 3 +++
>>  arch/m68k/coldfire/clk.c         | 4 ++++
>>  arch/mips/bcm63xx/clk.c          | 3 +++
>


Gentle ping...


If you are not keen on this,
shall I split it per-arch and send to each arch subsystem?



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-09-16  7:44     ` Masahiro Yamada
  0 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-09-16  7:44 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-mips, Eric Miao, Wan ZongShun, Steven Miao,
	Russell King, Linux Kernel Mailing List, Haojian Zhuang,
	adi-buildroot-devel, linux-m68k, Broadcom Kernel Feedback List,
	Ralf Baechle, Geert Uytterhoeven, Greg Ungerer, linux-arm-kernel,
	Florian Fainelli

Hi Stephen, Michael,

2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
>> Many of clk_disable() implementations just return for NULL pointer,
>> but this check is missing from some.  Let's make it tree-wide
>> consistent.  It will allow clock consumers to call clk_disable()
>> without NULL pointer check.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Acked-by: Greg Ungerer <gerg@uclinux.org>
>> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
>> ---
>>
>> I came back after a long pause.
>> You can see the discussion about the previous version:
>> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
>>
>>
>> Changes in v3:
>>   - Return only when clk is NULL.  Do not take care of error pointer.
>>
>> Changes in v2:
>>   - Rebase on Linux 4.6-rc1
>>
>>  arch/arm/mach-mmp/clock.c        | 3 +++
>>  arch/arm/mach-w90x900/clock.c    | 3 +++
>>  arch/blackfin/mach-bf609/clock.c | 3 +++
>>  arch/m68k/coldfire/clk.c         | 4 ++++
>>  arch/mips/bcm63xx/clk.c          | 3 +++
>


Gentle ping...


If you are not keen on this,
shall I split it per-arch and send to each arch subsystem?



-- 
Best Regards
Masahiro Yamada

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

* [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-09-16  7:44     ` Masahiro Yamada
  0 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-09-16  7:44 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stephen, Michael,

2016-08-26 0:27 GMT+09:00 Florian Fainelli <f.fainelli@gmail.com>:
> On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
>> Many of clk_disable() implementations just return for NULL pointer,
>> but this check is missing from some.  Let's make it tree-wide
>> consistent.  It will allow clock consumers to call clk_disable()
>> without NULL pointer check.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Acked-by: Greg Ungerer <gerg@uclinux.org>
>> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
>> ---
>>
>> I came back after a long pause.
>> You can see the discussion about the previous version:
>> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
>>
>>
>> Changes in v3:
>>   - Return only when clk is NULL.  Do not take care of error pointer.
>>
>> Changes in v2:
>>   - Rebase on Linux 4.6-rc1
>>
>>  arch/arm/mach-mmp/clock.c        | 3 +++
>>  arch/arm/mach-w90x900/clock.c    | 3 +++
>>  arch/blackfin/mach-bf609/clock.c | 3 +++
>>  arch/m68k/coldfire/clk.c         | 4 ++++
>>  arch/mips/bcm63xx/clk.c          | 3 +++
>


Gentle ping...


If you are not keen on this,
shall I split it per-arch and send to each arch subsystem?



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
  2016-08-24 17:26 ` Masahiro Yamada
  (?)
@ 2016-08-25 15:27   ` Florian Fainelli
  -1 siblings, 0 replies; 21+ messages in thread
From: Florian Fainelli @ 2016-08-25 15:27 UTC (permalink / raw)
  To: Masahiro Yamada, linux-clk
  Cc: Stephen Boyd, Ralf Baechle, Michael Turquette, linux-mips,
	Haojian Zhuang, Eric Miao, linux-kernel, adi-buildroot-devel,
	Greg Ungerer, linux-m68k, bcm-kernel-feedback-list, Wan ZongShun,
	Geert Uytterhoeven, Steven Miao, Russell King, linux-arm-kernel

On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
> Many of clk_disable() implementations just return for NULL pointer,
> but this check is missing from some.  Let's make it tree-wide
> consistent.  It will allow clock consumers to call clk_disable()
> without NULL pointer check.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
> ---
> 
> I came back after a long pause.
> You can see the discussion about the previous version:
> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
> 
> 
> Changes in v3:
>   - Return only when clk is NULL.  Do not take care of error pointer.
> 
> Changes in v2:
>   - Rebase on Linux 4.6-rc1
> 
>  arch/arm/mach-mmp/clock.c        | 3 +++
>  arch/arm/mach-w90x900/clock.c    | 3 +++
>  arch/blackfin/mach-bf609/clock.c | 3 +++
>  arch/m68k/coldfire/clk.c         | 4 ++++
>  arch/mips/bcm63xx/clk.c          | 3 +++

For bcm63xx:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-25 15:27   ` Florian Fainelli
  0 siblings, 0 replies; 21+ messages in thread
From: Florian Fainelli @ 2016-08-25 15:27 UTC (permalink / raw)
  To: Masahiro Yamada, linux-clk
  Cc: Stephen Boyd, Ralf Baechle, Michael Turquette, linux-mips,
	Haojian Zhuang, Eric Miao, linux-kernel, adi-buildroot-devel,
	Greg Ungerer, linux-m68k, bcm-kernel-feedback-list, Wan ZongShun,
	Geert Uytterhoeven, Steven Miao, Russell King, linux-arm-kernel

On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
> Many of clk_disable() implementations just return for NULL pointer,
> but this check is missing from some.  Let's make it tree-wide
> consistent.  It will allow clock consumers to call clk_disable()
> without NULL pointer check.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
> ---
> 
> I came back after a long pause.
> You can see the discussion about the previous version:
> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
> 
> 
> Changes in v3:
>   - Return only when clk is NULL.  Do not take care of error pointer.
> 
> Changes in v2:
>   - Rebase on Linux 4.6-rc1
> 
>  arch/arm/mach-mmp/clock.c        | 3 +++
>  arch/arm/mach-w90x900/clock.c    | 3 +++
>  arch/blackfin/mach-bf609/clock.c | 3 +++
>  arch/m68k/coldfire/clk.c         | 4 ++++
>  arch/mips/bcm63xx/clk.c          | 3 +++

For bcm63xx:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-25 15:27   ` Florian Fainelli
  0 siblings, 0 replies; 21+ messages in thread
From: Florian Fainelli @ 2016-08-25 15:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/24/2016 10:26 AM, Masahiro Yamada wrote:
> Many of clk_disable() implementations just return for NULL pointer,
> but this check is missing from some.  Let's make it tree-wide
> consistent.  It will allow clock consumers to call clk_disable()
> without NULL pointer check.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
> Acked-by: Wan Zongshun <mcuos.com@gmail.com>
> ---
> 
> I came back after a long pause.
> You can see the discussion about the previous version:
> https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html
> 
> 
> Changes in v3:
>   - Return only when clk is NULL.  Do not take care of error pointer.
> 
> Changes in v2:
>   - Rebase on Linux 4.6-rc1
> 
>  arch/arm/mach-mmp/clock.c        | 3 +++
>  arch/arm/mach-w90x900/clock.c    | 3 +++
>  arch/blackfin/mach-bf609/clock.c | 3 +++
>  arch/m68k/coldfire/clk.c         | 4 ++++
>  arch/mips/bcm63xx/clk.c          | 3 +++

For bcm63xx:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
  2016-08-24 17:26 ` Masahiro Yamada
  (?)
  (?)
@ 2016-08-25  7:52   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2016-08-25  7:52 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-clk, Stephen Boyd, Ralf Baechle, Michael Turquette,
	Linux MIPS Mailing List, Haojian Zhuang, Eric Miao,
	Florian Fainelli, linux-kernel, adi-buildroot-devel,
	Greg Ungerer, linux-m68k, bcm-kernel-feedback-list, Wan ZongShun,
	Steven Miao, Russell King, linux-arm-kernel

On Wed, Aug 24, 2016 at 7:26 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Many of clk_disable() implementations just return for NULL pointer,
> but this check is missing from some.  Let's make it tree-wide
> consistent.  It will allow clock consumers to call clk_disable()
> without NULL pointer check.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
> Acked-by: Wan Zongshun <mcuos.com@gmail.com>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
  2016-08-24 17:26 ` Masahiro Yamada
  (?)
  (?)
@ 2016-08-25  7:52 ` Geert Uytterhoeven
  -1 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2016-08-25  7:52 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-clk, Stephen Boyd, Ralf Baechle, Michael Turquette,
	Linux MIPS Mailing List, Haojian Zhuang, Eric Miao,
	Florian Fainelli, linux-kernel, adi-buildroot-devel,
	Greg Ungerer, linux-m68k, bcm-kernel-feedback-list, Wan ZongShun,
	Steven Miao, Russell King

On Wed, Aug 24, 2016 at 7:26 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Many of clk_disable() implementations just return for NULL pointer,
> but this check is missing from some.  Let's make it tree-wide
> consistent.  It will allow clock consumers to call clk_disable()
> without NULL pointer check.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
> Acked-by: Wan Zongshun <mcuos.com@gmail.com>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-25  7:52   ` Geert Uytterhoeven
  0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2016-08-25  7:52 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-clk, Stephen Boyd, Ralf Baechle, Michael Turquette,
	Linux MIPS Mailing List, Haojian Zhuang, Eric Miao,
	Florian Fainelli, linux-kernel, adi-buildroot-devel,
	Greg Ungerer, linux-m68k, bcm-kernel-feedback-list, Wan ZongShun,
	Steven Miao, Russell King, linux-arm-kernel

On Wed, Aug 24, 2016 at 7:26 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Many of clk_disable() implementations just return for NULL pointer,
> but this check is missing from some.  Let's make it tree-wide
> consistent.  It will allow clock consumers to call clk_disable()
> without NULL pointer check.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
> Acked-by: Wan Zongshun <mcuos.com@gmail.com>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-25  7:52   ` Geert Uytterhoeven
  0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2016-08-25  7:52 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-clk, Stephen Boyd, Ralf Baechle, Michael Turquette,
	Linux MIPS Mailing List, Haojian Zhuang, Eric Miao,
	Florian Fainelli, linux-kernel, adi-buildroot-devel,
	Greg Ungerer, linux-m68k, bcm-kernel-feedback-list, Wan ZongShun,
	Steven Miao, Russell King, linux-arm-kernel

On Wed, Aug 24, 2016 at 7:26 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Many of clk_disable() implementations just return for NULL pointer,
> but this check is missing from some.  Let's make it tree-wide
> consistent.  It will allow clock consumers to call clk_disable()
> without NULL pointer check.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
> Acked-by: Wan Zongshun <mcuos.com@gmail.com>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-25  7:52   ` Geert Uytterhoeven
  0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2016-08-25  7:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 24, 2016 at 7:26 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Many of clk_disable() implementations just return for NULL pointer,
> but this check is missing from some.  Let's make it tree-wide
> consistent.  It will allow clock consumers to call clk_disable()
> without NULL pointer check.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
> Acked-by: Wan Zongshun <mcuos.com@gmail.com>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-24 17:26 ` Masahiro Yamada
  0 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-08-24 17:26 UTC (permalink / raw)
  To: linux-clk
  Cc: Stephen Boyd, Ralf Baechle, Michael Turquette, Masahiro Yamada,
	linux-mips, Haojian Zhuang, Eric Miao, Florian Fainelli,
	linux-kernel, adi-buildroot-devel, Greg Ungerer, linux-m68k,
	bcm-kernel-feedback-list, Wan ZongShun, Geert Uytterhoeven,
	Steven Miao, Russell King, linux-arm-kernel

Many of clk_disable() implementations just return for NULL pointer,
but this check is missing from some.  Let's make it tree-wide
consistent.  It will allow clock consumers to call clk_disable()
without NULL pointer check.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Wan Zongshun <mcuos.com@gmail.com>
---

I came back after a long pause.
You can see the discussion about the previous version:
https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html


Changes in v3:
  - Return only when clk is NULL.  Do not take care of error pointer.

Changes in v2:
  - Rebase on Linux 4.6-rc1

 arch/arm/mach-mmp/clock.c        | 3 +++
 arch/arm/mach-w90x900/clock.c    | 3 +++
 arch/blackfin/mach-bf609/clock.c | 3 +++
 arch/m68k/coldfire/clk.c         | 4 ++++
 arch/mips/bcm63xx/clk.c          | 3 +++
 5 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index ac6633d..28fe64c 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -67,6 +67,9 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return;
+
 	WARN_ON(clk->enabled == 0);
 
 	spin_lock_irqsave(&clocks_lock, flags);
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index 2c371ff..ac6fd1a 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -46,6 +46,9 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return;
+
 	WARN_ON(clk->enabled == 0);
 
 	spin_lock_irqsave(&clocks_lock, flags);
diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
index 3783058..392a59b 100644
--- a/arch/blackfin/mach-bf609/clock.c
+++ b/arch/blackfin/mach-bf609/clock.c
@@ -97,6 +97,9 @@ EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	if (clk->ops && clk->ops->disable)
 		clk->ops->disable(clk);
 }
diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
index fddfdcc..1e3c7e9 100644
--- a/arch/m68k/coldfire/clk.c
+++ b/arch/m68k/coldfire/clk.c
@@ -101,6 +101,10 @@ EXPORT_SYMBOL(clk_enable);
 void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
+
+	if (!clk)
+		return;
+
 	spin_lock_irqsave(&clk_lock, flags);
 	if ((--clk->enabled == 0) && clk->clk_ops)
 		clk->clk_ops->disable(clk);
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 6375652..b49fc9c 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -326,6 +326,9 @@ EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	mutex_lock(&clocks_mutex);
 	clk_disable_unlocked(clk);
 	mutex_unlock(&clocks_mutex);
-- 
1.9.1

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

* [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-24 17:26 ` Masahiro Yamada
  0 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-08-24 17:26 UTC (permalink / raw)
  To: linux-clk
  Cc: Stephen Boyd, Ralf Baechle, Michael Turquette, Masahiro Yamada,
	linux-mips, Haojian Zhuang, Eric Miao, Florian Fainelli,
	linux-kernel, adi-buildroot-devel, Greg Ungerer, linux-m68k,
	bcm-kernel-feedback-list, Wan ZongShun, Geert Uytterhoeven,
	Steven Miao, Russell King, linux-arm-kernel

Many of clk_disable() implementations just return for NULL pointer,
but this check is missing from some.  Let's make it tree-wide
consistent.  It will allow clock consumers to call clk_disable()
without NULL pointer check.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Wan Zongshun <mcuos.com@gmail.com>
---

I came back after a long pause.
You can see the discussion about the previous version:
https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html


Changes in v3:
  - Return only when clk is NULL.  Do not take care of error pointer.

Changes in v2:
  - Rebase on Linux 4.6-rc1

 arch/arm/mach-mmp/clock.c        | 3 +++
 arch/arm/mach-w90x900/clock.c    | 3 +++
 arch/blackfin/mach-bf609/clock.c | 3 +++
 arch/m68k/coldfire/clk.c         | 4 ++++
 arch/mips/bcm63xx/clk.c          | 3 +++
 5 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index ac6633d..28fe64c 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -67,6 +67,9 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return;
+
 	WARN_ON(clk->enabled == 0);
 
 	spin_lock_irqsave(&clocks_lock, flags);
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index 2c371ff..ac6fd1a 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -46,6 +46,9 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return;
+
 	WARN_ON(clk->enabled == 0);
 
 	spin_lock_irqsave(&clocks_lock, flags);
diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
index 3783058..392a59b 100644
--- a/arch/blackfin/mach-bf609/clock.c
+++ b/arch/blackfin/mach-bf609/clock.c
@@ -97,6 +97,9 @@ EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	if (clk->ops && clk->ops->disable)
 		clk->ops->disable(clk);
 }
diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
index fddfdcc..1e3c7e9 100644
--- a/arch/m68k/coldfire/clk.c
+++ b/arch/m68k/coldfire/clk.c
@@ -101,6 +101,10 @@ EXPORT_SYMBOL(clk_enable);
 void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
+
+	if (!clk)
+		return;
+
 	spin_lock_irqsave(&clk_lock, flags);
 	if ((--clk->enabled == 0) && clk->clk_ops)
 		clk->clk_ops->disable(clk);
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 6375652..b49fc9c 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -326,6 +326,9 @@ EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	mutex_lock(&clocks_mutex);
 	clk_disable_unlocked(clk);
 	mutex_unlock(&clocks_mutex);
-- 
1.9.1

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

* [PATCH v3] clk: let clk_disable() return immediately if clk is NULL
@ 2016-08-24 17:26 ` Masahiro Yamada
  0 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2016-08-24 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

Many of clk_disable() implementations just return for NULL pointer,
but this check is missing from some.  Let's make it tree-wide
consistent.  It will allow clock consumers to call clk_disable()
without NULL pointer check.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Wan Zongshun <mcuos.com@gmail.com>
---

I came back after a long pause.
You can see the discussion about the previous version:
https://www.linux-mips.org/archives/linux-mips/2016-04/msg00063.html


Changes in v3:
  - Return only when clk is NULL.  Do not take care of error pointer.

Changes in v2:
  - Rebase on Linux 4.6-rc1

 arch/arm/mach-mmp/clock.c        | 3 +++
 arch/arm/mach-w90x900/clock.c    | 3 +++
 arch/blackfin/mach-bf609/clock.c | 3 +++
 arch/m68k/coldfire/clk.c         | 4 ++++
 arch/mips/bcm63xx/clk.c          | 3 +++
 5 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index ac6633d..28fe64c 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -67,6 +67,9 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return;
+
 	WARN_ON(clk->enabled == 0);
 
 	spin_lock_irqsave(&clocks_lock, flags);
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index 2c371ff..ac6fd1a 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -46,6 +46,9 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return;
+
 	WARN_ON(clk->enabled == 0);
 
 	spin_lock_irqsave(&clocks_lock, flags);
diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
index 3783058..392a59b 100644
--- a/arch/blackfin/mach-bf609/clock.c
+++ b/arch/blackfin/mach-bf609/clock.c
@@ -97,6 +97,9 @@ EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	if (clk->ops && clk->ops->disable)
 		clk->ops->disable(clk);
 }
diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
index fddfdcc..1e3c7e9 100644
--- a/arch/m68k/coldfire/clk.c
+++ b/arch/m68k/coldfire/clk.c
@@ -101,6 +101,10 @@ EXPORT_SYMBOL(clk_enable);
 void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
+
+	if (!clk)
+		return;
+
 	spin_lock_irqsave(&clk_lock, flags);
 	if ((--clk->enabled == 0) && clk->clk_ops)
 		clk->clk_ops->disable(clk);
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 6375652..b49fc9c 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -326,6 +326,9 @@ EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	mutex_lock(&clocks_mutex);
 	clk_disable_unlocked(clk);
 	mutex_unlock(&clocks_mutex);
-- 
1.9.1

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

end of thread, other threads:[~2016-09-16 23:11 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24 17:26 [PATCH v3] clk: let clk_disable() return immediately if clk is NULL Masahiro Yamada
  -- strict thread matches above, loose matches on Subject: below --
2016-08-24 17:26 Masahiro Yamada
2016-08-24 17:26 ` Masahiro Yamada
2016-08-24 17:26 ` Masahiro Yamada
2016-08-25  7:52 ` Geert Uytterhoeven
2016-08-25  7:52 ` Geert Uytterhoeven
2016-08-25  7:52   ` Geert Uytterhoeven
2016-08-25  7:52   ` Geert Uytterhoeven
2016-08-25  7:52   ` Geert Uytterhoeven
2016-08-25 15:27 ` Florian Fainelli
2016-08-25 15:27   ` Florian Fainelli
2016-08-25 15:27   ` Florian Fainelli
2016-09-16  7:44   ` Masahiro Yamada
2016-09-16  7:44   ` Masahiro Yamada
2016-09-16  7:44     ` Masahiro Yamada
2016-09-16  7:44     ` Masahiro Yamada
2016-09-16  7:44     ` Masahiro Yamada
2016-09-16 23:11     ` Stephen Boyd
2016-09-16 23:11       ` Stephen Boyd
2016-09-16 23:11       ` Stephen Boyd
2016-09-16 23:11       ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.