Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: pressure: ms5611: Switch to fully devm_ managed registration.

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>

+3 -27
-1
drivers/iio/pressure/ms5611.h
··· 54 54 55 55 int ms5611_probe(struct iio_dev *indio_dev, struct device *dev, 56 56 const char *name, int type); 57 - void ms5611_remove(struct iio_dev *indio_dev); 58 57 59 58 #endif /* _MS5611_H */
+3 -14
drivers/iio/pressure/ms5611_core.c
··· 434 434 if (ret < 0) 435 435 return ret; 436 436 437 - ret = iio_triggered_buffer_setup(indio_dev, NULL, 437 + ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, 438 438 ms5611_trigger_handler, NULL); 439 439 if (ret < 0) { 440 440 dev_err(dev, "iio triggered buffer setup failed\n"); 441 441 return ret; 442 442 } 443 443 444 - ret = iio_device_register(indio_dev); 444 + ret = devm_iio_device_register(dev, indio_dev); 445 445 if (ret < 0) { 446 446 dev_err(dev, "unable to register iio device\n"); 447 - goto err_buffer_cleanup; 447 + return ret; 448 448 } 449 449 450 450 return 0; 451 - 452 - err_buffer_cleanup: 453 - iio_triggered_buffer_cleanup(indio_dev); 454 - return ret; 455 451 } 456 452 EXPORT_SYMBOL_NS(ms5611_probe, IIO_MS5611); 457 - 458 - void ms5611_remove(struct iio_dev *indio_dev) 459 - { 460 - iio_device_unregister(indio_dev); 461 - iio_triggered_buffer_cleanup(indio_dev); 462 - } 463 - EXPORT_SYMBOL_NS(ms5611_remove, IIO_MS5611); 464 453 465 454 MODULE_AUTHOR("Tomasz Duszynski <tduszyns@gmail.com>"); 466 455 MODULE_DESCRIPTION("MS5611 core driver");
-6
drivers/iio/pressure/ms5611_i2c.c
··· 105 105 return ms5611_probe(indio_dev, &client->dev, id->name, id->driver_data); 106 106 } 107 107 108 - static void ms5611_i2c_remove(struct i2c_client *client) 109 - { 110 - ms5611_remove(i2c_get_clientdata(client)); 111 - } 112 - 113 108 static const struct of_device_id ms5611_i2c_matches[] = { 114 109 { .compatible = "meas,ms5611" }, 115 110 { .compatible = "meas,ms5607" }, ··· 126 131 }, 127 132 .id_table = ms5611_id, 128 133 .probe_new = ms5611_i2c_probe, 129 - .remove = ms5611_i2c_remove, 130 134 }; 131 135 module_i2c_driver(ms5611_driver); 132 136
-6
drivers/iio/pressure/ms5611_spi.c
··· 107 107 spi_get_device_id(spi)->driver_data); 108 108 } 109 109 110 - static void ms5611_spi_remove(struct spi_device *spi) 111 - { 112 - ms5611_remove(spi_get_drvdata(spi)); 113 - } 114 - 115 110 static const struct of_device_id ms5611_spi_matches[] = { 116 111 { .compatible = "meas,ms5611" }, 117 112 { .compatible = "meas,ms5607" }, ··· 128 133 }, 129 134 .id_table = ms5611_id, 130 135 .probe = ms5611_spi_probe, 131 - .remove = ms5611_spi_remove, 132 136 }; 133 137 module_spi_driver(ms5611_driver); 134 138