lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 11 Dec 2018 13:12:07 -0600
From:   Dan Murphy <dmurphy@...com>
To:     <linux-iio@...r.kernel.org>
CC:     <linux-kernel@...r.kernel.org>, <jic23@...nel.org>,
        <robh+dt@...nel.org>, Dan Murphy <dmurphy@...com>
Subject: [PATCH v2 4/4] iio: ti-ads8688: Migrate to device managed IIO calls

Migrate the driver to use the devm IIO calls as opposed to
the unmanaged calls.

Signed-off-by: Dan Murphy <dmurphy@...com>
---

v2 - New patch

 drivers/iio/adc/ti-ads8688.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c
index 3597bc0697ee..8f42103a1fd9 100644
--- a/drivers/iio/adc/ti-ads8688.c
+++ b/drivers/iio/adc/ti-ads8688.c
@@ -462,21 +462,21 @@ static int ads8688_probe(struct spi_device *spi)
 
 	mutex_init(&st->lock);
 
-	ret = iio_triggered_buffer_setup(indio_dev, NULL, ads8688_trigger_handler, NULL);
+	ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL,
+					      ads8688_trigger_handler, NULL);
 	if (ret < 0) {
 		dev_err(&spi->dev, "iio triggered buffer setup failed\n");
 		goto err_regulator_disable;
 	}
 
-	ret = iio_device_register(indio_dev);
-	if (ret)
-		goto err_buffer_cleanup;
+	ret = devm_iio_device_register(&spi->dev, indio_dev);
+	if (ret < 0) {
+		dev_err(&spi->dev, "iio device registration failed\n");
+		goto err_regulator_disable;
+	}
 
 	return 0;
 
-err_buffer_cleanup:
-	iio_triggered_buffer_cleanup(indio_dev);
-
 err_regulator_disable:
 	if (!IS_ERR(st->reg))
 		regulator_disable(st->reg);
@@ -489,9 +489,6 @@ static int ads8688_remove(struct spi_device *spi)
 	struct iio_dev *indio_dev = spi_get_drvdata(spi);
 	struct ads8688_state *st = iio_priv(indio_dev);
 
-	iio_device_unregister(indio_dev);
-	iio_triggered_buffer_cleanup(indio_dev);
-
 	if (!IS_ERR(st->reg))
 		regulator_disable(st->reg);
 
-- 
2.20.0.rc2.7.g965798d1f2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ