lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1337438050-3707-3-git-send-email-ldewangan@nvidia.com>
Date:	Sat, 19 May 2012 20:04:07 +0530
From:	Laxman Dewangan <ldewangan@...dia.com>
To:	<lrg@...com>, <broonie@...nsource.wolfsonmicro.com>
CC:	<linux-kernel@...r.kernel.org>,
	Laxman Dewangan <ldewangan@...dia.com>
Subject: [PATCH 2/5] regulator: tps65910: set of_node for regulator register config

set of_node parameter for regulator registration configuration
parameter. This node contains the regulator related device node
information for regulator which need to be register.

Signed-off-by: Laxman Dewangan <ldewangan@...dia.com>
---
 drivers/regulator/tps65910-regulator.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index bd616a0..dd0e2cb 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1071,7 +1071,7 @@ static struct of_regulator_match tps65911_matches[] = {
 };
 
 static struct tps65910_board *tps65910_parse_dt_reg_data(
-				struct platform_device *pdev)
+	struct platform_device *pdev, struct device_node **regulators_node)
 {
 	struct tps65910_board *pmic_plat_data;
 	struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
@@ -1090,6 +1090,12 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
 	}
 
 	regulators = of_find_node_by_name(np, "regulators");
+	if (!regulators) {
+		dev_err(&pdev->dev, "regulator node not found\n");
+		return NULL;
+	}
+
+	*regulators_node = regulators;
 
 	switch (tps65910_chip_id(tps65910)) {
 	case TPS65910:
@@ -1129,8 +1135,9 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
 }
 #else
 static inline struct tps65910_board *tps65910_parse_dt_reg_data(
-				struct platform_device *pdev)
+	struct platform_device *pdev, struct device_node **regulators_node)
 {
+	*regulators_node = NULL;
 	return 0;
 }
 #endif
@@ -1145,10 +1152,11 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
 	struct tps65910_reg *pmic;
 	struct tps65910_board *pmic_plat_data;
 	int i, err;
+	struct device_node *reg_node = NULL;
 
 	pmic_plat_data = dev_get_platdata(tps65910->dev);
 	if (!pmic_plat_data && tps65910->dev->of_node)
-		pmic_plat_data = tps65910_parse_dt_reg_data(pdev);
+		pmic_plat_data = tps65910_parse_dt_reg_data(pdev, &reg_node);
 
 	if (!pmic_plat_data)
 		return -EINVAL;
@@ -1257,10 +1265,9 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
 		config.driver_data = pmic;
 		config.regmap = tps65910->regmap;
 
-#ifdef CONFIG_OF
-		config.of_node = of_find_node_by_name(tps65910->dev->of_node,
+		if (reg_node)
+			config.of_node = of_find_node_by_name(reg_node,
 							info->name);
-#endif
 
 		rdev = regulator_register(&pmic->desc[i], &config);
 		if (IS_ERR(rdev)) {
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ