FreeBSD/sys/dev/usb/usb_process.c
/*------------------------------------------------------------------------*
 *	usb_proc_create
 *
 * This function will create a process using the given "prio" that can
 * execute callbacks. The mutex pointed to by "p_mtx" will be applied
 * before calling the callbacks and released after that the callback
 * has returned. The structure pointed to by "up" is assumed to be
 * zeroed before this function is called.
 *
 * Return values:
 *    0: success
 * Else: failure
 *------------------------------------------------------------------------*/
usb_proc_create
This function will create a process using the given "prio" that can
execute callbacks. The mutex pointed to by "p_mtx" will be applied
before calling the callbacks and released after that the callback
has returned. The structure pointed to by "up" is assumed to be
zeroed before this function is called.

Return values:
0: success
Else: failure
usb_proc_create This function will create a process using the given " prio " that can execute callbacks . The mutex pointed to by " p_mtx " will be applied before calling the callbacks and released after that the callback has returned . The structure pointed to by " up " is assumed to be zeroed before this function is called . Return values : 0 : success Else : failure
int
usb_proc_create(struct usb_process *up, struct mtx *p_mtx,
    const char *pmesg, uint8_t prio)
{
	up->up_mtx = p_mtx;
	up->up_prio = prio;
	TAILQ_INIT(&up->up_qhead);
	cv_init(&up->up_cv, "-");
	cv_init(&up->up_drain, "usbdrain");
	if (USB_THREAD_CREATE(&usb_process, up,
	    &up->up_ptr, "%s", pmesg)) {
		DPRINTFN(0, "Unable to create USB process.");
		up->up_ptr = NULL;
		goto error;
	}
#if (__FreeBSD_version >= 800000)
	usb_pcount++;
#endif
	return (0);
error:
	usb_proc_free(up);
	return (ENOMEM);
}
int usb_proc_create ( struct usb_process * up , struct mtx * p_mtx , const char * pmesg , uint8_t prio ) { up -> up_mtx = p_mtx ; up -> up_prio = prio ; TAILQ_INIT ( & up -> up_qhead ) ; cv_init ( & up -> up_cv , " " ) ; cv_init ( & up -> up_drain , " " ) ; if ( USB_THREAD_CREATE ( & usb_process , up , & up -> up_ptr , " " , pmesg ) ) { DPRINTFN ( 0 , " " ) ; up -> up_ptr = NULL ; goto error ; } #if ( __FreeBSD_version >= 800000 ) usb_pcount ++ ; #endif return ( 0 ) ; error : usb_proc_free ( up ) ; return ( ENOMEM ) ; }
usb_proc_create
 This function will create a process using the given "prio" that can
 execute callbacks.
usb_proc_create This function will create a process using the given " prio " that can execute callbacks .