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 2/2] iio:inkern: Use iio_device_{get,put}
  2012-05-21  8:21 [PATCH 1/2] iio: Add iio_device_get() Lars-Peter Clausen
@ 2012-05-21  8:21 ` Lars-Peter Clausen
  2012-05-25 16:29 ` [PATCH 1/2] iio: Add iio_device_get() Lars-Peter Clausen
  1 sibling, 0 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

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


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

* Re: [PATCH 1/2] iio: Add iio_device_get()
  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 ` Lars-Peter Clausen
  2012-05-27 20:10   ` Jonathan Cameron
  1 sibling, 1 reply; 7+ messages in thread
From: Lars-Peter Clausen @ 2012-05-25 16:29 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio

On 05/21/2012 10:21 AM, Lars-Peter Clausen wrote:
> 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>

Hi Jonathan,

Are you OK with these two patches?

Thanks,
- Lars

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

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

* Re: [PATCH 1/2] iio: Add iio_device_get()
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2012-05-27 20:10 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio

On 05/25/2012 05:29 PM, Lars-Peter Clausen wrote:
> On 05/21/2012 10:21 AM, Lars-Peter Clausen wrote:
>> 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>
> 
> Hi Jonathan,
> 
> Are you OK with these two patches?
Sorry, was a somewhat mad week..

Acked-by: Jonathan Cameron <jic23@kernel.org>
for both of them.
> 
> Thanks,
> - Lars
> 
>> ---
>>  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
>>  /**
> 

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

* Re: [PATCH 1/2] iio: Add iio_device_get()
  2012-05-27 20:10   ` Jonathan Cameron
@ 2012-05-29  7:41     ` Lars-Peter Clausen
  2012-05-29  7:44       ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Lars-Peter Clausen @ 2012-05-29  7:41 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Jonathan Cameron, linux-iio

On 05/27/2012 10:10 PM, Jonathan Cameron wrote:
> On 05/25/2012 05:29 PM, Lars-Peter Clausen wrote:
>> On 05/21/2012 10:21 AM, Lars-Peter Clausen wrote:
>>> 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>
>>
>> Hi Jonathan,
>>
>> Are you OK with these two patches?
> Sorry, was a somewhat mad week..
> 
> Acked-by: Jonathan Cameron <jic23@kernel.org>
> for both of them.

Thanks. Btw. these touch only out-of-staging IIO code. Now that the
out-of-staging code is in mainline, what's the plan for the patch flow? Are
you going to collect the patches and send them to Linus or should they still
go through the staging tree?

- Lars

>>
>> Thanks,
>> - Lars
>>
>>> ---
>>>  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
>>>  /**
>>
> 

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

* Re: [PATCH 1/2] iio: Add iio_device_get()
  2012-05-29  7:41     ` Lars-Peter Clausen
@ 2012-05-29  7:44       ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2012-05-29  7:44 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio

On 5/29/2012 8:41 AM, Lars-Peter Clausen wrote:
> On 05/27/2012 10:10 PM, Jonathan Cameron wrote:
>> On 05/25/2012 05:29 PM, Lars-Peter Clausen wrote:
>>> On 05/21/2012 10:21 AM, Lars-Peter Clausen wrote:
>>>> 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>
>>>
>>> Hi Jonathan,
>>>
>>> Are you OK with these two patches?
>> Sorry, was a somewhat mad week..
>>
>> Acked-by: Jonathan Cameron<jic23@kernel.org>
>> for both of them.
>
> Thanks. Btw. these touch only out-of-staging IIO code. Now that the
> out-of-staging code is in mainline, what's the plan for the patch flow? Are
> you going to collect the patches and send them to Linus or should they still
> go through the staging tree?
Greg has kindly agreed to continue handling patches during this period 
(I'll start building up to take over in the longer run).
I'm not actually sure how he will want to split stuff as obviously a lot
of patches, not including this one, will touch both the stuff in staging 
and the stuff that isn't...

For now send patches to Greg and see what he does with them I guess!
Make it clear in the cover letter what they effect though.

Jonathan

>
> - Lars
>
>>>
>>> Thanks,
>>> - Lars
>>>
>>>> ---
>>>>   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
>>>>   /**
>>>
>>
>


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

* [PATCH 2/2] iio:inkern: Use iio_device_{get,put}
  2012-06-04  8:50 Lars-Peter Clausen
@ 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

Use iio_device_get and iio_device_put instead of open-coding it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
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..d4760bd 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[mapind].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

^ 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
2012-06-04  8:50 ` [PATCH 2/2] iio:inkern: Use iio_device_{get,put} 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.