lkml.org 
[lkml]   [2012]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/1] staging: usbip: remove an unnecessary lock in usbip_event_happened. The variable "happened" is local. So I think there is no need to lock here.
From
I think no need to make 'happened' static as we just check 'ud->event'
feild. Maybe making this function inline would make more sense.

inline int usbip_event_happened(struct usbip_device *ud)
{
return ud->event ? 1 : 0;
}

Thanks
Harvey


On Mon, Nov 5, 2012 at 1:34 PM, Prashant Shah <kerneldev100@gmail.com> wrote:
> Hi,
>
>> int happened = 0;
>>
>> - spin_lock(&ud->lock);
>> if (ud->event != 0)
>> happened = 1;
>> - spin_unlock(&ud->lock);
>>
>> return happened;
>
> I am guessing locking was intended to protect ud->event along with
> happened so that (checking the value of ud->event and setting value of
> happened) was atomic.
>
> return ud->event != 0 ? 1 : 0;
>
> Regards.


\
 
 \ /
  Last update: 2012-11-05 08:23    [W:0.059 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site