--- zzzz-none-000/linux-3.10.107/drivers/iio/adc/ti-adc081c.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/iio/adc/ti-adc081c.c 2021-02-04 17:41:59.000000000 +0000 @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -74,22 +75,20 @@ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -ENODEV; - iio = iio_device_alloc(sizeof(*adc)); + iio = devm_iio_device_alloc(&client->dev, sizeof(*adc)); if (!iio) return -ENOMEM; adc = iio_priv(iio); adc->i2c = client; - adc->ref = regulator_get(&client->dev, "vref"); - if (IS_ERR(adc->ref)) { - err = PTR_ERR(adc->ref); - goto iio_free; - } + adc->ref = devm_regulator_get(&client->dev, "vref"); + if (IS_ERR(adc->ref)) + return PTR_ERR(adc->ref); err = regulator_enable(adc->ref); if (err < 0) - goto regulator_put; + return err; iio->dev.parent = &client->dev; iio->name = dev_name(&client->dev); @@ -109,10 +108,6 @@ regulator_disable: regulator_disable(adc->ref); -regulator_put: - regulator_put(adc->ref); -iio_free: - iio_device_free(iio); return err; } @@ -124,8 +119,6 @@ iio_device_unregister(iio); regulator_disable(adc->ref); - regulator_put(adc->ref); - iio_device_free(iio); return 0; } @@ -147,7 +140,6 @@ static struct i2c_driver adc081c_driver = { .driver = { .name = "adc081c", - .owner = THIS_MODULE, .of_match_table = of_match_ptr(adc081c_of_match), }, .probe = adc081c_probe,