--- zzzz-none-000/linux-3.10.107/drivers/regulator/isl6271a-regulator.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/regulator/isl6271a-regulator.c 2021-02-04 17:41:59.000000000 +0000 @@ -110,9 +110,9 @@ const struct i2c_device_id *id) { struct regulator_config config = { }; - struct regulator_init_data *init_data = i2c->dev.platform_data; + struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev); struct isl_pmic *pmic; - int err, i; + int i; if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; @@ -130,35 +130,20 @@ if (i == 0) config.init_data = init_data; else - config.init_data = 0; + config.init_data = NULL; config.driver_data = pmic; - pmic->rdev[i] = regulator_register(&isl_rd[i], &config); + pmic->rdev[i] = devm_regulator_register(&i2c->dev, &isl_rd[i], + &config); if (IS_ERR(pmic->rdev[i])) { dev_err(&i2c->dev, "failed to register %s\n", id->name); - err = PTR_ERR(pmic->rdev[i]); - goto error; + return PTR_ERR(pmic->rdev[i]); } } i2c_set_clientdata(i2c, pmic); return 0; - -error: - while (--i >= 0) - regulator_unregister(pmic->rdev[i]); - return err; -} - -static int isl6271a_remove(struct i2c_client *i2c) -{ - struct isl_pmic *pmic = i2c_get_clientdata(i2c); - int i; - - for (i = 0; i < 3; i++) - regulator_unregister(pmic->rdev[i]); - return 0; } static const struct i2c_device_id isl6271a_id[] = { @@ -171,10 +156,8 @@ static struct i2c_driver isl6271a_i2c_driver = { .driver = { .name = "isl6271a", - .owner = THIS_MODULE, }, .probe = isl6271a_probe, - .remove = isl6271a_remove, .id_table = isl6271a_id, };