Om wrote:
Hi,
using linux 2.4.27.
In arch/drivers/usb.c,usb_internal_control_msg() create one control urb
with completion function as usb_api_blocking_completion() and context
to be 0.
From the include/linux/usb.h,
struct urb
{
spinlock_t lock; // lock for the URB
<snip>
void *context; // context for completion routine
usb_complete_t complete; // pointer to completion routine
//
}
I assume that upon completion, funtion pointer complete will be called
with parameter context.
i.e, usb_api_blocking_completion(0) will be called.
but,
usb.c : usb_api_blocking_completion(struct urb *urb) {
struct usb_api_data *awd = (struct usb_api_data *)urb->context;
awd->done = 1;
wmb();
wake_up(&awd->wqh);
}
If the value of urb is NULL, this function will crash. But this does not
happen.
sorry for the foolish question. The context is reassigned to
struct usb_api_data awd in the usb_start_wait_urb().
bye,
om.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/