mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-clk@vger.kernel.org
Cc: Stephen Warren <swarren@wwwdotorg.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-fbdev@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	linux-kernel@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>,
	Russell King <linux@armlinux.org.uk>
Subject: [RFC PATCH] clk: move of_clk_get_parent_count() declaration to <linux/__clk.h>
Date: Thu,  5 Oct 2017 10:25:51 +0900	[thread overview]
Message-ID: <1507166751-2012-1-git-send-email-yamada.masahiro@socionext.com> (raw)

The clock consumer, drivers/video/fbdev/simplefb.c, includes
<linux/clk-provider.h> just for calling of_clk_get_parent_count().
This is ugly.

Looking at simplefb_clocks_get(), of_clk_get_parent_count() seems
useful for clock consumers as well as for clock providers.

Unfortunately, we do not have a good home for declarations shared
between consumers and providers.

Create a new header <linux/__clk.h>, and move it over to it.  This
header must be included via <linux/clk.h> or <linux/clk-provider.h>
(this is why it is prefixed with double-underscore).  Add #error
so the build terminates if it is included directly.

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

 drivers/video/fbdev/simplefb.c |  1 -
 include/linux/__clk.h          | 31 +++++++++++++++++++++++++++++++
 include/linux/clk-provider.h   |  7 ++-----
 include/linux/clk.h            |  2 ++
 4 files changed, 35 insertions(+), 6 deletions(-)
 create mode 100644 include/linux/__clk.h

diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
index a3c44ec..17f0aec 100644
--- a/drivers/video/fbdev/simplefb.c
+++ b/drivers/video/fbdev/simplefb.c
@@ -27,7 +27,6 @@
 #include <linux/platform_data/simplefb.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
-#include <linux/clk-provider.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/parser.h>
diff --git a/include/linux/__clk.h b/include/linux/__clk.h
new file mode 100644
index 0000000..a8b86bf
--- /dev/null
+++ b/include/linux/__clk.h
@@ -0,0 +1,31 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX___CLK_H
+#define __LINUX___CLK_H
+
+/* This header contains stuff shared between consumers and providers. */
+
+#if !defined(__LINUX_CLK_H) && !defined(__LINUX_CLK_PROVIDER_H)
+#error "Please don't include <linux/__clk.h> directly, include <linux/clk.h> or <linux/clk-provider.h> instead."
+#endif
+
+struct device_node;
+
+#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF)
+
+unsigned int of_clk_get_parent_count(struct device_node *np);
+
+#else
+
+static inline unsigned int of_clk_get_parent_count(struct device_node *np)
+{
+	return 0;
+}
+
+#endif
+
+#endif /* __LINUX___CLK_H */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 5100ec1..cd9bca1 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -14,6 +14,8 @@
 #include <linux/io.h>
 #include <linux/of.h>
 
+#include "__clk.h"
+
 #ifdef CONFIG_COMMON_CLK
 
 /*
@@ -823,7 +825,6 @@ struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec,
 struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
 struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec,
 				     void *data);
-unsigned int of_clk_get_parent_count(struct device_node *np);
 int of_clk_parent_fill(struct device_node *np, const char **parents,
 		       unsigned int size);
 const char *of_clk_get_parent_name(struct device_node *np, int index);
@@ -868,10 +869,6 @@ of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data)
 {
 	return ERR_PTR(-ENOENT);
 }
-static inline unsigned int of_clk_get_parent_count(struct device_node *np)
-{
-	return 0;
-}
 static inline int of_clk_parent_fill(struct device_node *np,
 				     const char **parents, unsigned int size)
 {
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 12c96d9..83d24cb 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -16,6 +16,8 @@
 #include <linux/kernel.h>
 #include <linux/notifier.h>
 
+#include "__clk.h"
+
 struct device;
 struct clk;
 struct device_node;
-- 
2.7.4

             reply	other threads:[~2017-10-05  1:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05  1:25 Masahiro Yamada [this message]
2017-10-12 23:17 ` Stephen Boyd
2017-10-28 17:35   ` Masahiro Yamada
2017-11-02  5:32     ` Stephen Boyd

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=1507166751-2012-1-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    --cc=swarren@wwwdotorg.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®