All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: Add iio_device_get()
@ 2012-05-21  8:21 Lars-Peter Clausen
  2012-05-21  8:21 ` [PATCH 2/2] iio:inkern: Use iio_device_{get,put} Lars-Peter Clausen
  2012-05-25 16:29 ` [PATCH 1/2] iio: Add iio_device_get() Lars-Peter Clausen
  0 siblings, 2 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2012-05-21  8:21 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Lars-Peter Clausen

This patch add the iio_device_get() function, which increases the reference
count of a iio device. The matching function to decrease the reference count -
iio_device_put() - already exists.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 include/linux/iio/iio.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 3a4f6a3..3238fa3 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -438,6 +438,17 @@ static inline struct iio_dev *dev_to_iio_dev(struct device *dev)
 	return container_of(dev, struct iio_dev, dev);
 }
 
+/**
+ * iio_device_get() - increment reference count for the device
+ * @indio_dev: IIO device structure
+ *
+ * Returns: The passed IIO device
+ **/
+static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev)
+{
+	return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
+}
+
 /* Can we make this smaller? */
 #define IIO_ALIGN L1_CACHE_BYTES
 /**
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 1/2] iio: Add iio_device_get()
@ 2012-06-04  8:50 Lars-Peter Clausen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2012-06-04  8:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Jonathan Cameron, devel, linux-iio, Lars-Peter Clausen

This patch add the iio_device_get() function, which increases the reference
count of a iio device. The matching function to decrease the reference count -
iio_device_put() - already exists.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
 include/linux/iio/iio.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 3a4f6a3..3238fa3 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -438,6 +438,17 @@ static inline struct iio_dev *dev_to_iio_dev(struct device *dev)
 	return container_of(dev, struct iio_dev, dev);
 }
 
+/**
+ * iio_device_get() - increment reference count for the device
+ * @indio_dev: IIO device structure
+ *
+ * Returns: The passed IIO device
+ **/
+static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev)
+{
+	return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
+}
+
 /* Can we make this smaller? */
 #define IIO_ALIGN L1_CACHE_BYTES
 /**
-- 
1.7.10

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

end of thread, other threads:[~2012-06-04  8:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21  8:21 [PATCH 1/2] iio: Add iio_device_get() Lars-Peter Clausen
2012-05-21  8:21 ` [PATCH 2/2] iio:inkern: Use iio_device_{get,put} Lars-Peter Clausen
2012-05-25 16:29 ` [PATCH 1/2] iio: Add iio_device_get() 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
2012-06-04  8:50 Lars-Peter Clausen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.