--- zzzz-none-000/linux-3.10.107/drivers/iio/amplifiers/ad8366.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/iio/amplifiers/ad8366.c 2021-02-04 17:41:59.000000000 +0000 @@ -31,7 +31,7 @@ }; static int ad8366_write(struct iio_dev *indio_dev, - unsigned char ch_a, char unsigned ch_b) + unsigned char ch_a, unsigned char ch_b) { struct ad8366_state *st = iio_priv(indio_dev); int ret; @@ -139,17 +139,17 @@ struct ad8366_state *st; int ret; - indio_dev = iio_device_alloc(sizeof(*st)); + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); if (indio_dev == NULL) return -ENOMEM; st = iio_priv(indio_dev); - st->reg = regulator_get(&spi->dev, "vcc"); + st->reg = devm_regulator_get(&spi->dev, "vcc"); if (!IS_ERR(st->reg)) { ret = regulator_enable(st->reg); if (ret) - goto error_put_reg; + return ret; } spi_set_drvdata(spi, indio_dev); @@ -166,18 +166,13 @@ if (ret) goto error_disable_reg; - ad8366_write(indio_dev, 0 , 0); + ad8366_write(indio_dev, 0, 0); return 0; error_disable_reg: if (!IS_ERR(st->reg)) regulator_disable(st->reg); -error_put_reg: - if (!IS_ERR(st->reg)) - regulator_put(st->reg); - - iio_device_free(indio_dev); return ret; } @@ -190,12 +185,8 @@ iio_device_unregister(indio_dev); - if (!IS_ERR(reg)) { + if (!IS_ERR(reg)) regulator_disable(reg); - regulator_put(reg); - } - - iio_device_free(indio_dev); return 0; } @@ -204,11 +195,11 @@ {"ad8366", 0}, {} }; +MODULE_DEVICE_TABLE(spi, ad8366_id); static struct spi_driver ad8366_driver = { .driver = { .name = KBUILD_MODNAME, - .owner = THIS_MODULE, }, .probe = ad8366_probe, .remove = ad8366_remove,