From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
To: "Aguirre, Sergio" <saaguirre@ti.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"hverkuil@xs4all.nl" <hverkuil@xs4all.nl>,
"laurent.pinchart@ideasonboard.com"
<laurent.pinchart@ideasonboard.com>,
"iivanov@mm-sol.com" <iivanov@mm-sol.com>,
"gururaj.nagendra@intel.com" <gururaj.nagendra@intel.com>,
"david.cohen@nokia.com" <david.cohen@nokia.com>
Subject: Re: [PATCH v5 4/6] V4L: Events: Add backend
Date: Sun, 21 Feb 2010 22:25:42 +0200 [thread overview]
Message-ID: <4B8196C6.80209@maxwell.research.nokia.com> (raw)
In-Reply-To: <A24693684029E5489D1D202277BE8944536915B9@dlee02.ent.ti.com>
Aguirre, Sergio wrote:
> Heippa!
Hi, Sergio!
Your lines seem to be over 80 characters long. :I
...
>> +int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event)
>> +{
>> + struct v4l2_events *events = fh->events;
>> + struct v4l2_kevent *kev;
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&fh->vdev->fh_lock, flags);
>> +
>> + if (list_empty(&events->available)) {
>> + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
>> + return -ENOENT;
>> + }
>> +
>> + WARN_ON(events->navailable == 0);
>
> I don't think the above warning will ever happen. Looks a bit over protective to me.
If it does it's a bug somewhere.
> Whenever you update your "events->available" list, you're holding the fh_lock spinlock, so there's no chance that the list of events would contan a different number of elents to what the navailable var is holding. Is it?
>
> Please correct me if I'm missing something...
At the moment that is true as far as I see it. But if it's changed in
future chances are something goes wrong. It's a simple check but might
save some headaches.
> Or if you insist in checking, you could just have done this instead:
>
> if (list_empty(&events->available) || (events->navailable == 0)) {
> spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
> return -ENOENT;
> }
>
> As it doesn't make sense to proceed if navailable is zero, I believe...
It'd be a bug in the code so it must be WARN_ON().
I think the question is whether the check should be left there or removed.
--
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com
next prev parent reply other threads:[~2010-02-21 20:26 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-19 19:21 [PATCH v5 0/6] V4L2 file handles and event interface Sakari Ailus
2010-02-19 19:21 ` [PATCH v5 1/6] V4L: File handles Sakari Ailus
2010-02-19 22:29 ` Aguirre, Sergio
2010-02-19 22:34 ` Laurent Pinchart
2010-02-19 22:54 ` Aguirre, Sergio
2010-02-21 20:22 ` Sakari Ailus
2010-02-22 17:27 ` Aguirre, Sergio
2010-02-22 17:36 ` Sakari Ailus
2010-02-19 19:21 ` [PATCH v5 2/6] V4L: File handles: Add documentation Sakari Ailus
2010-02-20 9:59 ` Hans Verkuil
2010-02-19 19:21 ` [PATCH v5 3/6] V4L: Events: Add new ioctls for events Sakari Ailus
2010-02-19 19:21 ` [PATCH v5 4/6] V4L: Events: Add backend Sakari Ailus
2010-02-19 22:46 ` Aguirre, Sergio
2010-02-21 20:25 ` Sakari Ailus [this message]
2010-02-20 9:45 ` Hans Verkuil
2010-02-21 20:57 ` Sakari Ailus
2010-02-22 7:56 ` Hans Verkuil
2010-02-19 19:21 ` [PATCH v5 5/6] V4L: Events: Support event handling in do_ioctl Sakari Ailus
2010-02-20 9:56 ` Hans Verkuil
2010-02-21 22:31 ` Sakari Ailus
2010-02-21 22:54 ` Laurent Pinchart
2010-02-22 7:37 ` Sakari Ailus
2010-02-22 7:53 ` Hans Verkuil
2010-02-22 9:10 ` Laurent Pinchart
2010-02-22 9:21 ` Hans Verkuil
2010-02-22 9:41 ` Sakari Ailus
2010-02-19 19:22 ` [PATCH v5 6/6] V4L: Events: Add documentation Sakari Ailus
2010-02-20 10:15 ` Hans Verkuil
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=4B8196C6.80209@maxwell.research.nokia.com \
--to=sakari.ailus@maxwell.research.nokia.com \
--cc=david.cohen@nokia.com \
--cc=gururaj.nagendra@intel.com \
--cc=hverkuil@xs4all.nl \
--cc=iivanov@mm-sol.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=saaguirre@ti.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.