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>
return ret;
}
- ret = iio_device_register(indio_dev);
+ ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
if (ret)
return ret;
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 },
.name = "ad7150",
},
.probe = ad7150_probe,
- .remove = ad7150_remove,
.id_table = ad7150_id,
};
module_i2c_driver(ad7150_driver);
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;
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 },
.name = KBUILD_MODNAME,
},
.probe = ad7152_probe,
- .remove = ad7152_remove,
.id_table = ad7152_id,
};
module_i2c_driver(ad7152_driver);
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;
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 },
.name = KBUILD_MODNAME,
},
.probe = ad7746_probe,
- .remove = ad7746_remove,
.id_table = ad7746_id,
};
module_i2c_driver(ad7746_driver);