linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sachin Kamat <sachin.kamat@linaro.org>
To: linux-iio@vger.kernel.org
Cc: jic23@cam.ac.uk, jic23@kernel.org, sachin.kamat@linaro.org,
	patches@linaro.org, Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH 8/8] staging: iio: light: isl29028: Use devm_iio_device_alloc
Date: Mon, 22 Jul 2013 16:33:01 +0530	[thread overview]
Message-ID: <1374490981-24373-9-git-send-email-sachin.kamat@linaro.org> (raw)
In-Reply-To: <1374490981-24373-1-git-send-email-sachin.kamat@linaro.org>

Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/staging/iio/light/isl29028.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c
index 8bb0d03..6014625 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -482,7 +482,7 @@ static int isl29028_probe(struct i2c_client *client,
 	struct iio_dev *indio_dev;
 	int ret;
 
-	indio_dev = iio_device_alloc(sizeof(*chip));
+	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
 	if (!indio_dev) {
 		dev_err(&client->dev, "iio allocation fails\n");
 		return -ENOMEM;
@@ -498,13 +498,13 @@ static int isl29028_probe(struct i2c_client *client,
 	if (IS_ERR(chip->regmap)) {
 		ret = PTR_ERR(chip->regmap);
 		dev_err(chip->dev, "regmap initialization failed: %d\n", ret);
-		goto exit_iio_free;
+		return ret;
 	}
 
 	ret = isl29028_chip_init(chip);
 	if (ret < 0) {
 		dev_err(chip->dev, "chip initialization failed: %d\n", ret);
-		goto exit_iio_free;
+		return ret;
 	}
 
 	indio_dev->info = &isl29028_info;
@@ -517,13 +517,9 @@ static int isl29028_probe(struct i2c_client *client,
 	if (ret < 0) {
 		dev_err(chip->dev, "iio registration fails with error %d\n",
 			ret);
-		goto exit_iio_free;
+		return ret;
 	}
 	return 0;
-
-exit_iio_free:
-	iio_device_free(indio_dev);
-	return ret;
 }
 
 static int isl29028_remove(struct i2c_client *client)
@@ -531,7 +527,6 @@ static int isl29028_remove(struct i2c_client *client)
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
 
 	iio_device_unregister(indio_dev);
-	iio_device_free(indio_dev);
 	return 0;
 }
 
-- 
1.7.9.5

  parent reply	other threads:[~2013-07-22 11:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22 11:02 [PATCH 0/8] Use devm_iio_device_alloc Sachin Kamat
2013-07-22 11:02 ` [PATCH 1/8] iio: at91: " Sachin Kamat
2013-07-27 11:24   ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 2/8] iio: exynos_adc: " Sachin Kamat
2013-07-27 11:25   ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 3/8] iio: max1363: " Sachin Kamat
2013-07-27 11:25   ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 4/8] iio: frequency: adf4350: Use devm_* APIs Sachin Kamat
2013-07-27 11:26   ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 5/8] staging: iio: mxs-lradc: Use devm_iio_device_alloc Sachin Kamat
2013-07-22 22:04   ` Marek Vasut
2013-07-27 11:29     ` Jonathan Cameron
2013-07-22 11:02 ` [PATCH 6/8] staging: iio: spear_adc: " Sachin Kamat
2013-07-27 11:29   ` Jonathan Cameron
2013-07-22 11:03 ` [PATCH 7/8] staging: iio: light: isl29018: " Sachin Kamat
2013-07-22 15:16   ` Rhyland Klein
2013-07-27 11:30     ` Jonathan Cameron
2013-07-22 11:03 ` Sachin Kamat [this message]
2013-07-27 11:31   ` [PATCH 8/8] staging: iio: light: isl29028: " Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374490981-24373-9-git-send-email-sachin.kamat@linaro.org \
    --to=sachin.kamat@linaro.org \
    --cc=jic23@cam.ac.uk \
    --cc=jic23@kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=patches@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).