public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: Function iio_get_new_idr_val() return negative value if fails.
@ 2010-03-22 10:23 sonic zhang
  2010-03-22 12:27 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: sonic zhang @ 2010-03-22 10:23 UTC (permalink / raw)
  To: Linux Kernel, Jonathan Cameron, linux-iio


Function iio_get_new_idr_val() return negative value if fails.
So, only error when ret < 0 in iio_device_register_eventset().

Signed-off-by: Sonic Zhang <sonic.adi@gmail.com>
---
 drivers/staging/iio/industrialio-core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index b456dfc..dd9267c 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -536,6 +536,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *dev_info)
 	sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs);
 }
 
+/* This function return negative value if fails. */
 int iio_get_new_idr_val(struct idr *this_idr)
 {
 	int ret;
@@ -659,7 +660,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
 	for (i = 0; i < dev_info->num_interrupt_lines; i++) {
 		dev_info->event_interfaces[i].owner = dev_info->driver_module;
 		ret = iio_get_new_idr_val(&iio_event_idr);
-		if (ret)
+		if (ret < 0)
 			goto error_free_setup_ev_ints;
 		else
 			dev_info->event_interfaces[i].id = ret;
-- 
1.6.0




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

* Re: [PATCH] iio: Function iio_get_new_idr_val() return negative value if fails.
  2010-03-22 10:23 [PATCH] iio: Function iio_get_new_idr_val() return negative value if fails sonic zhang
@ 2010-03-22 12:27 ` Jonathan Cameron
  2010-04-23  0:13   ` patch staging-iio-function-iio_get_new_idr_val-return-negative-value-if-fails.patch added to gregkh-2.6 tree gregkh
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2010-03-22 12:27 UTC (permalink / raw)
  To: sonic zhang; +Cc: Linux Kernel, linux-iio, Greg KH

On 03/22/10 10:23, sonic zhang wrote:
> 
> Function iio_get_new_idr_val() return negative value if fails.
> So, only error when ret < 0 in iio_device_register_eventset().
> 
> Signed-off-by: Sonic Zhang <sonic.adi@gmail.com>
Youch.  I'm amazed that one hasn't caused more trouble!
Thanks Sonic.  I would normally say the comment is unnecessary 
but then the error suggests it is worth having it.
Actually, it would probably be better to put the docs
in the header rather than here.

Otherwise, (and given the nature of the fix I'm not
that bothered about the comment location).

Acked-by: Jonathan Cameron <jic23@cam.ac.uk>

cc'd Greg KH. (please do this with patches that are bug fixes
that don't need much discussion like this one) The drivers
are in his staging tree so that's the route for merging
this sort of fix. 

> ---
>  drivers/staging/iio/industrialio-core.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
> index b456dfc..dd9267c 100644
> --- a/drivers/staging/iio/industrialio-core.c
> +++ b/drivers/staging/iio/industrialio-core.c
> @@ -536,6 +536,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *dev_info)
>  	sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs);
>  }
>  
> +/* This function return negative value if fails. */
>  int iio_get_new_idr_val(struct idr *this_idr)
>  {
>  	int ret;
> @@ -659,7 +660,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
>  	for (i = 0; i < dev_info->num_interrupt_lines; i++) {
>  		dev_info->event_interfaces[i].owner = dev_info->driver_module;
>  		ret = iio_get_new_idr_val(&iio_event_idr);
> -		if (ret)
> +		if (ret < 0)
>  			goto error_free_setup_ev_ints;
>  		else
>  			dev_info->event_interfaces[i].id = ret;


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

* patch staging-iio-function-iio_get_new_idr_val-return-negative-value-if-fails.patch added to gregkh-2.6 tree
  2010-03-22 12:27 ` Jonathan Cameron
@ 2010-04-23  0:13   ` gregkh
  0 siblings, 0 replies; 3+ messages in thread
From: gregkh @ 2010-04-23  0:13 UTC (permalink / raw)
  To: sonic.adi, gregkh, greg, jic23, linux-iio, linux-kernel


This is a note to let you know that I've just added the patch titled

    Subject: staging: iio: Function iio_get_new_idr_val() return negative value if fails.

to my gregkh-2.6 tree.  Its filename is

    staging-iio-function-iio_get_new_idr_val-return-negative-value-if-fails.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From jic23@cam.ac.uk  Thu Apr 22 16:40:17 2010
From: Sonic Zhang <sonic.adi@gmail.com>
Date: Mon, 22 Mar 2010 12:27:05 +0000
Subject: staging: iio: Function iio_get_new_idr_val() return negative value if fails.
To: sonic zhang <sonic.adi@gmail.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,  linux-iio <linux-iio@vger.kernel.org>, Greg KH <greg@kroah.com>
Message-ID: <4BA76219.4030606@cam.ac.uk>


Function iio_get_new_idr_val() return negative value if fails.
So, only error when ret < 0 in iio_device_register_eventset().

Signed-off-by: Sonic Zhang <sonic.adi@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/staging/iio/industrialio-core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -537,6 +537,7 @@ static void iio_device_unregister_sysfs(
 	sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs);
 }
 
+/* This function return negative value if fails. */
 int iio_get_new_idr_val(struct idr *this_idr)
 {
 	int ret;
@@ -660,7 +661,7 @@ static int iio_device_register_eventset(
 	for (i = 0; i < dev_info->num_interrupt_lines; i++) {
 		dev_info->event_interfaces[i].owner = dev_info->driver_module;
 		ret = iio_get_new_idr_val(&iio_event_idr);
-		if (ret)
+		if (ret < 0)
 			goto error_free_setup_ev_ints;
 		else
 			dev_info->event_interfaces[i].id = ret;


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

end of thread, other threads:[~2010-04-23  0:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-22 10:23 [PATCH] iio: Function iio_get_new_idr_val() return negative value if fails sonic zhang
2010-03-22 12:27 ` Jonathan Cameron
2010-04-23  0:13   ` patch staging-iio-function-iio_get_new_idr_val-return-negative-value-if-fails.patch added to gregkh-2.6 tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox