|
@@ -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
|
|
|
/**
|