VirtualBox

Ignore:
Timestamp:
Feb 24, 2022 4:14:06 PM (3 years ago)
Author:
vboxsync
Message:

Devices/USB/DrvVUSBRootHub: Get rid of device list which is superseeded by the array of devices, bugref:10196

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp

    r93915 r93934  
    918918static DECLCALLBACK(void) vusbRhCancelAllUrbs(PVUSBIROOTHUBCONNECTOR pInterface)
    919919{
    920     PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
    921 
    922     RTCritSectEnter(&pRh->CritSectDevices);
    923     PVUSBDEV pDev = pRh->pDevices;
    924     while (pDev)
    925     {
    926         vusbDevIoThreadExecSync(pDev, (PFNRT)vusbRhCancelAllUrbsWorker, 1, pDev);
    927         pDev = pDev->pNext;
    928     }
    929     RTCritSectLeave(&pRh->CritSectDevices);
     920    PVUSBROOTHUB pThis = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
     921
     922    RTCritSectEnter(&pThis->CritSectDevices);
     923    for (unsigned i = 0; i < RT_ELEMENTS(pThis->apDevByPort); i++)
     924    {
     925        PVUSBDEV pDev = pThis->apDevByPort[i];
     926        if (pDev)
     927            vusbDevIoThreadExecSync(pDev, (PFNRT)vusbRhCancelAllUrbsWorker, 1, pDev);
     928    }
     929    RTCritSectLeave(&pThis->CritSectDevices);
    930930}
    931931
     
    14191419    {
    14201420        RTCritSectEnter(&pRh->CritSectDevices);
    1421         pDev->pNext = pRh->pDevices;
    1422         pRh->pDevices = pDev;
    1423 
    14241421        Assert(!pRh->apDevByPort[iPort]);
    14251422        pRh->apDevByPort[iPort] = pDev;
     
    14561453     */
    14571454    RTCritSectEnter(&pRh->CritSectDevices);
    1458     if (pRh->pDevices != pDev)
    1459     {
    1460         PVUSBDEV pPrev = pRh->pDevices;
    1461         while (pPrev && pPrev->pNext != pDev)
    1462             pPrev = pPrev->pNext;
    1463         Assert(pPrev);
    1464         pPrev->pNext = pDev->pNext;
    1465     }
    1466     else
    1467         pRh->pDevices = pDev->pNext;
    1468     pDev->pNext = NULL;
    1469 
     1455    Assert(pRh->apDevByPort[pDev->i16Port] == pDev);
    14701456    pRh->apDevByPort[pDev->i16Port] = NULL;
    14711457    RTCritSectLeave(&pRh->CritSectDevices);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette