1:
void Usbh_Api_DriverUnRegister(
struct class_driver_reginfo * driver_info)
2: {
3: uhs_status_t retval =
UDI_OK;
4:
struct class_driver_reginfo * tmp_reginfo = NULL;
5:
6:
7:
if( Usbh_susres_get_state() != USBH_SUSRES_STS_IDLE ){
8: uhs_debug_print (DBG_ERR, ("ERROR : Don't Call Current State!!"));
9: CORE_REPORT_ERROR(
USBC_ILLEGAL_ERROR );
10:
return;
11: }
12:
13:
if ( driver_info == NULL ) {
14: CORE_REPORT_ERROR(
USBC_INVALID_PARAMETER);
15:
return;
16: }
17:
18: 19: retval = kernel_acquisition_semaphore(
20: &(g_apiwrap_info.drvinfo_semid),
21: USB_HOST_SEMTIMEOUT,
22: in_interrupt());
23:
if ( retval !=
UDI_OK ) {
24:
25: 26:
27: CORE_REPORT_ERROR(
USBC_ILLEGAL_ERROR );
28:
29:
return; 30: }
31:
32:
if ( g_apiwrap_info.apiwrap_stat != USBWRAP_STAT_USBD_INITCOMP ) {
33:
36:
37: tmp_reginfo = (
struct class_driver_reginfo *)lists_get_FirstElement( &g_apiwrap_info.tmp_drvlist );
38:
while ( lists_get_RoopIsEnd(tmp_reginfo) == FALSE ) {
39:
if ( tmp_reginfo == driver_info ) {
40:
41: lists_delet_FromList( &g_apiwrap_info.tmp_drvlist, (
void*)tmp_reginfo );
42:
break;
43: }
44:
45:
46: tmp_reginfo = (
struct class_driver_reginfo *)lists_get_NextElement(&g_apiwrap_info.tmp_drvlist, tmp_reginfo);
47: }
48:
49: }
else {
50:
53: retval = Usbh_DriverUnRegister( driver_info );
54:
if ( retval !=
UDI_OK ) {
55: CORE_REPORT_ERROR(
USBC_ILLEGAL_ERROR );
56: }
57: }
58:
59:
60: retval = kernel_release_semaphore(&(g_apiwrap_info.drvinfo_semid), in_interrupt());
61:
if( retval !=
UDI_OK ) {
62: CORE_REPORT_WARNING(
USBC_ILLEGAL_ERROR);
63: }
64:
65:
return;
66: }