3712 if (idx == KErrNotFound) |
3712 if (idx == KErrNotFound) |
3713 { |
3713 { |
3714 __KTRACE_OPT(KPANIC, Kern::Printf(" Error: interface not found in array")); |
3714 __KTRACE_OPT(KPANIC, Kern::Printf(" Error: interface not found in array")); |
3715 return; |
3715 return; |
3716 } |
3716 } |
|
3717 //Add this mutex to protect the interface set data structure |
|
3718 if (NKern::CurrentContext() == EThread) |
|
3719 { |
|
3720 NKern::FMWait(&iMutex); |
|
3721 } |
|
3722 |
3717 iConfigs[0]->iInterfaceSets.Remove(idx); |
3723 iConfigs[0]->iInterfaceSets.Remove(idx); |
|
3724 if (NKern::CurrentContext() == EThread) |
|
3725 { |
|
3726 NKern::FMSignal(&iMutex); |
|
3727 } |
3718 delete ifcset_ptr; |
3728 delete ifcset_ptr; |
3719 } |
3729 } |
3720 |
3730 |
3721 |
3731 |
3722 void DUsbClientController::DeleteInterface(TInt aIfcSet, TInt aIfc) |
3732 void DUsbClientController::DeleteInterface(TInt aIfcSet, TInt aIfc) |
3731 if (ifcset_ptr->iInterfaces.Count() <= aIfc) |
3741 if (ifcset_ptr->iInterfaces.Count() <= aIfc) |
3732 { |
3742 { |
3733 __KTRACE_OPT(KPANIC, Kern::Printf(" Error: invalid interface setting: %d", aIfc)); |
3743 __KTRACE_OPT(KPANIC, Kern::Printf(" Error: invalid interface setting: %d", aIfc)); |
3734 return; |
3744 return; |
3735 } |
3745 } |
|
3746 //Add this mutex to protect the interface set data structure |
|
3747 if (NKern::CurrentContext() == EThread) |
|
3748 { |
|
3749 NKern::FMWait(&iMutex); |
|
3750 } |
3736 TUsbcInterface* const ifc_ptr = ifcset_ptr->iInterfaces[aIfc]; |
3751 TUsbcInterface* const ifc_ptr = ifcset_ptr->iInterfaces[aIfc]; |
3737 // Always first remove, then delete (see ~TUsbcLogicalEndpoint() for the reason why) |
3752 // Always first remove, then delete (see ~TUsbcLogicalEndpoint() for the reason why) |
3738 ifcset_ptr->iInterfaces.Remove(aIfc); |
3753 ifcset_ptr->iInterfaces.Remove(aIfc); |
3739 delete ifc_ptr; |
3754 |
3740 if (aIfc == ifcset_ptr->iCurrentInterface) |
3755 if (aIfc == ifcset_ptr->iCurrentInterface) |
3741 { |
3756 { |
3742 __KTRACE_OPT(KUSB, Kern::Printf(" > Warning: deleting current interface setting")); |
3757 __KTRACE_OPT(KUSB, Kern::Printf(" > Warning: deleting current interface setting")); |
3743 ifcset_ptr->iCurrentInterface = 0; |
3758 ifcset_ptr->iCurrentInterface = 0; |
3744 } |
3759 } |
|
3760 if (NKern::CurrentContext() == EThread) |
|
3761 { |
|
3762 NKern::FMSignal(&iMutex); |
|
3763 } |
|
3764 delete ifc_ptr; |
3745 } |
3765 } |
3746 |
3766 |
3747 |
3767 |
3748 void DUsbClientController::CancelTransferRequests(TInt aRealEndpoint) |
3768 void DUsbClientController::CancelTransferRequests(TInt aRealEndpoint) |
3749 { |
3769 { |