/* * ======== CreateChirpList ======== * Purpose: * Initialize a queue of channel I/O Request/Completion packets. * Parameters: * uChirps: Number of Chirps to allocate. * Returns: * Pointer to queue of IRPs, or NULL. * Requires: * Ensures: */ static struct LST_LIST *CreateChirpList(u32 uChirps) { struct LST_LIST *pChirpList; struct CHNL_IRP *pChirp; u32 i; pChirpList = MEM_Calloc(sizeof(struct LST_LIST), MEM_NONPAGED); if (pChirpList) { INIT_LIST_HEAD(&pChirpList->head); /* Make N chirps and place on queue. */ for (i = 0; (i < uChirps) && ((pChirp = MakeNewChirp()) != NULL); i++) { LST_PutTail(pChirpList, (struct list_head *)pChirp); } /* If we couldn't allocate all chirps, free those allocated: */ if (i != uChirps) { FreeChirpList(pChirpList); pChirpList = NULL; } } return pChirpList; }
/* * ======== CreateChirpList ======== * Purpose: * Initialize a queue of channel I/O Request/Completion packets. * Parameters: * uChirps: Number of Chirps to allocate. * Returns: * Pointer to queue of IRPs, or NULL. * Requires: * Ensures: */ static struct LST_LIST *CreateChirpList(u32 uChirps) { struct LST_LIST *pChirpList; struct CHNL_IRP *pChirp; u32 i; pChirpList = LST_Create(); if (pChirpList) { /* Make N chirps and place on queue. */ for (i = 0; (i < uChirps) && ((pChirp = MakeNewChirp()) != NULL); i++) { LST_PutTail(pChirpList, (struct LST_ELEM *)pChirp); } /* If we couldn't allocate all chirps, free those allocated: */ if (i != uChirps) { FreeChirpList(pChirpList); pChirpList = NULL; } } return pChirpList; }