From 5aa57f0a655276f62683c0cc714cd6328d98e08a Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Mon, 4 Feb 2013 20:26:00 +0000 Subject: iio: Update iio_channel_get API to use consumer device pointer as argument For iio_channel_get to work with OF based configurations, it needs the consumer device pointer instead of the consumer device name as argument. Signed-off-by: Guenter Roeck Acked-by: Anton Vorontsov Acked-by: Chanwoo Choi Signed-off-by: Jonathan Cameron --- drivers/iio/inkern.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'drivers/iio') diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index c42aba6817e8..b289915b8469 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -93,7 +93,8 @@ static const struct iio_chan_spec } -struct iio_channel *iio_channel_get(const char *name, const char *channel_name) +static struct iio_channel *iio_channel_get_sys(const char *name, + const char *channel_name) { struct iio_map_internal *c_i = NULL, *c = NULL; struct iio_channel *channel; @@ -144,6 +145,14 @@ error_no_mem: iio_device_put(c->indio_dev); return ERR_PTR(err); } + +struct iio_channel *iio_channel_get(struct device *dev, + const char *channel_name) +{ + const char *name = dev ? dev_name(dev) : NULL; + + return iio_channel_get_sys(name, channel_name); +} EXPORT_SYMBOL_GPL(iio_channel_get); void iio_channel_release(struct iio_channel *channel) -- cgit 1.4.1