diff mbox

[v2] clk: Provide notifier stubs when !COMMON_CLK

Message ID 1467113104-8650-1-git-send-email-k.kozlowski@samsung.com (mailing list archive)
State Accepted, archived
Delegated to: Stephen Boyd
Headers show

Commit Message

Krzysztof Kozlowski June 28, 2016, 11:25 a.m. UTC
The clk notifier symbols are hidden by COMMON_CLK.  However on some
platforms HAVE_CLK might be set while COMMON_CLK not which leads to
compile test build errors like:

$ make.cross ARCH=sh
   drivers/devfreq/tegra-devfreq.c: In function 'tegra_actmon_rate_notify_cb':
>> drivers/devfreq/tegra-devfreq.c:391:16: error: 'POST_RATE_CHANGE' undeclared (first use in this function)
     if (action != POST_RATE_CHANGE)
                   ^
   drivers/devfreq/tegra-devfreq.c: In function 'tegra_devfreq_probe':
>> drivers/devfreq/tegra-devfreq.c:654:8: error: implicit declaration of function 'clk_notifier_register' [-Werror=implicit-function-declaration]
     err = clk_notifier_register(tegra->emc_clock, &tegra->rate_change_nb);
           ^

Export the macros and data type declarations outside of COMMON_CLK ifdef
and provide stubs to fix the compile testing.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

---

Reported when testing patch [1] on ARCH=sh. I don't have the sh cross
compile toolchain so I cannot verify whether this fixes reported issue.
Tested on similar configuration on MIPS (HAVE_CLK && !COMMON_CLK)

[1] http://www.gossamer-threads.com/lists/linux/kernel/2471798

Changes since v1:
1. The struct clk_notifier_data also has to be visible.
---
 include/linux/clk.h | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Comments

Bartlomiej Zolnierkiewicz June 28, 2016, 11:58 a.m. UTC | #1
Hi,

On Tuesday, June 28, 2016 01:25:04 PM Krzysztof Kozlowski wrote:
> The clk notifier symbols are hidden by COMMON_CLK.  However on some
> platforms HAVE_CLK might be set while COMMON_CLK not which leads to
> compile test build errors like:
> 
> $ make.cross ARCH=sh
>    drivers/devfreq/tegra-devfreq.c: In function 'tegra_actmon_rate_notify_cb':
> >> drivers/devfreq/tegra-devfreq.c:391:16: error: 'POST_RATE_CHANGE' undeclared (first use in this function)
>      if (action != POST_RATE_CHANGE)
>                    ^
>    drivers/devfreq/tegra-devfreq.c: In function 'tegra_devfreq_probe':
> >> drivers/devfreq/tegra-devfreq.c:654:8: error: implicit declaration of function 'clk_notifier_register' [-Werror=implicit-function-declaration]
>      err = clk_notifier_register(tegra->emc_clock, &tegra->rate_change_nb);
>            ^
> 
> Export the macros and data type declarations outside of COMMON_CLK ifdef
> and provide stubs to fix the compile testing.
> 
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> ---
> 
> Reported when testing patch [1] on ARCH=sh. I don't have the sh cross
> compile toolchain so I cannot verify whether this fixes reported issue.

FWIW I've verified with sh cross-compiler.

Tested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

> Tested on similar configuration on MIPS (HAVE_CLK && !COMMON_CLK)
> 
> [1] http://www.gossamer-threads.com/lists/linux/kernel/2471798

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd June 28, 2016, 5:26 p.m. UTC | #2
On 06/28, Krzysztof Kozlowski wrote:
> The clk notifier symbols are hidden by COMMON_CLK.  However on some
> platforms HAVE_CLK might be set while COMMON_CLK not which leads to
> compile test build errors like:
> 
> $ make.cross ARCH=sh
>    drivers/devfreq/tegra-devfreq.c: In function 'tegra_actmon_rate_notify_cb':
> >> drivers/devfreq/tegra-devfreq.c:391:16: error: 'POST_RATE_CHANGE' undeclared (first use in this function)
>      if (action != POST_RATE_CHANGE)
>                    ^
>    drivers/devfreq/tegra-devfreq.c: In function 'tegra_devfreq_probe':
> >> drivers/devfreq/tegra-devfreq.c:654:8: error: implicit declaration of function 'clk_notifier_register' [-Werror=implicit-function-declaration]
>      err = clk_notifier_register(tegra->emc_clock, &tegra->rate_change_nb);
>            ^
> 
> Export the macros and data type declarations outside of COMMON_CLK ifdef
> and provide stubs to fix the compile testing.
> 
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> ---
> 

Ok. Did you want some stable branch to pull this in and base your
use case on?
Krzysztof Kozlowski June 28, 2016, 7:01 p.m. UTC | #3
On Tue, Jun 28, 2016 at 10:26:53AM -0700, Stephen Boyd wrote:
> On 06/28, Krzysztof Kozlowski wrote:
> > The clk notifier symbols are hidden by COMMON_CLK.  However on some
> > platforms HAVE_CLK might be set while COMMON_CLK not which leads to
> > compile test build errors like:
> > 
> > $ make.cross ARCH=sh
> >    drivers/devfreq/tegra-devfreq.c: In function 'tegra_actmon_rate_notify_cb':
> > >> drivers/devfreq/tegra-devfreq.c:391:16: error: 'POST_RATE_CHANGE' undeclared (first use in this function)
> >      if (action != POST_RATE_CHANGE)
> >                    ^
> >    drivers/devfreq/tegra-devfreq.c: In function 'tegra_devfreq_probe':
> > >> drivers/devfreq/tegra-devfreq.c:654:8: error: implicit declaration of function 'clk_notifier_register' [-Werror=implicit-function-declaration]
> >      err = clk_notifier_register(tegra->emc_clock, &tegra->rate_change_nb);
> >            ^
> > 
> > Export the macros and data type declarations outside of COMMON_CLK ifdef
> > and provide stubs to fix the compile testing.
> > 
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > 
> > ---
> > 
> 
> Ok. Did you want some stable branch to pull this in and base your
> use case on?

It is only one patch but indeed without the branch my patches would have
to wait for next release. If you would be so kind, could you prepare
the stable branch? I hope MyungJoo Ham will use it.

Anyway I encountered more linkage errors for clk API (like clk_get_rate()).
They happen for various compile-tested drivers in case of MIPS (and
maybe others like SH). I will investigate it more but I think it is not
related strictly to this issue.

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd June 29, 2016, 12:14 a.m. UTC | #4
On 06/28, Krzysztof Kozlowski wrote:
> On Tue, Jun 28, 2016 at 10:26:53AM -0700, Stephen Boyd wrote:
> > On 06/28, Krzysztof Kozlowski wrote:
> > > The clk notifier symbols are hidden by COMMON_CLK.  However on some
> > > platforms HAVE_CLK might be set while COMMON_CLK not which leads to
> > > compile test build errors like:
> > > 
> > > $ make.cross ARCH=sh
> > >    drivers/devfreq/tegra-devfreq.c: In function 'tegra_actmon_rate_notify_cb':
> > > >> drivers/devfreq/tegra-devfreq.c:391:16: error: 'POST_RATE_CHANGE' undeclared (first use in this function)
> > >      if (action != POST_RATE_CHANGE)
> > >                    ^
> > >    drivers/devfreq/tegra-devfreq.c: In function 'tegra_devfreq_probe':
> > > >> drivers/devfreq/tegra-devfreq.c:654:8: error: implicit declaration of function 'clk_notifier_register' [-Werror=implicit-function-declaration]
> > >      err = clk_notifier_register(tegra->emc_clock, &tegra->rate_change_nb);
> > >            ^
> > > 
> > > Export the macros and data type declarations outside of COMMON_CLK ifdef
> > > and provide stubs to fix the compile testing.
> > > 
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > > 
> > > ---
> > > 
> > 
> > Ok. Did you want some stable branch to pull this in and base your
> > use case on?
> 
> It is only one patch but indeed without the branch my patches would have
> to wait for next release. If you would be so kind, could you prepare
> the stable branch? I hope MyungJoo Ham will use it.
> 
> Anyway I encountered more linkage errors for clk API (like clk_get_rate()).
> They happen for various compile-tested drivers in case of MIPS (and
> maybe others like SH). I will investigate it more but I think it is not
> related strictly to this issue.

Sure. That's probably because some clk APIs are optional and not
implemented, leading to link errors.

I've applied this patch to a branch called clk-notify and merged
it into clk-next.
diff mbox

Patch

diff --git a/include/linux/clk.h b/include/linux/clk.h
index 834179f3fa72..123c02788807 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -20,8 +20,6 @@  struct device;
 
 struct clk;
 
-#ifdef CONFIG_COMMON_CLK
-
 /**
  * DOC: clk notifier callback types
  *
@@ -78,6 +76,8 @@  struct clk_notifier_data {
 	unsigned long		new_rate;
 };
 
+#ifdef CONFIG_COMMON_CLK
+
 /**
  * clk_notifier_register: register a clock rate-change notifier callback
  * @clk: clock whose rate we are interested in
@@ -140,6 +140,18 @@  bool clk_is_match(const struct clk *p, const struct clk *q);
 
 #else
 
+static inline int clk_notifier_register(struct clk *clk,
+					struct notifier_block *nb)
+{
+	return -ENOTSUPP;
+}
+
+static inline int clk_notifier_unregister(struct clk *clk,
+					  struct notifier_block *nb)
+{
+	return -ENOTSUPP;
+}
+
 static inline long clk_get_accuracy(struct clk *clk)
 {
 	return -ENOTSUPP;