Skip to contentSkip to conversation

regulator: dummy: Specify a struct device

PATCH In review Mark Brown 2 participants 3 messages May 8, 2012 – May 10, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/2 regulator: dummy: Specify a struct device

This will be becoming mandatory.

---
 drivers/regulator/dummy.c |    1 +
 1 file changed, 1 insertion(+)
drivers/regulator/dummy.c +1 -0
index 1571bee..86f655c 100644
@@ -42,6 +42,7 @@ static int __devinit dummy_regulator_probe(struct platform_device *pdev)
 	struct regulator_config config = { };
 	int ret;
 
+	config.dev = &pdev->dev;
 	config.init_data = &dummy_initdata;
 
 	dummy_regulator_rdev = regulator_register(&dummy_desc, &config);
Signature · 1 line
1.7.10
author
#1 lore raw

PATCH 2/2 regulator: core: Warn on missing struct device

The core really wants a struct device to be supplied for regulators and there's no reason this should be impossible so provide one so complain if we didn't get one.

---
 drivers/regulator/core.c |    1 +
 1 file changed, 1 insertion(+)
drivers/regulator/core.c +1 -0
index c597868..f899af5 100644
@@ -2981,6 +2981,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
 		return ERR_PTR(-EINVAL);
 
 	dev = config->dev;
+	WARN_ON(!dev);
 
 	if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
 		return ERR_PTR(-EINVAL);
Signature · 1 line
1.7.10
Acked-by on v1 1/2
#2 lore raw
In reply to Mark Brown
Quoted 12 lines · Mark Brown

This will be becoming mandatory.

---
 drivers/regulator/dummy.c |    1 +
 1 file changed, 1 insertion(+)
drivers/regulator/dummy.c +0 -0
index 1571bee..86f655c 100644

drivers/regulator/dummy.c static int __devinit dummy_regulator_probe(struct platform_device *pdev) · line 48

Quoted 7 lines
drivers/regulator/dummy.c +1 -0
@@ -42,6 +42,7 @@ static int __devinit dummy_regulator_probe(struct platform_device *pdev)
 	struct regulator_config config = { };
 	int ret;
 
+	config.dev = &pdev->dev;
 	config.init_data = &dummy_initdata;
 
 	dummy_regulator_rdev = regulator_register(&dummy_desc, &config);

Both