staging: iio: cdc: use devm_iio_device_register instead iio_device_register
authorIoana Ciornei <ciorneiioana@gmail.com>
Fri, 2 Oct 2015 10:37:48 +0000 (13:37 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Oct 2015 07:31:07 +0000 (08:31 +0100)
Replace iio_device_register with resource managed devm_iio_device_register in order
to ease the error path. Also delete de remove function since there is no need after
this change.

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

index a2b7ae3329c0e56cd345340a7c0c6426cfe621fd..ff833949591c7468d367cb4750058268fc77db4e 100644 (file)
@@ -636,7 +636,7 @@ static int ad7150_probe(struct i2c_client *client,
                        return ret;
        }
 
-       ret = iio_device_register(indio_dev);
+       ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
        if (ret)
                return ret;
 
@@ -646,15 +646,6 @@ static int ad7150_probe(struct i2c_client *client,
        return 0;
 }
 
-static int ad7150_remove(struct i2c_client *client)
-{
-       struct iio_dev *indio_dev = i2c_get_clientdata(client);
-
-       iio_device_unregister(indio_dev);
-
-       return 0;
-}
-
 static const struct i2c_device_id ad7150_id[] = {
        { "ad7150", 0 },
        { "ad7151", 0 },
@@ -669,7 +660,6 @@ static struct i2c_driver ad7150_driver = {
                .name = "ad7150",
        },
        .probe = ad7150_probe,
-       .remove = ad7150_remove,
        .id_table = ad7150_id,
 };
 module_i2c_driver(ad7150_driver);
index 87110d940e9a429d65d136abff4d93805ad8bdc7..c3d5531f73c2640c79bf78812242e686922d3d9c 100644 (file)
@@ -502,7 +502,7 @@ static int ad7152_probe(struct i2c_client *client,
        indio_dev->num_channels = ARRAY_SIZE(ad7152_channels);
        indio_dev->modes = INDIO_DIRECT_MODE;
 
-       ret = iio_device_register(indio_dev);
+       ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
        if (ret)
                return ret;
 
@@ -511,15 +511,6 @@ static int ad7152_probe(struct i2c_client *client,
        return 0;
 }
 
-static int ad7152_remove(struct i2c_client *client)
-{
-       struct iio_dev *indio_dev = i2c_get_clientdata(client);
-
-       iio_device_unregister(indio_dev);
-
-       return 0;
-}
-
 static const struct i2c_device_id ad7152_id[] = {
        { "ad7152", 0 },
        { "ad7153", 1 },
@@ -533,7 +524,6 @@ static struct i2c_driver ad7152_driver = {
                .name = KBUILD_MODNAME,
        },
        .probe = ad7152_probe,
-       .remove = ad7152_remove,
        .id_table = ad7152_id,
 };
 module_i2c_driver(ad7152_driver);
index 10fa372a4182ab97f69091754f0f6a8e199d62b1..999c4fa0499dac913af33a8c7679c747c39488c2 100644 (file)
@@ -749,7 +749,7 @@ static int ad7746_probe(struct i2c_client *client,
        if (ret < 0)
                return ret;
 
-       ret = iio_device_register(indio_dev);
+       ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
        if (ret)
                return ret;
 
@@ -758,15 +758,6 @@ static int ad7746_probe(struct i2c_client *client,
        return 0;
 }
 
-static int ad7746_remove(struct i2c_client *client)
-{
-       struct iio_dev *indio_dev = i2c_get_clientdata(client);
-
-       iio_device_unregister(indio_dev);
-
-       return 0;
-}
-
 static const struct i2c_device_id ad7746_id[] = {
        { "ad7745", 7745 },
        { "ad7746", 7746 },
@@ -781,7 +772,6 @@ static struct i2c_driver ad7746_driver = {
                .name = KBUILD_MODNAME,
        },
        .probe = ad7746_probe,
-       .remove = ad7746_remove,
        .id_table = ad7746_id,
 };
 module_i2c_driver(ad7746_driver);
This page took 0.027569 seconds and 5 git commands to generate.