diff mbox

tools: iio: iio_generic_buffer: allow infinite looping

Message ID 20180607083110.gjfmdfuzw2my6sl5@kili.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter June 7, 2018, 8:31 a.m. UTC
I think the num_loops variable was intended to be signed so that we
could set it to -1 and it would loop forever.  Right now it just loops
for a very long time.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Martin Kelly June 7, 2018, 4:31 p.m. UTC | #1
On 06/07/2018 01:31 AM, Dan Carpenter wrote:
> I think the num_loops variable was intended to be signed so that we
> could set it to -1 and it would loop forever.  Right now it just loops
> for a very long time.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c
> index 3040830d7797..84545666a09c 100644
> --- a/tools/iio/iio_generic_buffer.c
> +++ b/tools/iio/iio_generic_buffer.c
> @@ -330,7 +330,7 @@ static const struct option longopts[] = {
>   
>   int main(int argc, char **argv)
>   {
> -	unsigned long long num_loops = 2;
> +	long long num_loops = 2;
>   	unsigned long timedelay = 1000000;
>   	unsigned long buf_len = 128;
>   

Good catch, thanks.

Reviewed-by: Martin Kelly <mkelly@xevo.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jonathan Cameron June 10, 2018, 1:44 p.m. UTC | #2
On Thu, 7 Jun 2018 09:31:06 -0700
Martin Kelly <mkelly@xevo.com> wrote:

> On 06/07/2018 01:31 AM, Dan Carpenter wrote:
> > I think the num_loops variable was intended to be signed so that we
> > could set it to -1 and it would loop forever.  Right now it just loops
> > for a very long time.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c
> > index 3040830d7797..84545666a09c 100644
> > --- a/tools/iio/iio_generic_buffer.c
> > +++ b/tools/iio/iio_generic_buffer.c
> > @@ -330,7 +330,7 @@ static const struct option longopts[] = {
> >   
> >   int main(int argc, char **argv)
> >   {
> > -	unsigned long long num_loops = 2;
> > +	long long num_loops = 2;
> >   	unsigned long timedelay = 1000000;
> >   	unsigned long buf_len = 128;
> >     
> 
> Good catch, thanks.
> 
> Reviewed-by: Martin Kelly <mkelly@xevo.com>
Applied.  I'm not going to rush this one as that is a very
long time so we are unlikely to get lots of problems with it ;)
Will wait for the next cycle.

Thanks,

Jonathan

> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c
index 3040830d7797..84545666a09c 100644
--- a/tools/iio/iio_generic_buffer.c
+++ b/tools/iio/iio_generic_buffer.c
@@ -330,7 +330,7 @@  static const struct option longopts[] = {
 
 int main(int argc, char **argv)
 {
-	unsigned long long num_loops = 2;
+	long long num_loops = 2;
 	unsigned long timedelay = 1000000;
 	unsigned long buf_len = 128;