All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@kernel.org>,
	Hartley Sweeten <hsweeten@visionengravers.com>,
	Alexander Sverdlin <alexander.sverdlin@gmail.com>,
	Eric Miao <eric.y.miao@gmail.com>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Wan ZongShun <mcuos.com@gmail.com>
Cc: linux-clk@vger.kernel.org, Stephen Boyd <sboyd@codeaurora.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Russell King <linux@armlinux.org.uk>,
	Alexandre Bailon <abailon@baylibre.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 03/12] ARM: normalize clk API for older platforms
Date: Thu, 20 Jul 2017 17:50:46 +0200	[thread overview]
Message-ID: <20170720155132.3250812-1-arnd@arndb.de> (raw)
In-Reply-To: <20170720154616.3250481-1-arnd@arndb.de>

Six ARM platforms still provide their own variant of the clk API
rather than using the generic COMMON_CLK API. This generally works,
but it causes some link errors with drivers using the clk_set_rate,
clk_get_parent, clk_set_parent or clk_round_rate functions when
a platform lacks those interfaces.

OMAP1 implements the whole set already, but davinci, ep93xx, mmp,
sa1100 and w90x900 all lack at least one of the functions.

This adds empty stub implementations for each of them, and I
don't even try to do something useful here but instead just
print a WARN() message to make it obvious what is going on
if they ever end up being called.

The drivers that call these won't be used on these platforms
(otherwise we'd get a link error today), so the added code is harmless
bloat and will warn about accidental use.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-davinci/clock.c |  6 ++++++
 arch/arm/mach-ep93xx/clock.c  | 21 +++++++++++++++++++++
 arch/arm/mach-mmp/clock.c     | 22 ++++++++++++++++++++++
 arch/arm/mach-sa1100/clock.c  | 29 +++++++++++++++++++++++++++++
 arch/arm/mach-w90x900/clock.c | 29 +++++++++++++++++++++++++++++
 5 files changed, 107 insertions(+)

diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index f5dce9b4e617..89586779526c 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -218,6 +218,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 }
 EXPORT_SYMBOL(clk_set_parent);
 
+struct clk *clk_get_parent(struct clk *clk)
+{
+	return clk->parent;
+}
+EXPORT_SYMBOL(clk_get_parent);
+
 int clk_register(struct clk *clk)
 {
 	if (clk == NULL || IS_ERR(clk))
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 39ef3b613912..c1c91fc6e178 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -323,6 +323,27 @@ unsigned long clk_get_rate(struct clk *clk)
 }
 EXPORT_SYMBOL(clk_get_rate);
 
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+	WARN_ON(clk);
+	return NULL;
+}
+EXPORT_SYMBOL(clk_get_parent);
+
 static int set_keytchclk_rate(struct clk *clk, unsigned long rate)
 {
 	u32 val;
diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index 28fe64c6e2f5..78513f74ae8d 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -106,3 +106,25 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	return ret;
 }
 EXPORT_SYMBOL(clk_set_rate);
+
+/* Dummy clk routine to build generic kernel parts that may be using them */
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+	WARN_ON(clk);
+	return NULL;
+}
+EXPORT_SYMBOL(clk_get_parent);
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index 0db46895c82a..a602d876c231 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -35,6 +35,35 @@ struct clk clk_##_name = {				\
 
 static DEFINE_SPINLOCK(clocks_lock);
 
+/* Dummy clk routine to build generic kernel parts that may be using them */
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+	WARN_ON(clk);
+	return NULL;
+}
+EXPORT_SYMBOL(clk_get_parent);
+
 static void clk_gpio27_enable(struct clk *clk)
 {
 	/*
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index ac6fd1a2cb59..3f93fac98d97 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -93,3 +93,32 @@ void nuc900_subclk_enable(struct clk *clk, int enable)
 
 	__raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK);
 }
+
+/* dummy functions, should not be called */
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+	WARN_ON(clk);
+	return NULL;
+}
+EXPORT_SYMBOL(clk_get_parent);
-- 
2.9.0

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/12] ARM: normalize clk API for older platforms
Date: Thu, 20 Jul 2017 17:50:46 +0200	[thread overview]
Message-ID: <20170720155132.3250812-1-arnd@arndb.de> (raw)
In-Reply-To: <20170720154616.3250481-1-arnd@arndb.de>

Six ARM platforms still provide their own variant of the clk API
rather than using the generic COMMON_CLK API. This generally works,
but it causes some link errors with drivers using the clk_set_rate,
clk_get_parent, clk_set_parent or clk_round_rate functions when
a platform lacks those interfaces.

OMAP1 implements the whole set already, but davinci, ep93xx, mmp,
sa1100 and w90x900 all lack at least one of the functions.

This adds empty stub implementations for each of them, and I
don't even try to do something useful here but instead just
print a WARN() message to make it obvious what is going on
if they ever end up being called.

The drivers that call these won't be used on these platforms
(otherwise we'd get a link error today), so the added code is harmless
bloat and will warn about accidental use.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-davinci/clock.c |  6 ++++++
 arch/arm/mach-ep93xx/clock.c  | 21 +++++++++++++++++++++
 arch/arm/mach-mmp/clock.c     | 22 ++++++++++++++++++++++
 arch/arm/mach-sa1100/clock.c  | 29 +++++++++++++++++++++++++++++
 arch/arm/mach-w90x900/clock.c | 29 +++++++++++++++++++++++++++++
 5 files changed, 107 insertions(+)

diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index f5dce9b4e617..89586779526c 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -218,6 +218,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 }
 EXPORT_SYMBOL(clk_set_parent);
 
+struct clk *clk_get_parent(struct clk *clk)
+{
+	return clk->parent;
+}
+EXPORT_SYMBOL(clk_get_parent);
+
 int clk_register(struct clk *clk)
 {
 	if (clk == NULL || IS_ERR(clk))
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 39ef3b613912..c1c91fc6e178 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -323,6 +323,27 @@ unsigned long clk_get_rate(struct clk *clk)
 }
 EXPORT_SYMBOL(clk_get_rate);
 
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+	WARN_ON(clk);
+	return NULL;
+}
+EXPORT_SYMBOL(clk_get_parent);
+
 static int set_keytchclk_rate(struct clk *clk, unsigned long rate)
 {
 	u32 val;
diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index 28fe64c6e2f5..78513f74ae8d 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -106,3 +106,25 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	return ret;
 }
 EXPORT_SYMBOL(clk_set_rate);
+
+/* Dummy clk routine to build generic kernel parts that may be using them */
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+	WARN_ON(clk);
+	return NULL;
+}
+EXPORT_SYMBOL(clk_get_parent);
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index 0db46895c82a..a602d876c231 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -35,6 +35,35 @@ struct clk clk_##_name = {				\
 
 static DEFINE_SPINLOCK(clocks_lock);
 
+/* Dummy clk routine to build generic kernel parts that may be using them */
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+	WARN_ON(clk);
+	return NULL;
+}
+EXPORT_SYMBOL(clk_get_parent);
+
 static void clk_gpio27_enable(struct clk *clk)
 {
 	/*
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index ac6fd1a2cb59..3f93fac98d97 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -93,3 +93,32 @@ void nuc900_subclk_enable(struct clk *clk, int enable)
 
 	__raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK);
 }
+
+/* dummy functions, should not be called */
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	WARN_ON(clk);
+	return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+	WARN_ON(clk);
+	return NULL;
+}
+EXPORT_SYMBOL(clk_get_parent);
-- 
2.9.0

  parent reply	other threads:[~2017-07-20 15:52 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 15:45 [PATCH 00/12] ARM: randconfig patches for platforms Arnd Bergmann
2017-07-20 15:45 ` Arnd Bergmann
2017-07-20 15:45 ` [PATCH 01/12] ARM: ixp4xx: fix ioport_unmap definition Arnd Bergmann
2017-07-20 15:45   ` Arnd Bergmann
2017-07-21 12:21   ` Krzysztof Hałasa
2017-07-21 12:21     ` Krzysztof Hałasa
2017-07-20 15:49 ` [PATCH 02/12] ARM: ep93xx: use ARM_PATCH_PHYS_VIRT Arnd Bergmann
2017-07-20 15:49   ` Arnd Bergmann
2017-07-20 16:07   ` Alexander Sverdlin
2017-07-20 16:07     ` Alexander Sverdlin
2017-08-02 12:29   ` Linus Walleij
2017-08-02 12:29     ` Linus Walleij
2017-07-20 15:50 ` Arnd Bergmann [this message]
2017-07-20 15:50   ` [PATCH 03/12] ARM: normalize clk API for older platforms Arnd Bergmann
2017-07-20 16:04   ` Alexander Sverdlin
2017-07-21  7:51     ` Arnd Bergmann
2017-07-21  8:05   ` Sekhar Nori
2017-07-21  8:05     ` Sekhar Nori
2017-07-21  8:17     ` Arnd Bergmann
2017-07-21  8:17       ` Arnd Bergmann
2017-07-21  9:44       ` Sekhar Nori
2017-07-21  9:44         ` Sekhar Nori
2017-07-20 15:51 ` [PATCH 04/12] ARM: sa1100/pxa: fix MTD_XIP build Arnd Bergmann
2017-07-20 15:51   ` Arnd Bergmann
2017-07-23 15:53   ` Robert Jarzmik
2017-07-23 15:53     ` Robert Jarzmik
2017-07-25 15:14     ` Arnd Bergmann
2017-07-25 15:14       ` Arnd Bergmann
2017-07-20 15:51 ` [PATCH 05/12] ARM: mmp: mark usb_dma_mask as __maybe_unused Arnd Bergmann
2017-07-20 15:51   ` Arnd Bergmann
2017-07-20 15:51 ` [PATCH 06/12] ARM: omap2: mark unused functions " Arnd Bergmann
2017-07-20 15:51   ` Arnd Bergmann
2017-07-27 10:08   ` Sebastian Reichel
2017-07-27 10:08     ` Sebastian Reichel
2017-07-20 15:51 ` [PATCH 07/12] ARM: omap1: avoid unused variable warning Arnd Bergmann
2017-07-20 15:51   ` Arnd Bergmann
2017-07-20 15:51 ` [PATCH 08/12] ARM: sirf: mark sirfsoc_init_late as __maybe_unused Arnd Bergmann
2017-07-20 15:51   ` Arnd Bergmann
2017-07-20 15:51 ` [PATCH 09/12] ARM: ixp4xx: use normal prototype for {read,write}s{b,w,l} Arnd Bergmann
2017-07-20 15:51   ` [PATCH 09/12] ARM: ixp4xx: use normal prototype for {read, write}s{b, w, l} Arnd Bergmann
2017-07-20 15:53 ` [PATCH 10/12] [v2] ARM: s3c24xx: make H1940BT depend on RFKILL Arnd Bergmann
2017-07-20 15:53   ` Arnd Bergmann
2017-07-20 19:30   ` Krzysztof Kozlowski
2017-07-20 19:30     ` Krzysztof Kozlowski
2017-07-20 15:53 ` [PATCH 11/12] ARM: omap1/ams-delta: warn about failed regulator enable Arnd Bergmann
2017-07-20 15:53   ` Arnd Bergmann
2017-07-20 15:53 ` [PATCH 12/12] ARM: rpc: rename RAM_SIZE macro Arnd Bergmann
2017-07-20 15:53   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170720155132.3250812-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=abailon@baylibre.com \
    --cc=alexander.sverdlin@gmail.com \
    --cc=dbaryshkov@gmail.com \
    --cc=eric.y.miao@gmail.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=hsweeten@visionengravers.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mcuos.com@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=nsekhar@ti.com \
    --cc=sboyd@codeaurora.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.