--- zzzz-none-000/linux-3.10.107/drivers/iio/dac/ad5449.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/iio/dac/ad5449.c 2021-02-04 17:41:59.000000000 +0000 @@ -101,7 +101,6 @@ { struct ad5449 *st = iio_priv(indio_dev); int ret; - struct spi_message msg; struct spi_transfer t[] = { { .tx_buf = &st->data[0], @@ -114,15 +113,11 @@ }, }; - spi_message_init(&msg); - spi_message_add_tail(&t[0], &msg); - spi_message_add_tail(&t[1], &msg); - mutex_lock(&indio_dev->mlock); st->data[0] = cpu_to_be16(addr << 12); st->data[1] = cpu_to_be16(AD5449_CMD_NOOP); - ret = spi_sync(st->spi, &msg); + ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); if (ret < 0) goto out_unlock; @@ -209,7 +204,12 @@ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ BIT(IIO_CHAN_INFO_SCALE), \ .address = (chan), \ - .scan_type = IIO_ST('u', (bits), 16, 12 - (bits)), \ + .scan_type = { \ + .sign = 'u', \ + .realbits = (bits), \ + .storagebits = 16, \ + .shift = 12 - (bits), \ + }, \ } #define DECLARE_AD5449_CHANNELS(name, bits) \ @@ -275,7 +275,7 @@ unsigned int i; 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; @@ -288,14 +288,14 @@ for (i = 0; i < st->chip_info->num_channels; ++i) st->vref_reg[i].supply = ad5449_vref_name(st, i); - ret = regulator_bulk_get(&spi->dev, st->chip_info->num_channels, + ret = devm_regulator_bulk_get(&spi->dev, st->chip_info->num_channels, st->vref_reg); if (ret) - goto error_free; + return ret; ret = regulator_bulk_enable(st->chip_info->num_channels, st->vref_reg); if (ret) - goto error_free_reg; + return ret; indio_dev->dev.parent = &spi->dev; indio_dev->name = id->name; @@ -325,10 +325,6 @@ error_disable_reg: regulator_bulk_disable(st->chip_info->num_channels, st->vref_reg); -error_free_reg: - regulator_bulk_free(st->chip_info->num_channels, st->vref_reg); -error_free: - iio_device_free(indio_dev); return ret; } @@ -341,9 +337,6 @@ iio_device_unregister(indio_dev); regulator_bulk_disable(st->chip_info->num_channels, st->vref_reg); - regulator_bulk_free(st->chip_info->num_channels, st->vref_reg); - - iio_device_free(indio_dev); return 0; } @@ -363,7 +356,6 @@ static struct spi_driver ad5449_spi_driver = { .driver = { .name = "ad5449", - .owner = THIS_MODULE, }, .probe = ad5449_spi_probe, .remove = ad5449_spi_remove,