iio: pressure: ms5611: Switch to fully devm_ managed registration.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 16 Oct 2022 16:34:09 +0000 (17:34 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 28 Dec 2022 17:19:45 +0000 (17:19 +0000)
All the remaining calls in probe() have devm_ equivalents so
switching to those allows the remove() callbacks to be deleted.
No functional change.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tduszyns@gmail.com>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/20221016163409.320197-15-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/pressure/ms5611.h
drivers/iio/pressure/ms5611_core.c
drivers/iio/pressure/ms5611_i2c.c
drivers/iio/pressure/ms5611_spi.c

index 6656ec9be8e6b682f9f39ca1020eb4b6ae1f7b0a..a78acd3fb18f784081a987977768248c94313836 100644 (file)
@@ -54,6 +54,5 @@ struct ms5611_state {
 
 int ms5611_probe(struct iio_dev *indio_dev, struct device *dev,
                 const char *name, int type);
-void ms5611_remove(struct iio_dev *indio_dev);
 
 #endif /* _MS5611_H */
index a80f1d6120b72361c5b4dd994c6ac0c3ebc20ba4..627497e61a63507066c527381730eb6283734e12 100644 (file)
@@ -434,34 +434,23 @@ int ms5611_probe(struct iio_dev *indio_dev, struct device *dev,
        if (ret < 0)
                return ret;
 
-       ret = iio_triggered_buffer_setup(indio_dev, NULL,
+       ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
                                         ms5611_trigger_handler, NULL);
        if (ret < 0) {
                dev_err(dev, "iio triggered buffer setup failed\n");
                return ret;
        }
 
-       ret = iio_device_register(indio_dev);
+       ret = devm_iio_device_register(dev, indio_dev);
        if (ret < 0) {
                dev_err(dev, "unable to register iio device\n");
-               goto err_buffer_cleanup;
+               return ret;
        }
 
        return 0;
-
-err_buffer_cleanup:
-       iio_triggered_buffer_cleanup(indio_dev);
-       return ret;
 }
 EXPORT_SYMBOL_NS(ms5611_probe, IIO_MS5611);
 
-void ms5611_remove(struct iio_dev *indio_dev)
-{
-       iio_device_unregister(indio_dev);
-       iio_triggered_buffer_cleanup(indio_dev);
-}
-EXPORT_SYMBOL_NS(ms5611_remove, IIO_MS5611);
-
 MODULE_AUTHOR("Tomasz Duszynski <tduszyns@gmail.com>");
 MODULE_DESCRIPTION("MS5611 core driver");
 MODULE_LICENSE("GPL v2");
index caf882497656d57a6fb0d87acdfa1884b0bd5baa..e3c68a3ed76ace11148cd034e231a4d3bca85ca2 100644 (file)
@@ -105,11 +105,6 @@ static int ms5611_i2c_probe(struct i2c_client *client)
        return ms5611_probe(indio_dev, &client->dev, id->name, id->driver_data);
 }
 
-static void ms5611_i2c_remove(struct i2c_client *client)
-{
-       ms5611_remove(i2c_get_clientdata(client));
-}
-
 static const struct of_device_id ms5611_i2c_matches[] = {
        { .compatible = "meas,ms5611" },
        { .compatible = "meas,ms5607" },
@@ -131,7 +126,6 @@ static struct i2c_driver ms5611_driver = {
        },
        .id_table = ms5611_id,
        .probe_new = ms5611_i2c_probe,
-       .remove = ms5611_i2c_remove,
 };
 module_i2c_driver(ms5611_driver);
 
index a0a7205c9c3a453d831a816772fbebba5f5453f2..cc9d1f68c53cc1b298c2ce45b26cbb0bfb516c6d 100644 (file)
@@ -107,11 +107,6 @@ static int ms5611_spi_probe(struct spi_device *spi)
                            spi_get_device_id(spi)->driver_data);
 }
 
-static void ms5611_spi_remove(struct spi_device *spi)
-{
-       ms5611_remove(spi_get_drvdata(spi));
-}
-
 static const struct of_device_id ms5611_spi_matches[] = {
        { .compatible = "meas,ms5611" },
        { .compatible = "meas,ms5607" },
@@ -133,7 +128,6 @@ static struct spi_driver ms5611_driver = {
        },
        .id_table = ms5611_id,
        .probe = ms5611_spi_probe,
-       .remove = ms5611_spi_remove,
 };
 module_spi_driver(ms5611_driver);