linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: tsl2772: Use device-managed API
@ 2019-07-26 12:30 Chuhong Yuan
  2019-07-27 11:57 ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Chuhong Yuan @ 2019-07-26 12:30 UTC (permalink / raw)
  Cc: Jonathan Cameron, linux-iio, linux-kernel, Chuhong Yuan

Use devm_iio_device_register to simplify
the code.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/iio/light/tsl2772.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c
index 83cece921843..aa5891d105e8 100644
--- a/drivers/iio/light/tsl2772.c
+++ b/drivers/iio/light/tsl2772.c
@@ -1877,7 +1877,7 @@ static int tsl2772_probe(struct i2c_client *clientp,
 	if (ret < 0)
 		return ret;
 
-	ret = iio_device_register(indio_dev);
+	ret = devm_iio_device_register(&clientp->dev, indio_dev);
 	if (ret) {
 		tsl2772_chip_off(indio_dev);
 		dev_err(&clientp->dev,
@@ -1928,8 +1928,6 @@ static int tsl2772_remove(struct i2c_client *client)
 
 	tsl2772_chip_off(indio_dev);
 
-	iio_device_unregister(indio_dev);
-
 	return 0;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-07-29 13:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-26 12:30 [PATCH] iio: tsl2772: Use device-managed API Chuhong Yuan
2019-07-27 11:57 ` Jonathan Cameron
2019-07-28  8:31   ` Brian Masney
2019-07-29  3:03     ` Chuhong Yuan
2019-07-29  8:03       ` Brian Masney
2019-07-29 11:08         ` Jonathan Cameron
2019-07-29 13:02           ` Chuhong Yuan
2019-07-29 13:51           ` Brian Masney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).