Unverified Commit 3c14dbd4 authored by Matti Vaittinen's avatar Matti Vaittinen Committed by Mark Brown
Browse files

regulator: ROHM bd7xxxx: Do not depend on parent driver data



The ROHM PMIC regulator drivers only need the regmap pointer from
the parent device. Regmap can be obtained via dev_get_regmap()
so do not require parent to populate driver data for that.

Signed-off-by: default avatarMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210105130221.GA3438042@localhost.localdomain


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c4208849
Loading
Loading
Loading
Loading
+3 −8
Original line number Original line Diff line number Diff line
@@ -244,19 +244,14 @@ static const struct regulator_desc bd70528_desc[] = {


static int bd70528_probe(struct platform_device *pdev)
static int bd70528_probe(struct platform_device *pdev)
{
{
	struct rohm_regmap_dev *bd70528;
	int i;
	int i;
	struct regulator_config config = {
	struct regulator_config config = {
		.dev = pdev->dev.parent,
		.dev = pdev->dev.parent,
	};
	};


	bd70528 = dev_get_drvdata(pdev->dev.parent);
	config.regmap = dev_get_regmap(pdev->dev.parent, NULL);
	if (!bd70528) {
	if (!config.regmap)
		dev_err(&pdev->dev, "No MFD driver data\n");
		return -ENODEV;
		return -EINVAL;
	}

	config.regmap = bd70528->regmap;


	for (i = 0; i < ARRAY_SIZE(bd70528_desc); i++) {
	for (i = 0; i < ARRAY_SIZE(bd70528_desc); i++) {
		struct regulator_dev *rdev;
		struct regulator_dev *rdev;
+4 −9
Original line number Original line Diff line number Diff line
@@ -749,19 +749,14 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {


static int bd71828_probe(struct platform_device *pdev)
static int bd71828_probe(struct platform_device *pdev)
{
{
	struct rohm_regmap_dev *bd71828;
	int i, j, ret;
	int i, j, ret;
	struct regulator_config config = {
	struct regulator_config config = {
		.dev = pdev->dev.parent,
		.dev = pdev->dev.parent,
	};
	};


	bd71828 = dev_get_drvdata(pdev->dev.parent);
	config.regmap = dev_get_regmap(pdev->dev.parent, NULL);
	if (!bd71828) {
	if (!config.regmap)
		dev_err(&pdev->dev, "No MFD driver data\n");
		return -ENODEV;
		return -EINVAL;
	}

	config.regmap = bd71828->regmap;


	for (i = 0; i < ARRAY_SIZE(bd71828_rdata); i++) {
	for (i = 0; i < ARRAY_SIZE(bd71828_rdata); i++) {
		struct regulator_dev *rdev;
		struct regulator_dev *rdev;
@@ -777,7 +772,7 @@ static int bd71828_probe(struct platform_device *pdev)
			return PTR_ERR(rdev);
			return PTR_ERR(rdev);
		}
		}
		for (j = 0; j < rd->reg_init_amnt; j++) {
		for (j = 0; j < rd->reg_init_amnt; j++) {
			ret = regmap_update_bits(bd71828->regmap,
			ret = regmap_update_bits(config.regmap,
						 rd->reg_inits[j].reg,
						 rd->reg_inits[j].reg,
						 rd->reg_inits[j].mask,
						 rd->reg_inits[j].mask,
						 rd->reg_inits[j].val);
						 rd->reg_inits[j].val);