linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] make clk_get_rate implementations behavior more consistent
@ 2017-07-18 10:17 Jonas Gorski
  2017-07-18 10:17 ` [PATCH 1/9] ARM: ep93xx: allow NULL clock for clk_get_rate Jonas Gorski
                   ` (9 more replies)
  0 siblings, 10 replies; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: adi-buildroot-devel, bcm-kernel-feedback-list, linux-arm-kernel,
	linux-kernel, linux-m68k, linux-mips

The common clock and several other clock API implementations allow
calling clk_get_rate with a NULL pointer. While not specified as
expected behavior of the API, device drivers have come to rely on that,
causing them to OOPS when run on a platform with a different clock API
implementation.

Fix this by making sure all clk_get_rate implementations handle
NULL clocks instead of OOPSing.

While some custom implementations even allow ERR_PTR()s, I decided
against that as IIRC the usual idea is that errors should be handled and
not silently carried over.

Cc: adi-buildroot-devel@lists.sourceforge.net
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-mips@linux-mips.org

Jonas Gorski (9):
  ARM: ep93xx: allow NULL clock for clk_get_rate
  ARM: mmp: allow NULL clock for clk_get_rate
  blackfin: bf609: allow NULL clock for clk_get_rate
  m68k: allow NULL clock for clk_get_rate
  MIPS: AR7: allow NULL clock for clk_get_rate
  MIPS: BCM63XX: allow NULL clock for clk_get_rate
  MIPS: Loongson 2F: allow NULL clock for clk_get_rate
  MIPS: ralink: allow NULL clock for clk_get_rate
  unicore32: allow NULL clock for clk_get_rate

 arch/arm/mach-ep93xx/clock.c           | 3 +++
 arch/arm/mach-mmp/clock.c              | 4 +++-
 arch/blackfin/mach-bf609/clock.c       | 2 +-
 arch/m68k/coldfire/clk.c               | 3 +++
 arch/mips/ar7/clock.c                  | 3 +++
 arch/mips/bcm63xx/clk.c                | 3 +++
 arch/mips/loongson64/lemote-2f/clock.c | 3 +++
 arch/mips/ralink/clk.c                 | 3 +++
 arch/unicore32/kernel/clock.c          | 3 +++
 9 files changed, 25 insertions(+), 2 deletions(-)

-- 
2.11.0

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

* [PATCH 1/9] ARM: ep93xx: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-19  5:04   ` Alexander Sverdlin
  2017-07-18 10:17 ` [PATCH 2/9] ARM: mmp: " Jonas Gorski
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: Hartley Sweeten, Alexander Sverdlin, Russell King,
	linux-arm-kernel, linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: 1d81eedb8f6c ("[ARM] 3634/1: ep93xx: initial implementation of the clk_* API")
Cc: Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/arm/mach-ep93xx/clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 39ef3b613912..f0768befafe8 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -316,6 +316,9 @@ static unsigned long get_uart_rate(struct clk *clk)
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	if (clk->get_rate)
 		return clk->get_rate(clk);
 
-- 
2.11.0

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

* [PATCH 2/9] ARM: mmp: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
  2017-07-18 10:17 ` [PATCH 1/9] ARM: ep93xx: allow NULL clock for clk_get_rate Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-18 10:17 ` [PATCH 3/9] blackfin: bf609: " Jonas Gorski
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: Eric Miao, Haojian Zhuang, Russell King, linux-arm-kernel,
	linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: 49cbe78637eb ("[ARM] pxa: add base support for Marvell's PXA168 processor line")
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/arm/mach-mmp/clock.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index 28fe64c6e2f5..bdfb113431ec 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -83,7 +83,9 @@ unsigned long clk_get_rate(struct clk *clk)
 {
 	unsigned long rate;
 
-	if (clk->ops->getrate)
+	if (!clk)
+		rate = 0;
+	else if (clk->ops->getrate)
 		rate = clk->ops->getrate(clk);
 	else
 		rate = clk->rate;
-- 
2.11.0

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

* [PATCH 3/9] blackfin: bf609: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
  2017-07-18 10:17 ` [PATCH 1/9] ARM: ep93xx: allow NULL clock for clk_get_rate Jonas Gorski
  2017-07-18 10:17 ` [PATCH 2/9] ARM: mmp: " Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-18 18:54   ` Masahiro Yamada
  2017-07-18 10:17 ` [PATCH 4/9] m68k: " Jonas Gorski
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: Steven Miao, Masahiro Yamada, Andrew Morton, adi-buildroot-devel,
	linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: 969003152aa9 ("blackfin: bf60x: add clock support")
Cc: Steven Miao <realmz6@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: adi-buildroot-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/blackfin/mach-bf609/clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
index 392a59b9a504..21a0ec18829f 100644
--- a/arch/blackfin/mach-bf609/clock.c
+++ b/arch/blackfin/mach-bf609/clock.c
@@ -109,7 +109,7 @@ EXPORT_SYMBOL(clk_disable);
 unsigned long clk_get_rate(struct clk *clk)
 {
 	unsigned long ret = 0;
-	if (clk->ops && clk->ops->get_rate)
+	if (clk && clk->ops && clk->ops->get_rate)
 		ret = clk->ops->get_rate(clk);
 	return ret;
 }
-- 
2.11.0

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

* [PATCH 4/9] m68k: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
                   ` (2 preceding siblings ...)
  2017-07-18 10:17 ` [PATCH 3/9] blackfin: bf609: " Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-18 12:03   ` Greg Ungerer
  2017-07-18 10:17 ` [PATCH 5/9] MIPS: AR7: " Jonas Gorski
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: Greg Ungerer, Geert Uytterhoeven, linux-m68k, linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: facdf0ed4f59 ("m68knommu: introduce basic clk infrastructure")
Cc: Greg Ungerer <gerg@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/m68k/coldfire/clk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
index 1e3c7e9193d1..856069a3196d 100644
--- a/arch/m68k/coldfire/clk.c
+++ b/arch/m68k/coldfire/clk.c
@@ -121,6 +121,9 @@ EXPORT_SYMBOL(clk_put);
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	return clk->rate;
 }
 EXPORT_SYMBOL(clk_get_rate);
-- 
2.11.0

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

* [PATCH 5/9] MIPS: AR7: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
                   ` (3 preceding siblings ...)
  2017-07-18 10:17 ` [PATCH 4/9] m68k: " Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-18 10:17 ` [PATCH 6/9] MIPS: BCM63XX: " Jonas Gorski
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: Ralf Baechle, Paul Gortmaker, James Hogan, linux-mips,
	linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: 780019ddf02f ("MIPS: AR7: Implement clock API")
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/mips/ar7/clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/ar7/clock.c b/arch/mips/ar7/clock.c
index dda422a0f36c..0137656107a9 100644
--- a/arch/mips/ar7/clock.c
+++ b/arch/mips/ar7/clock.c
@@ -430,6 +430,9 @@ EXPORT_SYMBOL(clk_disable);
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	return clk->rate;
 }
 EXPORT_SYMBOL(clk_get_rate);
-- 
2.11.0

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

* [PATCH 6/9] MIPS: BCM63XX: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
                   ` (4 preceding siblings ...)
  2017-07-18 10:17 ` [PATCH 5/9] MIPS: AR7: " Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-18 19:55   ` Florian Fainelli
  2017-07-18 10:17 ` [PATCH 7/9] MIPS: Loongson 2F: " Jonas Gorski
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: Ralf Baechle, Florian Fainelli, bcm-kernel-feedback-list,
	James Hogan, linux-mips, linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/mips/bcm63xx/clk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 73626040e4d6..19577f771c1f 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -339,6 +339,9 @@ EXPORT_SYMBOL(clk_disable);
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	return clk->rate;
 }
 
-- 
2.11.0

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

* [PATCH 7/9] MIPS: Loongson 2F: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
                   ` (5 preceding siblings ...)
  2017-07-18 10:17 ` [PATCH 6/9] MIPS: BCM63XX: " Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-18 10:17 ` [PATCH 8/9] MIPS: ralink: " Jonas Gorski
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: Ralf Baechle, linux-mips, linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter, as some device
drivers rely on this.

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: f8ede0f700f5 ("MIPS: Loongson 2F: Add CPU frequency scaling support")
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/mips/loongson64/lemote-2f/clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/loongson64/lemote-2f/clock.c b/arch/mips/loongson64/lemote-2f/clock.c
index a78fb657068c..8281334df9c8 100644
--- a/arch/mips/loongson64/lemote-2f/clock.c
+++ b/arch/mips/loongson64/lemote-2f/clock.c
@@ -80,6 +80,9 @@ EXPORT_SYMBOL(clk_disable);
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	return (unsigned long)clk->rate;
 }
 EXPORT_SYMBOL(clk_get_rate);
-- 
2.11.0

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

* [PATCH 8/9] MIPS: ralink: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
                   ` (6 preceding siblings ...)
  2017-07-18 10:17 ` [PATCH 7/9] MIPS: Loongson 2F: " Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-18 10:17 ` [PATCH 9/9] unicore32: " Jonas Gorski
  2017-07-18 12:01 ` [PATCH 0/9] make clk_get_rate implementations behavior more consistent Geert Uytterhoeven
  9 siblings, 0 replies; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: John Crispin, Ralf Baechle, linux-mips, linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: 3f0a06b0368d ("MIPS: ralink: adds clkdev code")
Cc: John Crispin <john@phrozen.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/mips/ralink/clk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/ralink/clk.c b/arch/mips/ralink/clk.c
index eb1c61917eb7..1b7df115eb60 100644
--- a/arch/mips/ralink/clk.c
+++ b/arch/mips/ralink/clk.c
@@ -53,6 +53,9 @@ EXPORT_SYMBOL_GPL(clk_disable);
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	return clk->rate;
 }
 EXPORT_SYMBOL_GPL(clk_get_rate);
-- 
2.11.0

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

* [PATCH 9/9] unicore32: allow NULL clock for clk_get_rate
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
                   ` (7 preceding siblings ...)
  2017-07-18 10:17 ` [PATCH 8/9] MIPS: ralink: " Jonas Gorski
@ 2017-07-18 10:17 ` Jonas Gorski
  2017-07-18 12:01 ` [PATCH 0/9] make clk_get_rate implementations behavior more consistent Geert Uytterhoeven
  9 siblings, 0 replies; 17+ messages in thread
From: Jonas Gorski @ 2017-07-18 10:17 UTC (permalink / raw)
  Cc: Guan Xuetao, linux-kernel

Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.

Fixes: 64909882862e ("unicore32 additional architecture files: pm related files")
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: linux-kernel@vger.kernel.org
Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/unicore32/kernel/clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/unicore32/kernel/clock.c b/arch/unicore32/kernel/clock.c
index b1ca775f6f6e..d867f34fdb74 100644
--- a/arch/unicore32/kernel/clock.c
+++ b/arch/unicore32/kernel/clock.c
@@ -92,6 +92,9 @@ EXPORT_SYMBOL(clk_disable);
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	return clk->rate;
 }
 EXPORT_SYMBOL(clk_get_rate);
-- 
2.11.0

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

* Re: [PATCH 0/9] make clk_get_rate implementations behavior more consistent
  2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
                   ` (8 preceding siblings ...)
  2017-07-18 10:17 ` [PATCH 9/9] unicore32: " Jonas Gorski
@ 2017-07-18 12:01 ` Geert Uytterhoeven
  9 siblings, 0 replies; 17+ messages in thread
From: Geert Uytterhoeven @ 2017-07-18 12:01 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: adi-buildroot-devel@lists.sourceforge.net,
	bcm-kernel-feedback-list, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-m68k, Linux MIPS Mailing List

Hi Jonas,

On Tue, Jul 18, 2017 at 12:17 PM, Jonas Gorski <jonas.gorski@gmail.com> wrote:
> The common clock and several other clock API implementations allow
> calling clk_get_rate with a NULL pointer. While not specified as
> expected behavior of the API, device drivers have come to rely on that,
> causing them to OOPS when run on a platform with a different clock API
> implementation.
>
> Fix this by making sure all clk_get_rate implementations handle
> NULL clocks instead of OOPSing.
>
> While some custom implementations even allow ERR_PTR()s, I decided
> against that as IIRC the usual idea is that errors should be handled and
> not silently carried over.
>
> Cc: adi-buildroot-devel@lists.sourceforge.net
> Cc: bcm-kernel-feedback-list@broadcom.com
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: linux-mips@linux-mips.org
>
> Jonas Gorski (9):
>   ARM: ep93xx: allow NULL clock for clk_get_rate
>   ARM: mmp: allow NULL clock for clk_get_rate
>   blackfin: bf609: allow NULL clock for clk_get_rate
>   m68k: allow NULL clock for clk_get_rate
>   MIPS: AR7: allow NULL clock for clk_get_rate
>   MIPS: BCM63XX: allow NULL clock for clk_get_rate
>   MIPS: Loongson 2F: allow NULL clock for clk_get_rate
>   MIPS: ralink: allow NULL clock for clk_get_rate
>   unicore32: allow NULL clock for clk_get_rate
>
>  arch/arm/mach-ep93xx/clock.c           | 3 +++
>  arch/arm/mach-mmp/clock.c              | 4 +++-
>  arch/blackfin/mach-bf609/clock.c       | 2 +-
>  arch/m68k/coldfire/clk.c               | 3 +++
>  arch/mips/ar7/clock.c                  | 3 +++
>  arch/mips/bcm63xx/clk.c                | 3 +++
>  arch/mips/loongson64/lemote-2f/clock.c | 3 +++
>  arch/mips/ralink/clk.c                 | 3 +++
>  arch/unicore32/kernel/clock.c          | 3 +++
>  9 files changed, 25 insertions(+), 2 deletions(-)

For the whole series:
Reviewed-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] 17+ messages in thread

* Re: [PATCH 4/9] m68k: allow NULL clock for clk_get_rate
  2017-07-18 10:17 ` [PATCH 4/9] m68k: " Jonas Gorski
@ 2017-07-18 12:03   ` Greg Ungerer
  2017-07-19  9:06     ` Jonas Gorski
  0 siblings, 1 reply; 17+ messages in thread
From: Greg Ungerer @ 2017-07-18 12:03 UTC (permalink / raw)
  To: Jonas Gorski; +Cc: Geert Uytterhoeven, linux-m68k, linux-kernel

Hi Jonas,

On 18/07/17 20:17, Jonas Gorski wrote:
> Make the behaviour of clk_get_rate consistent with common clk's
> clk_get_rate by accepting NULL clocks as parameter. Some device
> drivers rely on this, and will cause an OOPS otherwise.
> 
> Fixes: facdf0ed4f59 ("m68knommu: introduce basic clk infrastructure")
> Cc: Greg Ungerer <gerg@linux-m68k.org>

Acked-by: Greg Ungerer <gerg@linux-m68k.org>

Do you want me to push this via the m68knommu git tree?
Or are you (or someone) taking the series as a whole?

Regards
Greg



> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: linux-kernel@vger.kernel.org
> Reported-by: Mathias Kresin <dev@kresin.me>
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> ---
>   arch/m68k/coldfire/clk.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
> index 1e3c7e9193d1..856069a3196d 100644
> --- a/arch/m68k/coldfire/clk.c
> +++ b/arch/m68k/coldfire/clk.c
> @@ -121,6 +121,9 @@ EXPORT_SYMBOL(clk_put);
>   
>   unsigned long clk_get_rate(struct clk *clk)
>   {
> +	if (!clk)
> +		return 0;
> +
>   	return clk->rate;
>   }
>   EXPORT_SYMBOL(clk_get_rate);
> 

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

* Re: [PATCH 3/9] blackfin: bf609: allow NULL clock for clk_get_rate
  2017-07-18 10:17 ` [PATCH 3/9] blackfin: bf609: " Jonas Gorski
@ 2017-07-18 18:54   ` Masahiro Yamada
  0 siblings, 0 replies; 17+ messages in thread
From: Masahiro Yamada @ 2017-07-18 18:54 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: Steven Miao, Andrew Morton, adi-buildroot-devel,
	Linux Kernel Mailing List

2017-07-18 19:17 GMT+09:00 Jonas Gorski <jonas.gorski@gmail.com>:
> Make the behaviour of clk_get_rate consistent with common clk's
> clk_get_rate by accepting NULL clocks as parameter. Some device
> drivers rely on this, and will cause an OOPS otherwise.
>
> Fixes: 969003152aa9 ("blackfin: bf60x: add clock support")
> Cc: Steven Miao <realmz6@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>

This Cc can be replaced with

Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Thank you.


> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: adi-buildroot-devel@lists.sourceforge.net
> Cc: linux-kernel@vger.kernel.org
> Reported-by: Mathias Kresin <dev@kresin.me>
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> ---
>  arch/blackfin/mach-bf609/clock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
> index 392a59b9a504..21a0ec18829f 100644
> --- a/arch/blackfin/mach-bf609/clock.c
> +++ b/arch/blackfin/mach-bf609/clock.c
> @@ -109,7 +109,7 @@ EXPORT_SYMBOL(clk_disable);
>  unsigned long clk_get_rate(struct clk *clk)
>  {
>         unsigned long ret = 0;
> -       if (clk->ops && clk->ops->get_rate)
> +       if (clk && clk->ops && clk->ops->get_rate)
>                 ret = clk->ops->get_rate(clk);
>         return ret;
>  }
> --
> 2.11.0
>



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH 6/9] MIPS: BCM63XX: allow NULL clock for clk_get_rate
  2017-07-18 10:17 ` [PATCH 6/9] MIPS: BCM63XX: " Jonas Gorski
@ 2017-07-18 19:55   ` Florian Fainelli
  0 siblings, 0 replies; 17+ messages in thread
From: Florian Fainelli @ 2017-07-18 19:55 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: Ralf Baechle, Florian Fainelli, bcm-kernel-feedback-list,
	James Hogan, linux-mips, linux-kernel

On 07/18/2017 03:17 AM, Jonas Gorski wrote:
> Make the behaviour of clk_get_rate consistent with common clk's
> clk_get_rate by accepting NULL clocks as parameter. Some device
> drivers rely on this, and will cause an OOPS otherwise.
> 
> Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: linux-mips@linux-mips.org
> Cc: linux-kernel@vger.kernel.org
> Reported-by: Mathias Kresin <dev@kresin.me>
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>

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

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

* Re: [PATCH 1/9] ARM: ep93xx: allow NULL clock for clk_get_rate
  2017-07-18 10:17 ` [PATCH 1/9] ARM: ep93xx: allow NULL clock for clk_get_rate Jonas Gorski
@ 2017-07-19  5:04   ` Alexander Sverdlin
  0 siblings, 0 replies; 17+ messages in thread
From: Alexander Sverdlin @ 2017-07-19  5:04 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: Hartley Sweeten, Russell King, linux-arm-kernel, linux-kernel,
	Olof Johansson, Arnd Bergmann

On 18/07/17 12:17, Jonas Gorski wrote:
> Make the behaviour of clk_get_rate consistent with common clk's
> clk_get_rate by accepting NULL clocks as parameter. Some device
> drivers rely on this, and will cause an OOPS otherwise.
> 
> Fixes: 1d81eedb8f6c ("[ARM] 3634/1: ep93xx: initial implementation of the clk_* API")
> Cc: Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Reported-by: Mathias Kresin <dev@kresin.me>
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>

> ---
>  arch/arm/mach-ep93xx/clock.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
> index 39ef3b613912..f0768befafe8 100644
> --- a/arch/arm/mach-ep93xx/clock.c
> +++ b/arch/arm/mach-ep93xx/clock.c
> @@ -316,6 +316,9 @@ static unsigned long get_uart_rate(struct clk *clk)
>  
>  unsigned long clk_get_rate(struct clk *clk)
>  {
> +	if (!clk)
> +		return 0;
> +
>  	if (clk->get_rate)
>  		return clk->get_rate(clk);

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

* Re: [PATCH 4/9] m68k: allow NULL clock for clk_get_rate
  2017-07-18 12:03   ` Greg Ungerer
@ 2017-07-19  9:06     ` Jonas Gorski
  2017-07-19 12:21       ` Greg Ungerer
  0 siblings, 1 reply; 17+ messages in thread
From: Jonas Gorski @ 2017-07-19  9:06 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: Geert Uytterhoeven, linux-m68k, linux-kernel@vger.kernel.org

Hi Greg,

On 18 July 2017 at 14:03, Greg Ungerer <gerg@linux-m68k.org> wrote:
> Hi Jonas,
>
> On 18/07/17 20:17, Jonas Gorski wrote:
>>
>> Make the behaviour of clk_get_rate consistent with common clk's
>> clk_get_rate by accepting NULL clocks as parameter. Some device
>> drivers rely on this, and will cause an OOPS otherwise.
>>
>> Fixes: facdf0ed4f59 ("m68knommu: introduce basic clk infrastructure")
>> Cc: Greg Ungerer <gerg@linux-m68k.org>
>
>
> Acked-by: Greg Ungerer <gerg@linux-m68k.org>
>
> Do you want me to push this via the m68knommu git tree?
> Or are you (or someone) taking the series as a whole?

Please take it through your tree. I totally forgot mentioning in the
cover letter that I'm just a simple patch submitter and don't have my
own tree. Too long ago that I sent a multi-tree patch series last time
... .

Regards
Jonas

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

* Re: [PATCH 4/9] m68k: allow NULL clock for clk_get_rate
  2017-07-19  9:06     ` Jonas Gorski
@ 2017-07-19 12:21       ` Greg Ungerer
  0 siblings, 0 replies; 17+ messages in thread
From: Greg Ungerer @ 2017-07-19 12:21 UTC (permalink / raw)
  To: Jonas Gorski; +Cc: Geert Uytterhoeven, linux-m68k, linux-kernel@vger.kernel.org

Hi Jonas,

On 19/07/17 19:06, Jonas Gorski wrote:
> Hi Greg,
> 
> On 18 July 2017 at 14:03, Greg Ungerer <gerg@linux-m68k.org> wrote:
>> Hi Jonas,
>>
>> On 18/07/17 20:17, Jonas Gorski wrote:
>>>
>>> Make the behaviour of clk_get_rate consistent with common clk's
>>> clk_get_rate by accepting NULL clocks as parameter. Some device
>>> drivers rely on this, and will cause an OOPS otherwise.
>>>
>>> Fixes: facdf0ed4f59 ("m68knommu: introduce basic clk infrastructure")
>>> Cc: Greg Ungerer <gerg@linux-m68k.org>
>>
>>
>> Acked-by: Greg Ungerer <gerg@linux-m68k.org>
>>
>> Do you want me to push this via the m68knommu git tree?
>> Or are you (or someone) taking the series as a whole?
> 
> Please take it through your tree. I totally forgot mentioning in the
> cover letter that I'm just a simple patch submitter and don't have my
> own tree. Too long ago that I sent a multi-tree patch series last time

No problem. Added to the m68knommu git tree, for-next branch.

Thanks
Greg

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

end of thread, other threads:[~2017-07-19 12:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18 10:17 [PATCH 0/9] make clk_get_rate implementations behavior more consistent Jonas Gorski
2017-07-18 10:17 ` [PATCH 1/9] ARM: ep93xx: allow NULL clock for clk_get_rate Jonas Gorski
2017-07-19  5:04   ` Alexander Sverdlin
2017-07-18 10:17 ` [PATCH 2/9] ARM: mmp: " Jonas Gorski
2017-07-18 10:17 ` [PATCH 3/9] blackfin: bf609: " Jonas Gorski
2017-07-18 18:54   ` Masahiro Yamada
2017-07-18 10:17 ` [PATCH 4/9] m68k: " Jonas Gorski
2017-07-18 12:03   ` Greg Ungerer
2017-07-19  9:06     ` Jonas Gorski
2017-07-19 12:21       ` Greg Ungerer
2017-07-18 10:17 ` [PATCH 5/9] MIPS: AR7: " Jonas Gorski
2017-07-18 10:17 ` [PATCH 6/9] MIPS: BCM63XX: " Jonas Gorski
2017-07-18 19:55   ` Florian Fainelli
2017-07-18 10:17 ` [PATCH 7/9] MIPS: Loongson 2F: " Jonas Gorski
2017-07-18 10:17 ` [PATCH 8/9] MIPS: ralink: " Jonas Gorski
2017-07-18 10:17 ` [PATCH 9/9] unicore32: " Jonas Gorski
2017-07-18 12:01 ` [PATCH 0/9] make clk_get_rate implementations behavior more consistent Geert Uytterhoeven

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