Re: [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.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 05, 2012 at 12:50:26PM +0800, Harvey Yang wrote:
> From: harvey.yang <harvey.huawei.yang@xxxxxxxxx>
> 
> 
> Signed-off-by: harvey.yang <harvey.huawei.yang@xxxxxxxxx>
> ---
>  drivers/staging/usbip/usbip_event.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
> index d332a34..668f8e0 100644
> --- a/drivers/staging/usbip/usbip_event.c
> +++ b/drivers/staging/usbip/usbip_event.c
> @@ -116,10 +116,8 @@ int usbip_event_happened(struct usbip_device *ud)
>  {
>  	int happened = 0;
>  
> -	spin_lock(&ud->lock);
>  	if (ud->event != 0)
>  		happened = 1;
> -	spin_unlock(&ud->lock);
>  
>  	return happened;

Are you sure that the real fix for this isn't just making 'happened' a
static variable?  That would make more sense here.  Well maybe, the code
seems pretty dumb, it's hard to tell what this is supposed to be doing,
any ideas?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux