mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-01 19:34:35 +08:00
[POWERPC] viopath: Use a completion in some more places
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
9d561ed46e
commit
39d207036c
@ -82,7 +82,7 @@ static void handleMonitorEvent(struct HvLpEvent *event);
|
|||||||
* if system_state is not SYSTEM_RUNNING, then wait_atomic is used ...
|
* if system_state is not SYSTEM_RUNNING, then wait_atomic is used ...
|
||||||
*/
|
*/
|
||||||
struct alloc_parms {
|
struct alloc_parms {
|
||||||
struct semaphore sem;
|
struct completion done;
|
||||||
int number;
|
int number;
|
||||||
atomic_t wait_atomic;
|
atomic_t wait_atomic;
|
||||||
int used_wait_atomic;
|
int used_wait_atomic;
|
||||||
@ -465,7 +465,7 @@ static void viopath_donealloc(void *parm, int number)
|
|||||||
if (parmsp->used_wait_atomic)
|
if (parmsp->used_wait_atomic)
|
||||||
atomic_set(&parmsp->wait_atomic, 0);
|
atomic_set(&parmsp->wait_atomic, 0);
|
||||||
else
|
else
|
||||||
up(&parmsp->sem);
|
complete(&parmsp->done);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int allocateEvents(HvLpIndex remoteLp, int numEvents)
|
static int allocateEvents(HvLpIndex remoteLp, int numEvents)
|
||||||
@ -477,7 +477,7 @@ static int allocateEvents(HvLpIndex remoteLp, int numEvents)
|
|||||||
atomic_set(&parms.wait_atomic, 1);
|
atomic_set(&parms.wait_atomic, 1);
|
||||||
} else {
|
} else {
|
||||||
parms.used_wait_atomic = 0;
|
parms.used_wait_atomic = 0;
|
||||||
init_MUTEX_LOCKED(&parms.sem);
|
init_completion(&parms.done);
|
||||||
}
|
}
|
||||||
mf_allocate_lp_events(remoteLp, HvLpEvent_Type_VirtualIo, 250, /* It would be nice to put a real number here! */
|
mf_allocate_lp_events(remoteLp, HvLpEvent_Type_VirtualIo, 250, /* It would be nice to put a real number here! */
|
||||||
numEvents, &viopath_donealloc, &parms);
|
numEvents, &viopath_donealloc, &parms);
|
||||||
@ -485,7 +485,7 @@ static int allocateEvents(HvLpIndex remoteLp, int numEvents)
|
|||||||
while (atomic_read(&parms.wait_atomic))
|
while (atomic_read(&parms.wait_atomic))
|
||||||
mb();
|
mb();
|
||||||
} else
|
} else
|
||||||
down(&parms.sem);
|
wait_for_completion(&parms.done);
|
||||||
return parms.number;
|
return parms.number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,10 +586,10 @@ int viopath_close(HvLpIndex remoteLp, int subtype, int numReq)
|
|||||||
spin_unlock_irqrestore(&statuslock, flags);
|
spin_unlock_irqrestore(&statuslock, flags);
|
||||||
|
|
||||||
parms.used_wait_atomic = 0;
|
parms.used_wait_atomic = 0;
|
||||||
init_MUTEX_LOCKED(&parms.sem);
|
init_completion(&parms.done);
|
||||||
mf_deallocate_lp_events(remoteLp, HvLpEvent_Type_VirtualIo,
|
mf_deallocate_lp_events(remoteLp, HvLpEvent_Type_VirtualIo,
|
||||||
numReq, &viopath_donealloc, &parms);
|
numReq, &viopath_donealloc, &parms);
|
||||||
down(&parms.sem);
|
wait_for_completion(&parms.done);
|
||||||
|
|
||||||
spin_lock_irqsave(&statuslock, flags);
|
spin_lock_irqsave(&statuslock, flags);
|
||||||
for (i = 0, numOpen = 0; i < VIO_MAX_SUBTYPES; i++)
|
for (i = 0, numOpen = 0; i < VIO_MAX_SUBTYPES; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user