diff options
author | David Veenstra <davidjulianveenstra@gmail.com> | 2018-05-18 20:21:44 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2018-05-20 11:54:43 +0100 |
commit | 94cdefa81b99dd37239cdb147bc5a1473a3cdacc (patch) | |
tree | fcf807a54f4f1f200587a86802dd5c2e95222865 /drivers | |
parent | bc683b47c31d68050fd1cd5231804c3be2df1766 (diff) | |
download | linux-94cdefa81b99dd37239cdb147bc5a1473a3cdacc.tar.bz2 |
staging: iio: ad2s1200: Setup spi before iio device register
The spi should be set up before the device is registered as an iio
device.
This patch moves the setup to before the device registration.
Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/resolver/ad2s1200.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c index 068aa86e9c11..430cc62591fe 100644 --- a/drivers/staging/iio/resolver/ad2s1200.c +++ b/drivers/staging/iio/resolver/ad2s1200.c @@ -143,15 +143,16 @@ static int ad2s1200_probe(struct spi_device *spi) indio_dev->num_channels = ARRAY_SIZE(ad2s1200_channels); indio_dev->name = spi_get_device_id(spi)->name; - ret = devm_iio_device_register(&spi->dev, indio_dev); - if (ret) - return ret; - spi->max_speed_hz = AD2S1200_HZ; spi->mode = SPI_MODE_3; - spi_setup(spi); + ret = spi_setup(spi); + + if (ret < 0) { + dev_err(&spi->dev, "spi_setup failed!\n"); + return ret; + } - return 0; + return devm_iio_device_register(&spi->dev, indio_dev); } static const struct spi_device_id ad2s1200_id[] = { |