All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: linux-arm-kernel@lists.infradead.org,
	Arnd Bergmann <arnd@arndb.de>,
	Russell King <linux@arm.linux.org.uk>
Cc: Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Will Deacon <will.deacon@arm.com>, Rob Herring <robh@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	linux-clk@vger.kernel.org
Subject: [PATCH 07/13] clk: versatile-icst: refactor to allocate regmap separately
Date: Thu, 15 Oct 2015 15:46:47 +0200	[thread overview]
Message-ID: <1444916813-31024-8-git-send-email-linus.walleij@linaro.org> (raw)
In-Reply-To: <1444916813-31024-1-git-send-email-linus.walleij@linaro.org>

Break out the registration function so it creates a regmap and
pass to the setup function, so the latter can be shared with
a device tree probe function that already has a regmap.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
I'm looking for an ACK from the CLK maintainers to take this
through the ARM SoC tree once the series stabilize.
---
 drivers/clk/versatile/clk-icst.c | 44 +++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index da5a3ccbbb96..ab5d5f73818b 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -20,6 +20,7 @@
 #include <linux/clk-provider.h>
 #include <linux/io.h>
 #include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
 
 #include "clk-icst.h"
 
@@ -140,21 +141,16 @@ static const struct clk_ops icst_ops = {
 	.set_rate = icst_set_rate,
 };
 
-struct clk *icst_clk_register(struct device *dev,
+struct clk *icst_clk_setup(struct device *dev,
 			const struct clk_icst_desc *desc,
 			const char *name,
 			const char *parent_name,
-			void __iomem *base)
+			struct regmap *map)
 {
 	struct clk *clk;
 	struct clk_icst *icst;
 	struct clk_init_data init;
 	struct icst_params *pclone;
-	struct regmap_config icst_regmap_conf = {
-		.reg_bits = 32,
-		.val_bits = 32,
-		.reg_stride = 4,
-	};
 
 	icst = kzalloc(sizeof(struct clk_icst), GFP_KERNEL);
 	if (!icst) {
@@ -174,15 +170,7 @@ struct clk *icst_clk_register(struct device *dev,
 	init.flags = CLK_IS_ROOT;
 	init.parent_names = (parent_name ? &parent_name : NULL);
 	init.num_parents = (parent_name ? 1 : 0);
-	icst->map = regmap_init_mmio(NULL, base, &icst_regmap_conf);
-	if (IS_ERR(icst->map)) {
-		int ret;
-
-		pr_err("could not initialize ICST regmap\n");
-		kfree(icst);
-		ret = PTR_ERR(icst->map);
-		return ERR_PTR(ret);
-	}
+	icst->map = map;
 	icst->hw.init = &init;
 	icst->params = pclone;
 	icst->vcoreg_off = desc->vco_offset;
@@ -194,4 +182,28 @@ struct clk *icst_clk_register(struct device *dev,
 
 	return clk;
 }
+
+struct clk *icst_clk_register(struct device *dev,
+			const struct clk_icst_desc *desc,
+			const char *name,
+			const char *parent_name,
+			void __iomem *base)
+{
+	struct regmap_config icst_regmap_conf = {
+		.reg_bits = 32,
+		.val_bits = 32,
+		.reg_stride = 4,
+	};
+	struct regmap *map;
+
+	map = regmap_init_mmio(NULL, base, &icst_regmap_conf);
+	if (IS_ERR(map)) {
+		int ret;
+
+		pr_err("could not initialize ICST regmap\n");
+		ret = PTR_ERR(map);
+		return ERR_PTR(ret);
+	}
+	return icst_clk_setup(dev, desc, name, parent_name, map);
+}
 EXPORT_SYMBOL_GPL(icst_clk_register);
-- 
2.4.3

WARNING: multiple messages have this Message-ID (diff)
From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/13] clk: versatile-icst: refactor to allocate regmap separately
Date: Thu, 15 Oct 2015 15:46:47 +0200	[thread overview]
Message-ID: <1444916813-31024-8-git-send-email-linus.walleij@linaro.org> (raw)
In-Reply-To: <1444916813-31024-1-git-send-email-linus.walleij@linaro.org>

Break out the registration function so it creates a regmap and
pass to the setup function, so the latter can be shared with
a device tree probe function that already has a regmap.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk at vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
I'm looking for an ACK from the CLK maintainers to take this
through the ARM SoC tree once the series stabilize.
---
 drivers/clk/versatile/clk-icst.c | 44 +++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index da5a3ccbbb96..ab5d5f73818b 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -20,6 +20,7 @@
 #include <linux/clk-provider.h>
 #include <linux/io.h>
 #include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
 
 #include "clk-icst.h"
 
@@ -140,21 +141,16 @@ static const struct clk_ops icst_ops = {
 	.set_rate = icst_set_rate,
 };
 
-struct clk *icst_clk_register(struct device *dev,
+struct clk *icst_clk_setup(struct device *dev,
 			const struct clk_icst_desc *desc,
 			const char *name,
 			const char *parent_name,
-			void __iomem *base)
+			struct regmap *map)
 {
 	struct clk *clk;
 	struct clk_icst *icst;
 	struct clk_init_data init;
 	struct icst_params *pclone;
-	struct regmap_config icst_regmap_conf = {
-		.reg_bits = 32,
-		.val_bits = 32,
-		.reg_stride = 4,
-	};
 
 	icst = kzalloc(sizeof(struct clk_icst), GFP_KERNEL);
 	if (!icst) {
@@ -174,15 +170,7 @@ struct clk *icst_clk_register(struct device *dev,
 	init.flags = CLK_IS_ROOT;
 	init.parent_names = (parent_name ? &parent_name : NULL);
 	init.num_parents = (parent_name ? 1 : 0);
-	icst->map = regmap_init_mmio(NULL, base, &icst_regmap_conf);
-	if (IS_ERR(icst->map)) {
-		int ret;
-
-		pr_err("could not initialize ICST regmap\n");
-		kfree(icst);
-		ret = PTR_ERR(icst->map);
-		return ERR_PTR(ret);
-	}
+	icst->map = map;
 	icst->hw.init = &init;
 	icst->params = pclone;
 	icst->vcoreg_off = desc->vco_offset;
@@ -194,4 +182,28 @@ struct clk *icst_clk_register(struct device *dev,
 
 	return clk;
 }
+
+struct clk *icst_clk_register(struct device *dev,
+			const struct clk_icst_desc *desc,
+			const char *name,
+			const char *parent_name,
+			void __iomem *base)
+{
+	struct regmap_config icst_regmap_conf = {
+		.reg_bits = 32,
+		.val_bits = 32,
+		.reg_stride = 4,
+	};
+	struct regmap *map;
+
+	map = regmap_init_mmio(NULL, base, &icst_regmap_conf);
+	if (IS_ERR(map)) {
+		int ret;
+
+		pr_err("could not initialize ICST regmap\n");
+		ret = PTR_ERR(map);
+		return ERR_PTR(ret);
+	}
+	return icst_clk_setup(dev, desc, name, parent_name, map);
+}
 EXPORT_SYMBOL_GPL(icst_clk_register);
-- 
2.4.3

  parent reply	other threads:[~2015-10-15 13:46 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 13:46 [PATCH 00/13] Device Tree support for RealView PB11MPCore Linus Walleij
2015-10-15 13:46 ` [PATCH 02/13] ARM: add DT bindings for the ARM11MPCore CPU cluster Linus Walleij
     [not found] ` <1444916813-31024-1-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-10-15 13:46   ` [PATCH 01/13] ARM: add some L220 DT settings Linus Walleij
2015-10-15 13:46     ` Linus Walleij
     [not found]     ` <1444916813-31024-2-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-10-15 13:57       ` Russell King - ARM Linux
2015-10-15 13:57         ` Russell King - ARM Linux
     [not found]         ` <20151015135730.GC32532-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2015-10-22 12:57           ` Linus Walleij
2015-10-22 12:57             ` Linus Walleij
2015-10-15 13:58       ` Rob Herring
2015-10-15 13:58         ` Rob Herring
2015-10-15 13:46   ` [PATCH 03/13] irqchips: fix ARM11MPCore GIC bindings Linus Walleij
2015-10-15 13:46     ` Linus Walleij
     [not found]     ` <1444916813-31024-4-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-02 14:35       ` Rob Herring
2015-11-02 14:35         ` Rob Herring
2015-10-15 13:46 ` [PATCH 04/13] irqchip/gic: support RealView variant setup Linus Walleij
2015-10-15 16:06   ` Marc Zyngier
2015-10-16  8:28   ` Thomas Gleixner
2015-10-15 13:46 ` [PATCH 05/13] irqchip/gic: assign irqchip dynamically Linus Walleij
2015-10-15 16:16   ` Marc Zyngier
2015-10-15 13:46 ` [PATCH 06/13] clk: versatile-icst: convert to use regmap Linus Walleij
2015-10-15 13:46   ` Linus Walleij
2015-10-15 19:08   ` Stephen Boyd
2015-10-15 19:08     ` Stephen Boyd
2015-10-23  9:27     ` Linus Walleij
2015-10-23  9:27       ` Linus Walleij
2015-10-23  9:37       ` Linus Walleij
2015-10-23  9:37         ` Linus Walleij
2015-10-23 16:24       ` Stephen Boyd
2015-10-23 16:24         ` Stephen Boyd
2015-10-27 15:56         ` Linus Walleij
2015-10-27 15:56           ` Linus Walleij
2015-10-15 13:46 ` Linus Walleij [this message]
2015-10-15 13:46   ` [PATCH 07/13] clk: versatile-icst: refactor to allocate regmap separately Linus Walleij
2015-10-15 19:10   ` Stephen Boyd
2015-10-15 19:10     ` Stephen Boyd
2015-10-15 19:28   ` Stephen Boyd
2015-10-15 19:28     ` Stephen Boyd
2015-10-15 13:46 ` [PATCH 08/13] clk: add ARM syscon ICST device tree bindings Linus Walleij
2015-10-15 13:46   ` Linus Walleij
2015-10-15 19:23   ` Stephen Boyd
2015-10-15 19:23     ` Stephen Boyd
     [not found]     ` <20151015192325.GN4558-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-23  9:48       ` Linus Walleij
2015-10-23  9:48         ` Linus Walleij
2015-10-23  9:48         ` Linus Walleij
2015-10-23 16:43         ` Stephen Boyd
2015-10-23 16:43           ` Stephen Boyd
2015-10-15 13:46 ` [PATCH 09/13] clk: versatile-icst: add device tree support Linus Walleij
2015-10-15 13:46   ` Linus Walleij
2015-10-15 19:26   ` Stephen Boyd
2015-10-15 19:26     ` Stephen Boyd
2015-10-26 13:14     ` Linus Walleij
2015-10-26 13:14       ` Linus Walleij
2015-10-26 13:31       ` Russell King - ARM Linux
2015-10-26 13:31         ` Russell King - ARM Linux
2015-10-29 13:00         ` Linus Walleij
2015-10-29 13:00           ` Linus Walleij
2015-10-15 19:28   ` Stephen Boyd
2015-10-15 19:28     ` Stephen Boyd
2015-10-15 13:46 ` [PATCH 10/13] soc: versatile: add support for the PB11MPCore Linus Walleij
2015-10-15 13:46 ` [PATCH 11/13] ARM: realview: select SP810 and ICST for the DT variant Linus Walleij
2015-10-15 13:46 ` [PATCH 12/13] ARM: realview: add an DT SMP boot method Linus Walleij
2015-10-15 13:46 ` [PATCH 13/13] ARM: realview: add device tree for PB11MPCore Linus Walleij

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=1444916813-31024-8-git-send-email-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=pawel.moll@arm.com \
    --cc=robh@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=will.deacon@arm.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.