--- zzzz-none-000/linux-3.10.107/drivers/regulator/max8925-regulator.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/regulator/max8925-regulator.c 2021-02-04 17:41:59.000000000 +0000 @@ -36,9 +36,7 @@ struct max8925_regulator_info { struct regulator_desc desc; - struct regulator_dev *regulator; struct i2c_client *i2c; - struct max8925_chip *chip; int vol_reg; int enable_reg; @@ -251,10 +249,11 @@ { struct device_node *nproot, *np; int rcount; - nproot = of_node_get(pdev->dev.parent->of_node); + + nproot = pdev->dev.parent->of_node; if (!nproot) return -ENODEV; - np = of_find_node_by_name(nproot, "regulators"); + np = of_get_child_by_name(nproot, "regulators"); if (!np) { dev_err(&pdev->dev, "failed to find regulators node\n"); return -ENODEV; @@ -264,7 +263,7 @@ &max8925_regulator_matches[ridx], 1); of_node_put(np); if (rcount < 0) - return -ENODEV; + return rcount; config->init_data = max8925_regulator_matches[ridx].init_data; config->of_node = max8925_regulator_matches[ridx].of_node; @@ -277,7 +276,7 @@ static int max8925_regulator_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); - struct regulator_init_data *pdata = pdev->dev.platform_data; + struct regulator_init_data *pdata = dev_get_platdata(&pdev->dev); struct regulator_config config = { }; struct max8925_regulator_info *ri; struct resource *res; @@ -303,7 +302,6 @@ return -EINVAL; } ri->i2c = chip->i2c; - ri->chip = chip; config.dev = &pdev->dev; config.driver_data = ri; @@ -312,7 +310,7 @@ if (pdata) config.init_data = pdata; - rdev = regulator_register(&ri->desc, &config); + rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "failed to register regulator %s\n", ri->desc.name); @@ -323,23 +321,11 @@ return 0; } -static int max8925_regulator_remove(struct platform_device *pdev) -{ - struct regulator_dev *rdev = platform_get_drvdata(pdev); - - platform_set_drvdata(pdev, NULL); - regulator_unregister(rdev); - - return 0; -} - static struct platform_driver max8925_regulator_driver = { .driver = { .name = "max8925-regulator", - .owner = THIS_MODULE, }, .probe = max8925_regulator_probe, - .remove = max8925_regulator_remove, }; static int __init max8925_regulator_init(void)