staging: iio: resolver: replace iio_device_register by devm_iio_device_register
authorIoana Ciornei <ciorneiioana@gmail.com>
Fri, 2 Oct 2015 10:37:50 +0000 (13:37 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Oct 2015 07:31:07 +0000 (08:31 +0100)
Use devm_iio_device_register instead of iio_device_register when the remove
function is only used to call iio_device_unregister in order to ease the error path.
Since resource managed functions implicitly call unregister at driver detach also remove
iio_device_unregister

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/resolver/ad2s90.c

index e24c5890652f8d1c1b0280875f25cde6fb0050a5..c57a29616223ba54b8335691d6b122c7a6553f30 100644 (file)
@@ -79,7 +79,7 @@ static int ad2s90_probe(struct spi_device *spi)
        indio_dev->num_channels = 1;
        indio_dev->name = spi_get_device_id(spi)->name;
 
-       ret = iio_device_register(indio_dev);
+       ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
        if (ret)
                return ret;
 
@@ -91,13 +91,6 @@ static int ad2s90_probe(struct spi_device *spi)
        return 0;
 }
 
-static int ad2s90_remove(struct spi_device *spi)
-{
-       iio_device_unregister(spi_get_drvdata(spi));
-
-       return 0;
-}
-
 static const struct spi_device_id ad2s90_id[] = {
        { "ad2s90" },
        {}
@@ -110,7 +103,6 @@ static struct spi_driver ad2s90_driver = {
                .owner = THIS_MODULE,
        },
        .probe = ad2s90_probe,
-       .remove = ad2s90_remove,
        .id_table = ad2s90_id,
 };
 module_spi_driver(ad2s90_driver);
This page took 0.025188 seconds and 5 git commands to generate.