Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210105130221.GA3438042@localhost.localdomain
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Matti Vaittinen and committed by
Mark Brown
3c14dbd4 c4208849

+7 -17
+3 -8
drivers/regulator/bd70528-regulator.c
··· 244 244 245 245 static int bd70528_probe(struct platform_device *pdev) 246 246 { 247 - struct rohm_regmap_dev *bd70528; 248 247 int i; 249 248 struct regulator_config config = { 250 249 .dev = pdev->dev.parent, 251 250 }; 252 251 253 - bd70528 = dev_get_drvdata(pdev->dev.parent); 254 - if (!bd70528) { 255 - dev_err(&pdev->dev, "No MFD driver data\n"); 256 - return -EINVAL; 257 - } 258 - 259 - config.regmap = bd70528->regmap; 252 + config.regmap = dev_get_regmap(pdev->dev.parent, NULL); 253 + if (!config.regmap) 254 + return -ENODEV; 260 255 261 256 for (i = 0; i < ARRAY_SIZE(bd70528_desc); i++) { 262 257 struct regulator_dev *rdev;
+4 -9
drivers/regulator/bd71828-regulator.c
··· 749 749 750 750 static int bd71828_probe(struct platform_device *pdev) 751 751 { 752 - struct rohm_regmap_dev *bd71828; 753 752 int i, j, ret; 754 753 struct regulator_config config = { 755 754 .dev = pdev->dev.parent, 756 755 }; 757 756 758 - bd71828 = dev_get_drvdata(pdev->dev.parent); 759 - if (!bd71828) { 760 - dev_err(&pdev->dev, "No MFD driver data\n"); 761 - return -EINVAL; 762 - } 763 - 764 - config.regmap = bd71828->regmap; 757 + config.regmap = dev_get_regmap(pdev->dev.parent, NULL); 758 + if (!config.regmap) 759 + return -ENODEV; 765 760 766 761 for (i = 0; i < ARRAY_SIZE(bd71828_rdata); i++) { 767 762 struct regulator_dev *rdev; ··· 772 777 return PTR_ERR(rdev); 773 778 } 774 779 for (j = 0; j < rd->reg_init_amnt; j++) { 775 - ret = regmap_update_bits(bd71828->regmap, 780 + ret = regmap_update_bits(config.regmap, 776 781 rd->reg_inits[j].reg, 777 782 rd->reg_inits[j].mask, 778 783 rd->reg_inits[j].val);