mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-06 02:35:10 +00:00
dm: mei: code cleanup
- explicitly initialize the connections list - use a do-while loop for vmei_proc_tx() since the first call must always succeed - make sure active_clients is initialized before creating the tx thread v1 -> v2: - split the cleanup commit into two parts Tracked-On: #2763 Signed-off-by: Peter Fang <peter.fang@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
bb54a2c7c6
commit
e9261121b3
@ -543,6 +543,7 @@ vmei_me_client_create(struct virtio_mei *vmei, uint8_t client_id,
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&mclient->list_mutex, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
LIST_INIT(&mclient->connections);
|
||||
|
||||
mclient->vmei = vmei;
|
||||
mclient->client_id = client_id;
|
||||
@ -1589,8 +1590,9 @@ vmei_notify_tx(void *data, struct virtio_vq_info *vq)
|
||||
vq->used->flags |= VRING_USED_F_NO_NOTIFY;
|
||||
pthread_mutex_unlock(&vmei->tx_mutex);
|
||||
|
||||
while (vq_has_descs(vq))
|
||||
do {
|
||||
vmei_proc_tx(vmei, vq);
|
||||
} while (vq_has_descs(vq));
|
||||
|
||||
vq_endchains(vq, 1);
|
||||
|
||||
@ -2294,6 +2296,15 @@ init:
|
||||
goto setup_fail;
|
||||
virtio_set_io_bar(&vmei->base, 0);
|
||||
|
||||
/*
|
||||
* init clients
|
||||
*/
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&vmei->list_mutex, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
LIST_INIT(&vmei->active_clients);
|
||||
|
||||
/*
|
||||
* tx stuff, thread, mutex, cond
|
||||
*/
|
||||
@ -2314,15 +2325,6 @@ init:
|
||||
snprintf(tname, sizeof(tname), "vmei-%d:%d rx", dev->slot, dev->func);
|
||||
pthread_setname_np(vmei->rx_thread, tname);
|
||||
|
||||
/*
|
||||
* init clients
|
||||
*/
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&vmei->list_mutex, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
LIST_INIT(&vmei->active_clients);
|
||||
|
||||
/*
|
||||
* start mei backend
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user