Changeset 59357 in vbox for trunk/src/VBox/Devices/Audio/DevIchHda.cpp
- Timestamp:
- Jan 15, 2016 11:14:12 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchHda.cpp
r59348 r59357 658 658 /** LUN to which this driver has been assigned. */ 659 659 uint8_t uLUN; 660 /** Whether this driver is in an attached state or not. */ 661 bool fAttached; 660 662 /** Pointer to attached driver base interface. */ 661 663 R3PTRTYPE(PPDMIBASE) pDrvBase; … … 4306 4308 } 4307 4309 4310 4308 4311 /** 4309 * Attach command .4312 * Attach command, internal version. 4310 4313 * 4311 4314 * This is called to let the device attach to a driver for a specified LUN 4312 4315 * during runtime. This is not called during VM construction, the device 4313 * constructor ha veto attach to all the available drivers.4316 * constructor has to attach to all the available drivers. 4314 4317 * 4315 4318 * @returns VBox status code. 4316 4319 * @param pDevIns The device instance. 4320 * @param pDrv Driver to (re-)use for (re-)attaching to. 4321 * If NULL is specified, a new driver will be created and appended 4322 * to the driver list. 4317 4323 * @param uLUN The logical unit which is being detached. 4318 4324 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 4319 4325 */ 4320 static DECLCALLBACK(int) hdaAttach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)4326 static int hdaAttachInternal(PPDMDEVINS pDevIns, PHDADRIVER pDrv, unsigned uLUN, uint32_t fFlags) 4321 4327 { 4322 4328 PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE); … … 4336 4342 if (RT_SUCCESS(rc)) 4337 4343 { 4338 PHDADRIVER pDrv = (PHDADRIVER)RTMemAllocZ(sizeof(HDADRIVER)); 4344 if (pDrv == NULL) 4345 pDrv = (PHDADRIVER)RTMemAllocZ(sizeof(HDADRIVER)); 4339 4346 if (pDrv) 4340 4347 { … … 4354 4361 LogFunc(("LUN#%u: pCon=%p, drvFlags=0x%x\n", uLUN, pDrv->pConnector, pDrv->Flags)); 4355 4362 4356 /* Attach to driver list. */ 4357 RTListAppend(&pThis->lstDrv, &pDrv->Node); 4363 /* Attach to driver list if not attached yet. */ 4364 if (!pDrv->fAttached) 4365 { 4366 RTListAppend(&pThis->lstDrv, &pDrv->Node); 4367 pDrv->fAttached = true; 4368 } 4358 4369 } 4359 4370 else … … 4377 4388 LogFunc(("uLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc)); 4378 4389 return rc; 4390 } 4391 4392 /** 4393 * Attach command. 4394 * 4395 * This is called to let the device attach to a driver for a specified LUN 4396 * during runtime. This is not called during VM construction, the device 4397 * constructor has to attach to all the available drivers. 4398 * 4399 * @returns VBox status code. 4400 * @param pDevIns The device instance. 4401 * @param uLUN The logical unit which is being detached. 4402 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 4403 */ 4404 static DECLCALLBACK(int) hdaAttach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags) 4405 { 4406 return hdaAttachInternal(pDevIns, NULL /* pDrv */, uLUN, fFlags); 4379 4407 } 4380 4408 … … 4421 4449 4422 4450 if (RT_SUCCESS(rc)) 4423 rc = hdaAttach (pThis->pDevInsR3, pDrv->uLUN, 0 /* fFlags */);4451 rc = hdaAttachInternal(pThis->pDevInsR3, pDrv, pDrv->uLUN, 0 /* fFlags */); 4424 4452 4425 4453 LogFunc(("pThis=%p, uLUN=%u, pszDriver=%s, rc=%Rrc\n", pThis, pDrv->uLUN, pszDriver, rc)); … … 4585 4613 { 4586 4614 LogFunc(("Trying to attach driver for LUN #%RU32 ...\n", uLUN)); 4587 rc = hdaAttach (pDevIns, uLUN, 0 /* fFlags */);4615 rc = hdaAttachInternal(pDevIns, NULL /* pDrv */, uLUN, 0 /* fFlags */); 4588 4616 if (RT_FAILURE(rc)) 4589 4617 {
Note:
See TracChangeset
for help on using the changeset viewer.