/* http://www.spinics.net/lists/linux-usb/msg35888.html */ int RTMP_Usb_AutoPM_Get_Interface(void *pUsb_Devsrc, void *intfsrc) { int pm_usage_cnt; struct usb_interface *intf = (struct usb_interface *)intfsrc; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) pm_usage_cnt = (int)atomic_read(&intf->pm_usage_cnt); #else pm_usage_cnt = intf->pm_usage_cnt; #endif if (pm_usage_cnt == 0) { int res = rausb_autopm_get_interface(intf); if (res) { DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel autopm_resume fail ------\n")); return (-1); } } return 2; }
int RTMP_Usb_AutoPM_Get_Interface ( IN VOID *pUsb_Devsrc, IN VOID *intfsrc) { INT pm_usage_cnt; struct usb_device *pUsb_Dev =(struct usb_device *)pUsb_Devsrc; struct usb_interface *intf =(struct usb_interface *)intfsrc; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) pm_usage_cnt = (INT)atomic_read(&intf->pm_usage_cnt); #else pm_usage_cnt = intf->pm_usage_cnt; #endif /* if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_CPU_SUSPEND)) */ { if(pm_usage_cnt == 0) { int res=1; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) if(pUsb_Dev->autosuspend_disabled ==0) #else if(pUsb_Dev->auto_pm ==1) #endif { res = rausb_autopm_get_interface(intf); /* when system power level from auto to on, auto_pm is 0 and the function radioon will set fRTMP_ADAPTER_SUSPEND so we must clear fkag here; */ /* RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_SUSPEND); */ if (res) { /* DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel autopm_resume fail ------\n")); */ /* RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_SUSPEND); */ return (-1); } } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) else { /* DBGPRINT(RT_DEBUG_TRACE, ("AsicSwitchChannel: fRTMP_ADAPTER_SUSPEND\n")); */ /* RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_SUSPEND); */ return (-1); } #endif return 1; } return 2; } /* else { DBGPRINT(RT_DEBUG_TRACE, ("AsicSwitchChannel: fRTMP_ADAPTER_CPU_SUSPEND\n")); return; } */ }