Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b735e47f authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branch 'regulator/topic/devm' into regulator-next

parents 3242a861 5e085575
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -535,7 +535,7 @@ static int ab3100_regulator_register(struct platform_device *pdev,
	config.dev = &pdev->dev;
	config.driver_data = reg;

	rdev = regulator_register(desc, &config);
	rdev = devm_regulator_register(&pdev->dev, desc, &config);
	if (IS_ERR(rdev)) {
		err = PTR_ERR(rdev);
		dev_err(&pdev->dev,
@@ -616,7 +616,6 @@ static int ab3100_regulators_remove(struct platform_device *pdev)
	for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
		struct ab3100_regulator *reg = &ab3100_regulators[i];

		regulator_unregister(reg->rdev);
		reg->rdev = NULL;
	}
	return 0;
+2 −24
Original line number Diff line number Diff line
@@ -413,16 +413,12 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev)
			&pdata->ext_regulator[i];

		/* register regulator with framework */
		info->rdev = regulator_register(&info->desc, &config);
		info->rdev = devm_regulator_register(&pdev->dev, &info->desc,
						     &config);
		if (IS_ERR(info->rdev)) {
			err = PTR_ERR(info->rdev);
			dev_err(&pdev->dev, "failed to register regulator %s\n",
					info->desc.name);
			/* when we fail, un-register all earlier regulators */
			while (--i >= 0) {
				info = &ab8500_ext_regulator_info[i];
				regulator_unregister(info->rdev);
			}
			return err;
		}

@@ -433,26 +429,8 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev)
	return 0;
}

static int ab8500_ext_regulator_remove(struct platform_device *pdev)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(ab8500_ext_regulator_info); i++) {
		struct ab8500_ext_regulator_info *info = NULL;
		info = &ab8500_ext_regulator_info[i];

		dev_vdbg(rdev_get_dev(info->rdev),
			"%s-remove\n", info->desc.name);

		regulator_unregister(info->rdev);
	}

	return 0;
}

static struct platform_driver ab8500_ext_regulator_driver = {
	.probe = ab8500_ext_regulator_probe,
	.remove = ab8500_ext_regulator_remove,
	.driver         = {
		.name   = "ab8500-ext-regulator",
		.owner  = THIS_MODULE,
+4 −17
Original line number Diff line number Diff line
@@ -847,13 +847,13 @@ static int da9063_regulator_probe(struct platform_device *pdev)
		if (da9063_reg_matches)
			config.of_node = da9063_reg_matches[id].of_node;
		config.regmap = da9063->regmap;
		regl->rdev = regulator_register(&regl->desc, &config);
		regl->rdev = devm_regulator_register(&pdev->dev, &regl->desc,
						     &config);
		if (IS_ERR(regl->rdev)) {
			dev_err(&pdev->dev,
				"Failed to register %s regulator\n",
				regl->desc.name);
			ret = PTR_ERR(regl->rdev);
			goto err;
			return PTR_ERR(regl->rdev);
		}
		id++;
		n++;
@@ -862,9 +862,8 @@ static int da9063_regulator_probe(struct platform_device *pdev)
	/* LDOs overcurrent event support */
	irq = platform_get_irq_byname(pdev, "LDO_LIM");
	if (irq < 0) {
		ret = irq;
		dev_err(&pdev->dev, "Failed to get IRQ.\n");
		goto err;
		return irq;
	}

	regulators->irq_ldo_lim = regmap_irq_get_virq(da9063->regmap_irq, irq);
@@ -881,27 +880,15 @@ static int da9063_regulator_probe(struct platform_device *pdev)
	}

	return 0;

err:
	/* Wind back regulators registeration */
	while (--n >= 0)
		regulator_unregister(regulators->regulator[n].rdev);

	return ret;
}

static int da9063_regulator_remove(struct platform_device *pdev)
{
	struct da9063_regulators *regulators = platform_get_drvdata(pdev);
	struct da9063_regulator *regl;

	free_irq(regulators->irq_ldo_lim, regulators);
	free_irq(regulators->irq_uvov, regulators);

	for (regl = &regulators->regulator[regulators->n_regulators - 1];
	     regl >= &regulators->regulator[0]; regl--)
		regulator_unregister(regl->rdev);

	return 0;
}

+1 −9
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
	config.regmap = chip->regmap;
	config.of_node = dev->of_node;

	rdev = regulator_register(&da9210_reg, &config);
	rdev = devm_regulator_register(&i2c->dev, &da9210_reg, &config);
	if (IS_ERR(rdev)) {
		dev_err(&i2c->dev, "Failed to register DA9210 regulator\n");
		return PTR_ERR(rdev);
@@ -168,13 +168,6 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
	return 0;
}

static int da9210_i2c_remove(struct i2c_client *i2c)
{
	struct da9210 *chip = i2c_get_clientdata(i2c);
	regulator_unregister(chip->rdev);
	return 0;
}

static const struct i2c_device_id da9210_i2c_id[] = {
	{"da9210", 0},
	{},
@@ -188,7 +181,6 @@ static struct i2c_driver da9210_regulator_driver = {
		.owner = THIS_MODULE,
	},
	.probe = da9210_i2c_probe,
	.remove = da9210_i2c_remove,
	.id_table = da9210_i2c_id,
};

+3 −30
Original line number Diff line number Diff line
@@ -785,7 +785,7 @@ static int lp872x_regulator_register(struct lp872x *lp)
	struct regulator_desc *desc;
	struct regulator_config cfg = { };
	struct regulator_dev *rdev;
	int i, ret;
	int i;

	for (i = 0; i < lp->num_regulators; i++) {
		desc = (lp->chipid == LP8720) ? &lp8720_regulator_desc[i] :
@@ -796,34 +796,16 @@ static int lp872x_regulator_register(struct lp872x *lp)
		cfg.driver_data = lp;
		cfg.regmap = lp->regmap;

		rdev = regulator_register(desc, &cfg);
		rdev = devm_regulator_register(lp->dev, desc, &cfg);
		if (IS_ERR(rdev)) {
			dev_err(lp->dev, "regulator register err");
			ret =  PTR_ERR(rdev);
			goto err;
			return PTR_ERR(rdev);
		}

		*(lp->regulators + i) = rdev;
	}

	return 0;
err:
	while (--i >= 0) {
		rdev = *(lp->regulators + i);
		regulator_unregister(rdev);
	}
	return ret;
}

static void lp872x_regulator_unregister(struct lp872x *lp)
{
	struct regulator_dev *rdev;
	int i;

	for (i = 0; i < lp->num_regulators; i++) {
		rdev = *(lp->regulators + i);
		regulator_unregister(rdev);
	}
}

static const struct regmap_config lp872x_regmap_config = {
@@ -979,14 +961,6 @@ static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
	return ret;
}

static int lp872x_remove(struct i2c_client *cl)
{
	struct lp872x *lp = i2c_get_clientdata(cl);

	lp872x_regulator_unregister(lp);
	return 0;
}

static const struct of_device_id lp872x_dt_ids[] = {
	{ .compatible = "ti,lp8720", },
	{ .compatible = "ti,lp8725", },
@@ -1008,7 +982,6 @@ static struct i2c_driver lp872x_driver = {
		.of_match_table = of_match_ptr(lp872x_dt_ids),
	},
	.probe = lp872x_probe,
	.remove = lp872x_remove,
	.id_table = lp872x_ids,
};

Loading