linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 2/2] iio:inkern: Use iio_device_{get,put}
Date: Mon, 21 May 2012 10:21:54 +0200	[thread overview]
Message-ID: <1337588514-23938-2-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1337588514-23938-1-git-send-email-lars@metafoo.de>

Use iio_device_get and iio_device_put instead of open-coding it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/iio/inkern.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 9226458..ff84a57 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -125,7 +125,7 @@ struct iio_channel *iio_st_channel_get(const char *name,
 		     strcmp(channel_name, c_i->map->consumer_channel) != 0))
 			continue;
 		c = c_i;
-		get_device(&c->indio_dev->dev);
+		iio_device_get(c->indio_dev);
 		break;
 	}
 	mutex_unlock(&iio_map_list_lock);
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(iio_st_channel_get);
 
 void iio_st_channel_release(struct iio_channel *channel)
 {
-	put_device(&channel->indio_dev->dev);
+	iio_device_put(channel->indio_dev);
 	kfree(channel);
 }
 EXPORT_SYMBOL_GPL(iio_st_channel_release);
@@ -195,10 +195,10 @@ struct iio_channel *iio_st_channel_get_all(const char *name)
 						c->map->adc_channel_label);
 		if (chans[mapind].channel == NULL) {
 			ret = -EINVAL;
-			put_device(&chans[mapind].indio_dev->dev);
+			iio_device_put(chans[mapind].indio_dev);
 			goto error_free_chans;
 		}
-		get_device(&chans[mapind].indio_dev->dev);
+		iio_device_get(chans->indio_dev);
 		mapind++;
 	}
 	mutex_unlock(&iio_map_list_lock);
@@ -210,8 +210,7 @@ struct iio_channel *iio_st_channel_get_all(const char *name)
 
 error_free_chans:
 	for (i = 0; i < nummaps; i++)
-		if (chans[i].indio_dev)
-			put_device(&chans[i].indio_dev->dev);
+		iio_device_put(chans[i].indio_dev);
 	kfree(chans);
 error_ret:
 	mutex_unlock(&iio_map_list_lock);
@@ -225,7 +224,7 @@ void iio_st_channel_release_all(struct iio_channel *channels)
 	struct iio_channel *chan = &channels[0];
 
 	while (chan->indio_dev) {
-		put_device(&chan->indio_dev->dev);
+		iio_device_put(chan->indio_dev);
 		chan++;
 	}
 	kfree(channels);
-- 
1.7.10


  reply	other threads:[~2012-05-21  8:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21  8:21 [PATCH 1/2] iio: Add iio_device_get() Lars-Peter Clausen
2012-05-21  8:21 ` Lars-Peter Clausen [this message]
2012-05-25 16:29 ` Lars-Peter Clausen
2012-05-27 20:10   ` Jonathan Cameron
2012-05-29  7:41     ` Lars-Peter Clausen
2012-05-29  7:44       ` Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2012-06-04  8:50 Lars-Peter Clausen
2012-06-04  8:50 ` [PATCH 2/2] iio:inkern: Use iio_device_{get,put} Lars-Peter Clausen

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=1337588514-23938-2-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.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).