On Wed, Oct 07, 2009 at 11:32:39PM +0530, aditya uttam wrote: > Dear all, > > I am writing driver for my custom usb device. Great, what kind of device? > In my code the function usb_submit_urb() was returning with error > number -22 (-EINVAL). > when I looked into the usb_submit_urb() function I found the statement, > if (!urb || urb->hcpriv || !urb->complete) > return -EINVAL; > > I verified all the above parameters are fine before calling usb_submit_urb(). > Please find the code snippet I am using. > > if (!current_urb || current_urb->hcpriv || !current_urb->complete) > printk(" ***************** URB condition Failed **************\n"); > else > printk("***************** URB condition Success**************\n"); > > > /* submit the URB */ > spin_lock_irqsave(¤t_urb_context->us->pusb_dev_spin_lock, flags); > status = usb_submit_urb(current_urb, GFP_ATOMIC); > spin_unlock_irqrestore(¤t_urb_context->us->pusb_dev_spin_lock, > flags); > > in this code usb_submit_urb() is returning -EINVAL and the print > statement is " ***************** URB condition Success************** > " > all the above code is being called from completion routine. Why lock around usb_submit_urb? And what does the code look like for the whole driver? Also, if you enable CONFIG_USB_DEBUG, do you get better messages? 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