diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c index 30ac7e2ee0233c3847a6cdbc22aba0c66afe889c..1e19aba115ee9ab5060e90a8def360bcd358cbba 100644 --- a/drivers/staging/iio/accel/adis16201_core.c +++ b/drivers/staging/iio/accel/adis16201_core.c @@ -538,8 +538,8 @@ static int adis16201_remove(struct spi_device *spi) adis16201_remove_trigger(indio_dev); iio_ring_buffer_unregister(indio_dev); - iio_device_unregister(indio_dev); adis16201_unconfigure_ring(indio_dev); + iio_device_unregister(indio_dev); return 0; } diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c index dc52462ecf39c7a20bfa0810f5ba60048c7def15..2a658f0e78892de15434619a91e73dd3290be62e 100644 --- a/drivers/staging/iio/accel/adis16203_core.c +++ b/drivers/staging/iio/accel/adis16203_core.c @@ -492,8 +492,8 @@ static int adis16203_remove(struct spi_device *spi) adis16203_remove_trigger(indio_dev); iio_ring_buffer_unregister(indio_dev); - iio_device_unregister(indio_dev); adis16203_unconfigure_ring(indio_dev); + iio_device_unregister(indio_dev); return 0; } diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c index dedccddeb5882cab2c3c25a74f26cc2d11b865a6..42a37bb013652b1082bd34b9644ee10cb6926dde 100644 --- a/drivers/staging/iio/accel/adis16204_core.c +++ b/drivers/staging/iio/accel/adis16204_core.c @@ -567,8 +567,8 @@ static int adis16204_remove(struct spi_device *spi) adis16204_remove_trigger(indio_dev); iio_ring_buffer_unregister(indio_dev); - iio_device_unregister(indio_dev); adis16204_unconfigure_ring(indio_dev); + iio_device_unregister(indio_dev); return 0; } diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index d8f4b27efc752950fed3787b2a2f5f085f4102ae..d59a9e4803b2378150858eeca48dfb67c32c9c10 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c @@ -542,8 +542,8 @@ static int adis16209_remove(struct spi_device *spi) adis16209_remove_trigger(indio_dev); iio_ring_buffer_unregister(indio_dev); - iio_device_unregister(indio_dev); adis16209_unconfigure_ring(indio_dev); + iio_device_unregister(indio_dev); return 0; } diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index f6fa0ba49737e99b5204dd9ac35f77bc0f04e641..b6504f1479b424ce04c8c235908737c64f1712ac 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c @@ -596,8 +596,8 @@ static int adis16240_remove(struct spi_device *spi) adis16240_remove_trigger(indio_dev); iio_ring_buffer_unregister(indio_dev); - iio_device_unregister(indio_dev); adis16240_unconfigure_ring(indio_dev); + iio_device_unregister(indio_dev); return 0; } diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c index ac7c04ea4a285fd1b7a252dfa2ff69ae80b8b2b2..16ddbdec912d689466220d1e08559e88596e300b 100644 --- a/drivers/staging/iio/adc/ad7291.c +++ b/drivers/staging/iio/adc/ad7291.c @@ -857,7 +857,6 @@ static int __devexit ad7291_remove(struct i2c_client *client) if (client->irq) free_irq(client->irq, indio_dev); iio_device_unregister(indio_dev); - iio_free_device(indio_dev); return 0; } diff --git a/drivers/staging/iio/adc/ad7314.c b/drivers/staging/iio/adc/ad7314.c index e3d38dbd846f42c47c009cf0f2fddef110782e1d..094a4ee971c6e864f7ee8271d032e3a41e6e4571 100644 --- a/drivers/staging/iio/adc/ad7314.c +++ b/drivers/staging/iio/adc/ad7314.c @@ -240,7 +240,6 @@ static int __devexit ad7314_remove(struct spi_device *spi_dev) dev_set_drvdata(&spi_dev->dev, NULL); iio_device_unregister(indio_dev); - iio_free_device(indio_dev); return 0; } diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index 2706de30bc8e8391321eafc1463d4eea045be351..5a4586fbe146d98b369fcb3a6fc0b3be62f496a3 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -443,7 +443,6 @@ static int __devexit ad7816_remove(struct spi_device *spi_dev) gpio_free(chip->convert_pin); gpio_free(chip->rdwr_pin); iio_device_unregister(indio_dev); - iio_free_device(indio_dev); return 0; } diff --git a/drivers/staging/iio/adc/adt7310.c b/drivers/staging/iio/adc/adt7310.c index e002e979035d1d224c4679e4a7c3df37a2256af5..edc65c517f6171726b89f8b4194da37070d80ba8 100644 --- a/drivers/staging/iio/adc/adt7310.c +++ b/drivers/staging/iio/adc/adt7310.c @@ -864,7 +864,6 @@ static int __devexit adt7310_remove(struct spi_device *spi_dev) if (spi_dev->irq) free_irq(spi_dev->irq, indio_dev); iio_device_unregister(indio_dev); - iio_free_device(indio_dev); return 0; } diff --git a/drivers/staging/iio/adc/adt75.c b/drivers/staging/iio/adc/adt75.c index 440c79946594cb2f877219331d3d5c0cd5a18ac1..b56bfcdb33750352d404f2daacae5f6a759ccbec 100644 --- a/drivers/staging/iio/adc/adt75.c +++ b/drivers/staging/iio/adc/adt75.c @@ -618,7 +618,6 @@ static int __devexit adt75_remove(struct i2c_client *client) if (client->irq) free_irq(client->irq, indio_dev); iio_device_unregister(indio_dev); - iio_free_device(indio_dev); return 0; } diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c index 0cb30915c0030e5c42c9fd2c2d690750298c7f1d..e60a9d65821b341fcb81bb84acdf48a4f570f611 100644 --- a/drivers/staging/iio/addac/adt7316.c +++ b/drivers/staging/iio/addac/adt7316.c @@ -2225,7 +2225,6 @@ int __devexit adt7316_remove(struct device *dev) if (chip->bus.irq) free_irq(chip->bus.irq, indio_dev); iio_device_unregister(indio_dev); - iio_free_device(indio_dev); return 0; } diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c index 7303bb1390141f170110e44e376157e72f8eb84f..c4bdf42d54417d49f619d80f69fedfeddbfac7a6 100644 --- a/drivers/staging/iio/dac/ad5624r_spi.c +++ b/drivers/staging/iio/dac/ad5624r_spi.c @@ -262,12 +262,12 @@ static int __devinit ad5624r_probe(struct spi_device *spi) indio_dev->info = &ad5624r_info; indio_dev->modes = INDIO_DIRECT_MODE; - ret = iio_device_register(indio_dev); + ret = ad5624r_spi_write(spi, AD5624R_CMD_INTERNAL_REFER_SETUP, 0, + !!voltage_uv, 16); if (ret) goto error_free_dev; - ret = ad5624r_spi_write(spi, AD5624R_CMD_INTERNAL_REFER_SETUP, 0, - !!voltage_uv, 16); + ret = iio_device_register(indio_dev); if (ret) goto error_free_dev; diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index ed3b6db21f1269de85a308d6da7cd25a57165756..6ea6d58fd1c282ed95084dccfebaaa732906723c 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c @@ -677,8 +677,8 @@ static int adis16260_remove(struct spi_device *spi) adis16260_remove_trigger(indio_dev); iio_ring_buffer_unregister(indio_dev); - iio_device_unregister(indio_dev); adis16260_unconfigure_ring(indio_dev); + iio_device_unregister(indio_dev); err_ret: return ret; diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index 43936cb43818c3818602e7bc061a3576293e200f..0697ab3c422f2c27074cae33b56c0d6e7e16eabc 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c @@ -547,7 +547,6 @@ static int ak8975_remove(struct i2c_client *client) int eoc_gpio = data->eoc_gpio; iio_device_unregister(indio_dev); - iio_free_device(indio_dev); if (eoc_gpio) gpio_free(eoc_gpio); diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index f8459e8e855216f51afe2c01801430d7fdc57a07..5e83227da4bcabf7de249da518dbf13207855a29 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -784,8 +784,8 @@ static int __devexit ad2s1210_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); struct ad2s1210_state *st = iio_priv(indio_dev); - iio_device_unregister(indio_dev); ad2s1210_free_gpios(st); + iio_device_unregister(indio_dev); return 0; }