All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hartmut Knaack <knaack.h@gmx.de>
To: Daniel Baluta <daniel.baluta@intel.com>,
	Cristina Georgiana Opriceana <cristina.opriceana@gmail.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Roberta Dobrescu <roberta.dobrescu@gmail.com>,
	Irina Tirdea <irina.tirdea@intel.com>
Subject: Re: [PATCH v2 1/3] tools:iio:iio_event_monitor: check if event is fully read
Date: Sat, 13 Jun 2015 12:00:28 +0200	[thread overview]
Message-ID: <557BFF3C.1060101@gmx.de> (raw)
In-Reply-To: <CAEnQRZBd-1YdFSkG9=3Zhh8K07VWte+2aEDL4ucDOjwtvjR_0Q@mail.gmail.com>

Daniel Baluta schrieb am 13.06.2015 um 10:46:
> On Sat, Jun 13, 2015 at 11:36 AM, Hartmut Knaack <knaack.h@gmx.de> wrote:
>> Daniel Baluta schrieb am 10.06.2015 um 22:16:
>>> On Wed, Jun 10, 2015 at 10:51 PM, Hartmut Knaack <knaack.h@gmx.de> wrote:
>>>> Check that the read event is of the expected size.
>>>>
>>>> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
>>>> ---
>>>>  tools/iio/iio_event_monitor.c | 6 ++++++
>>>>  1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
>>>> index 016760e..2559fba 100644
>>>> --- a/tools/iio/iio_event_monitor.c
>>>> +++ b/tools/iio/iio_event_monitor.c
>>>> @@ -299,6 +299,12 @@ int main(int argc, char **argv)
>>>>                         }
>>>>                 }
>>>>
>>>> +               if (ret != sizeof(event)) {
>>>> +                       printf("Reading event failed!\n");
>>>> +                       ret = -EIO;
>>>> +                       break;
>>>> +               }
>>>> +
>>>
>>> For a test program this should be good enough, not sure if it does make sense
>>> to read until we get all data.
>>
>> Not sure, if I get your intention here. But as Jonathan suggested, something
>> went seriously wrong, if the sizes don't match here. Reading further, until
>> the desired size is reached could result in receiving the missing data, or
>> getting already partial data from the next event. I would leave it as is for
>> now and see if anyone ever gets this error. Then we can still dig deeper.
> 
> Ok.
> 
>>
>>>
>>> Also, we should print the error at stderr.
>>>
>>
>> I basically agree on this one, but since the majority of the error messages
>> in this file are currently just printed to stdout, I would prefer to take it
>> as is (for consistency) and have a follow-up patch to send all error messages
>> to stderr.
> 
> I've also noticed this. So I agree with you, a follow up patch would be better.
> 
> Cristina can do this, if you haven't already started working on it.
> 

Sounds good to me. I would have waited with such changes until this set got
applied, anyway.

> As a part of Outreachy Program [1] we are also investigating these user space
> tools plus the IIO dummy driver which hopefully at the end it will be moved
> out of staging.
> 

>From my experience so far, I would regard it a good idea to chop up the
workflow to get code out of staging:
  - get all the changes you have in mind applied
  - announce your intention to move it out in a reasonable time (2 weeks?), so
    people who mind will feel pressured to have a look at the code and fix
    issues in staging
  - move out smoothly ;-)

Also, making use of gits copy detection is a good idea to avoid huge patches,
which basically just copy/move a file without changes. Makes the reviewers
life much easier ;-)

Thanks,
Hartmut

> 
> Daniel.
> 
> [1] http://kernelnewbies.org/OutreachyIntro
> --
> 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
> 

  reply	other threads:[~2015-06-13 10:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 19:51 [PATCH v2 0/3] iio-tools out-of-staging cleanup Hartmut Knaack
2015-06-10 19:51 ` [PATCH v2 1/3] tools:iio:iio_event_monitor: check if event is fully read Hartmut Knaack
2015-06-10 20:16   ` Daniel Baluta
2015-06-13  8:36     ` Hartmut Knaack
2015-06-13  8:46       ` Daniel Baluta
2015-06-13 10:00         ` Hartmut Knaack [this message]
2015-06-13 11:11           ` Cristina Georgiana Opriceana
2015-06-21 15:21   ` Jonathan Cameron
2015-06-10 19:51 ` [PATCH v2 2/3] tools:iio: adjust coding style Hartmut Knaack
2015-06-13 17:53   ` Jonathan Cameron
2015-06-10 19:51 ` [PATCH v2 3/3] tools:iio: rename variables Hartmut Knaack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=557BFF3C.1060101@gmx.de \
    --to=knaack.h@gmx.de \
    --cc=cristina.opriceana@gmail.com \
    --cc=daniel.baluta@intel.com \
    --cc=irina.tirdea@intel.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=roberta.dobrescu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.