lkml.org 
[lkml]   [2011]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 05/12] media: Entity use count
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


\
 
 \ /
  Last update: 2011-02-04 13:37    [W:0.046 / U:3.148 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site