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

Commit 8d581fd0 authored by Sachin Kamat's avatar Sachin Kamat Committed by Mark Brown
Browse files

regulator: max8973-regulator: Use devm_regulator_register



devm_* simplifies the code.

Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 5ecdf140
Loading
Loading
Loading
Loading
+1 −10
Original line number Original line Diff line number Diff line
@@ -467,7 +467,7 @@ static int max8973_probe(struct i2c_client *client,
	config.regmap = max->regmap;
	config.regmap = max->regmap;


	/* Register the regulators */
	/* Register the regulators */
	rdev = regulator_register(&max->desc, &config);
	rdev = devm_regulator_register(&client->dev, &max->desc, &config);
	if (IS_ERR(rdev)) {
	if (IS_ERR(rdev)) {
		ret = PTR_ERR(rdev);
		ret = PTR_ERR(rdev);
		dev_err(max->dev, "regulator register failed, err %d\n", ret);
		dev_err(max->dev, "regulator register failed, err %d\n", ret);
@@ -478,14 +478,6 @@ static int max8973_probe(struct i2c_client *client,
	return 0;
	return 0;
}
}


static int max8973_remove(struct i2c_client *client)
{
	struct max8973_chip *max = i2c_get_clientdata(client);

	regulator_unregister(max->rdev);
	return 0;
}

static const struct i2c_device_id max8973_id[] = {
static const struct i2c_device_id max8973_id[] = {
	{.name = "max8973",},
	{.name = "max8973",},
	{},
	{},
@@ -499,7 +491,6 @@ static struct i2c_driver max8973_i2c_driver = {
		.owner = THIS_MODULE,
		.owner = THIS_MODULE,
	},
	},
	.probe = max8973_probe,
	.probe = max8973_probe,
	.remove = max8973_remove,
	.id_table = max8973_id,
	.id_table = max8973_id,
};
};