alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.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: Fri, 04 Feb 2011 14:34:02 +0200	[thread overview]
Message-ID: <4D4BF23A.1050800@maxwell.research.nokia.com> (raw)
In-Reply-To: <201102041122.03886.hverkuil@xs4all.nl>

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.

Regards,

-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

  reply	other threads:[~2011-02-04 12:34 UTC|newest]

Thread overview: 24+ 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 [this message]
2011-02-04 13:19       ` Hans Verkuil
2011-02-08 12:57         ` Laurent Pinchart
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
2011-01-28  2:38 ` [PATCH v8 00/12] Media controller (core and V4L2) Raymond Yau

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=4D4BF23A.1050800@maxwell.research.nokia.com \
    --to=sakari.ailus@maxwell.research.nokia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=clemens@ladisch.de \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).