--- zzzz-none-000/linux-3.10.107/drivers/iio/gyro/adis16080.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/iio/gyro/adis16080.c 2021-02-04 17:41:59.000000000 +0000 @@ -51,7 +51,6 @@ u16 addr, int *val) { struct adis16080_state *st = iio_priv(indio_dev); - struct spi_message m; int ret; struct spi_transfer t[] = { { @@ -66,11 +65,7 @@ st->buf = cpu_to_be16(addr | ADIS16080_DIN_WRITE); - spi_message_init(&m); - spi_message_add_tail(&t[0], &m); - spi_message_add_tail(&t[1], &m); - - ret = spi_sync(st->us, &m); + ret = spi_sync_transfer(st->us, t, ARRAY_SIZE(t)); if (ret == 0) *val = sign_extend32(be16_to_cpu(st->buf), 11); @@ -192,16 +187,13 @@ static int adis16080_probe(struct spi_device *spi) { const struct spi_device_id *id = spi_get_device_id(spi); - int ret; struct adis16080_state *st; struct iio_dev *indio_dev; /* setup the industrialio driver allocated elements */ - indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { - ret = -ENOMEM; - goto error_ret; - } + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); + if (!indio_dev) + return -ENOMEM; st = iio_priv(indio_dev); /* this is only used for removal purposes */ spi_set_drvdata(spi, indio_dev); @@ -217,22 +209,12 @@ indio_dev->info = &adis16080_info; indio_dev->modes = INDIO_DIRECT_MODE; - ret = iio_device_register(indio_dev); - if (ret) - goto error_free_dev; - return 0; - -error_free_dev: - iio_device_free(indio_dev); -error_ret: - return ret; + return iio_device_register(indio_dev); } static int adis16080_remove(struct spi_device *spi) { iio_device_unregister(spi_get_drvdata(spi)); - iio_device_free(spi_get_drvdata(spi)); - return 0; } @@ -246,7 +228,6 @@ static struct spi_driver adis16080_driver = { .driver = { .name = "adis16080", - .owner = THIS_MODULE, }, .probe = adis16080_probe, .remove = adis16080_remove,