Thread (28 messages) 28 messages, 5 authors, 2015-10-29

[PATCH 07/13] clk: versatile-icst: refactor to allocate regmap separately

From: Stephen Boyd <hidden>
Date: 2015-10-15 19:10:26
Also in: linux-clk

On 10/15, Linus Walleij wrote:
quoted hunk ↗ jump to hunk
@@ -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);
Oh now it gets moved.
quoted hunk ↗ jump to hunk
-	}
+	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);
Any reason we aren't passing dev as the first argument? Same
comment applies to patch 6.
+	if (IS_ERR(map)) {
+		int ret;
+
+		pr_err("could not initialize ICST regmap\n");
+		ret = PTR_ERR(map);
+		return ERR_PTR(ret);
Use ERR_CAST(map) instead.
+	}
+	return icst_clk_setup(dev, desc, name, parent_name, map);
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help