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

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ti-ads8688: drop ads8688_remove()

By using a few devm_ functions, we can simplify the driver and remove
the ads8688_remove() function.

spi_set_drvdata() is removed since there are no more callers of
spi_get_drvdata().

Also use dev_err_probe() to simplify error return.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-9-49e50cd0b99a@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
a4a9fc32 2867ccf4

+6 -26
+6 -26
drivers/iio/adc/ti-ads8688.c
··· 432 432 433 433 spi->mode = SPI_MODE_1; 434 434 435 - spi_set_drvdata(spi, indio_dev); 436 - 437 435 st->spi = spi; 438 436 439 437 indio_dev->name = spi_get_device_id(spi)->name; ··· 444 446 445 447 mutex_init(&st->lock); 446 448 447 - ret = iio_triggered_buffer_setup(indio_dev, NULL, ads8688_trigger_handler, NULL); 448 - if (ret < 0) { 449 - dev_err(&spi->dev, "iio triggered buffer setup failed\n"); 450 - return ret; 451 - } 449 + ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL, 450 + ads8688_trigger_handler, NULL); 451 + if (ret < 0) 452 + return dev_err_probe(&spi->dev, ret, 453 + "iio triggered buffer setup failed\n"); 452 454 453 - ret = iio_device_register(indio_dev); 454 - if (ret) 455 - goto err_buffer_cleanup; 456 - 457 - return 0; 458 - 459 - err_buffer_cleanup: 460 - iio_triggered_buffer_cleanup(indio_dev); 461 - 462 - return ret; 463 - } 464 - 465 - static void ads8688_remove(struct spi_device *spi) 466 - { 467 - struct iio_dev *indio_dev = spi_get_drvdata(spi); 468 - 469 - iio_device_unregister(indio_dev); 470 - iio_triggered_buffer_cleanup(indio_dev); 455 + return devm_iio_device_register(&spi->dev, indio_dev); 471 456 } 472 457 473 458 static const struct spi_device_id ads8688_id[] = { ··· 473 492 .of_match_table = ads8688_of_match, 474 493 }, 475 494 .probe = ads8688_probe, 476 - .remove = ads8688_remove, 477 495 .id_table = ads8688_id, 478 496 }; 479 497 module_spi_driver(ads8688_driver);