From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com,
clemens@ladisch.de
Subject: Re: [PATCH v8 05/12] media: Entity use count
Date: Tue, 8 Feb 2011 13:57:33 +0100 [thread overview]
Message-ID: <201102081357.34145.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <201102041419.19916.hverkuil@xs4all.nl>
Hi Hans,
On Friday 04 February 2011 14:19:19 Hans Verkuil wrote:
> On Friday, February 04, 2011 13:34:02 Sakari Ailus wrote:
> > Hi,
> >
> > And many thanks for the comments!
> >
> > Hans Verkuil wrote:
> > ...
> >
> > >> diff --git a/include/media/media-entity.h
> > >> b/include/media/media-entity.h index b82f824..114541a 100644
> > >> --- a/include/media/media-entity.h
> > >> +++ b/include/media/media-entity.h
> > >> @@ -81,6 +81,8 @@ struct media_entity {
> > >>
> > >> struct media_pad *pads; /* Pads array (num_pads elements) */
> > >> struct media_link *links; /* Links array (max_links elements)*/
> > >>
> > >> + int use_count; /* Use count for the entity. */
> > >
> > > Isn't unsigned better?
> >
> > Could be. The result, though, will be slightly more difficult checking
> > for bad use count --- which always is a driver bug.
> >
> > me->use_count += change;
> > WARN_ON(me->use_count < 0);
> >
> > we must do something like this:
> >
> > if (change < 0)
> >
> > WARN_ON(me->use_count < (unsigned)-change);
> >
> > me->use_count += change;
> >
> > I'd perhaps also go with unsigned int; the choice for signed was made
> > mainly since the above check and with signed int the check was more
> > trivial.
>
> I saw this WARN_ON as well. I think there is a good reason for that
> WARN_ON, but I think a comment in the header explaining why it is an int
> will be useful. If I trip over it, then others will as well :-)
I'll add a comment. Thanks.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2011-02-08 12:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-27 12:30 [PATCH v8 00/12] Media controller (core and V4L2) Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 01/12] media: Media device node support Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 02/12] media: Media device Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 03/12] media: Entities, pads and links Laurent Pinchart
2011-01-28 10:53 ` Sakari Ailus
2011-02-08 13:46 ` Laurent Pinchart
2011-02-04 10:20 ` Hans Verkuil
2011-02-08 13:35 ` Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 04/12] media: Entity graph traversal Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 05/12] media: Entity use count Laurent Pinchart
2011-02-04 10:22 ` Hans Verkuil
2011-02-04 12:34 ` Sakari Ailus
2011-02-04 13:19 ` Hans Verkuil
2011-02-08 12:57 ` Laurent Pinchart [this message]
2011-01-27 12:30 ` [PATCH v8 06/12] media: Media device information query Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 07/12] media: Entities, pads and links enumeration Laurent Pinchart
2011-02-13 21:59 ` Sylwester Nawrocki
2011-02-14 12:11 ` Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 08/12] media: Links setup Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 09/12] media: Pipelines and media streams Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 10/12] v4l: Add a media_device pointer to the v4l2_device structure Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 11/12] v4l: Make video_device inherit from media_entity Laurent Pinchart
2011-01-27 12:30 ` [PATCH v8 12/12] v4l: Make v4l2_subdev " Laurent Pinchart
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=201102081357.34145.laurent.pinchart@ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=clemens@ladisch.de \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@maxwell.research.nokia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®