Thread (7 messages) 7 messages, 3 authors, 2012-08-13

RE: [PATCH] mfd/regulator: tps65217: Move regulator plat data handling to regulator

From: AnilKumar, Chimata <hidden>
Date: 2012-08-13 13:36:14
Also in: linux-omap

Hi Matthias,

On Mon, Aug 13, 2012 at 13:57:32, Matthias Kaehlcke wrote:
Hi,

El Fri, Jul 20, 2012 at 03:00:01PM +0530 AnilKumar Ch ha dit:
quoted
Regulator platform data handling was mistakenly added to MFD
driver. So we will see build errors if we compile MFD drivers
without CONFIG_REGULATOR. This patch moves regulator platform
data handling from TPS65217 MFD driver to regulator driver.

diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c
index 6caa222..9730f1d 100644
--- a/drivers/regulator/tps65217-regulator.c
+++ b/drivers/regulator/tps65217-regulator.c

+static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev)
+{
+	struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent);
+	struct device_node *node = tps->dev->of_node;
+	struct tps65217_board *pdata;
+	struct device_node *regs;
+	int i, count;
+
+	regs = of_find_node_by_name(node, "regulators");
+	if (!regs)
+		return NULL;
+
+	count = of_regulator_match(pdev->dev.parent, regs,
+				reg_matches, TPS65217_NUM_REGULATOR);
+	of_node_put(regs);
+	if ((count < 0) || (count > TPS65217_NUM_REGULATOR))
+		return NULL;
+
+	pdata = devm_kzalloc(&pdev->dev, count * sizeof(*pdata),
GFP_KERNEL);
this allocates a struct tps65217_board for each regulator specified in
the device tree. the structure itself provides arrays for the pointers
to the regulator init data and the regulator device tree node, so only
one instance of it is needed
Agree, I will fix that issue in my next version of patch
also the tps65217_board structure should be renamed to something like
tps65217_regulators, now that it is specific to the regulator
Not required because tps65217_board might contain platform data for WLED/
Battery charger driver if require. So the struct was named as tps65217_board

Regards
AnilKumar
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help