staging: iio: addac: Use devm_iio_device_register

devm_iio_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Sachin Kamat 2013-10-29 11:39:00 +00:00 committed by Jonathan Cameron
parent afb6fd5fca
commit 334696bd60
4 changed files with 1 additions and 24 deletions

View File

@ -108,11 +108,6 @@ static int adt7316_i2c_probe(struct i2c_client *client,
return adt7316_probe(&client->dev, &bus, id->name); return adt7316_probe(&client->dev, &bus, id->name);
} }
static int adt7316_i2c_remove(struct i2c_client *client)
{
return adt7316_remove(&client->dev);
}
static const struct i2c_device_id adt7316_i2c_id[] = { static const struct i2c_device_id adt7316_i2c_id[] = {
{ "adt7316", 0 }, { "adt7316", 0 },
{ "adt7317", 0 }, { "adt7317", 0 },
@ -132,7 +127,6 @@ static struct i2c_driver adt7316_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = adt7316_i2c_probe, .probe = adt7316_i2c_probe,
.remove = adt7316_i2c_remove,
.id_table = adt7316_i2c_id, .id_table = adt7316_i2c_id,
}; };
module_i2c_driver(adt7316_driver); module_i2c_driver(adt7316_driver);

View File

@ -116,11 +116,6 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
return adt7316_probe(&spi_dev->dev, &bus, spi_dev->modalias); return adt7316_probe(&spi_dev->dev, &bus, spi_dev->modalias);
} }
static int adt7316_spi_remove(struct spi_device *spi_dev)
{
return adt7316_remove(&spi_dev->dev);
}
static const struct spi_device_id adt7316_spi_id[] = { static const struct spi_device_id adt7316_spi_id[] = {
{ "adt7316", 0 }, { "adt7316", 0 },
{ "adt7317", 0 }, { "adt7317", 0 },
@ -140,7 +135,6 @@ static struct spi_driver adt7316_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = adt7316_spi_probe, .probe = adt7316_spi_probe,
.remove = adt7316_spi_remove,
.id_table = adt7316_spi_id, .id_table = adt7316_spi_id,
}; };
module_spi_driver(adt7316_driver); module_spi_driver(adt7316_driver);

View File

@ -2166,7 +2166,7 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
if (ret) if (ret)
return -EIO; return -EIO;
ret = iio_device_register(indio_dev); ret = devm_iio_device_register(dev, indio_dev);
if (ret) if (ret)
return ret; return ret;
@ -2177,16 +2177,6 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
} }
EXPORT_SYMBOL(adt7316_probe); EXPORT_SYMBOL(adt7316_probe);
int adt7316_remove(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
iio_device_unregister(indio_dev);
return 0;
}
EXPORT_SYMBOL(adt7316_remove);
MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
MODULE_DESCRIPTION("Analog Devices ADT7316/7/8 and ADT7516/7/9 digital" MODULE_DESCRIPTION("Analog Devices ADT7316/7/8 and ADT7516/7/9 digital"
" temperature sensor, ADC and DAC driver"); " temperature sensor, ADC and DAC driver");

View File

@ -31,6 +31,5 @@ extern const struct dev_pm_ops adt7316_pm_ops;
#define ADT7316_PM_OPS NULL #define ADT7316_PM_OPS NULL
#endif #endif
int adt7316_probe(struct device *dev, struct adt7316_bus *bus, const char *name); int adt7316_probe(struct device *dev, struct adt7316_bus *bus, const char *name);
int adt7316_remove(struct device *dev);
#endif #endif