Commit e80008c5 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: Use an atomic_t instead of a volatile unsigned long, from Stephen Rothwell

From: Anton Blanchard <anton@samba.org>

Use an atomic_t instead of a volatile unsigned long, from Stephen Rothwell
parent bdabd2b4
...@@ -85,7 +85,7 @@ static void handleMonitorEvent(struct HvLpEvent *event); ...@@ -85,7 +85,7 @@ static void handleMonitorEvent(struct HvLpEvent *event);
struct doneAllocParms_t { struct doneAllocParms_t {
struct semaphore *sem; struct semaphore *sem;
int number; int number;
volatile unsigned long *wait_atomic; atomic_t *wait_atomic;
int used_wait_atomic; int used_wait_atomic;
}; };
...@@ -531,7 +531,7 @@ static void viopath_donealloc(void *parm, int number) ...@@ -531,7 +531,7 @@ static void viopath_donealloc(void *parm, int number)
parmsp->number = number; parmsp->number = number;
if (parmsp->used_wait_atomic) if (parmsp->used_wait_atomic)
*(parmsp->wait_atomic) = 0; atomic_set(parmsp->wait_atomic, 0);
else else
up(parmsp->sem); up(parmsp->sem);
} }
...@@ -540,10 +540,11 @@ static int allocateEvents(HvLpIndex remoteLp, int numEvents) ...@@ -540,10 +540,11 @@ static int allocateEvents(HvLpIndex remoteLp, int numEvents)
{ {
struct doneAllocParms_t parms; struct doneAllocParms_t parms;
DECLARE_MUTEX_LOCKED(Semaphore); DECLARE_MUTEX_LOCKED(Semaphore);
volatile unsigned long wait_atomic = 1; atomic_t wait_atomic;
if (in_atomic()) { if (in_atomic()) {
parms.used_wait_atomic = 1; parms.used_wait_atomic = 1;
atomic_set(&wait_atomic, 1);
parms.wait_atomic = &wait_atomic; parms.wait_atomic = &wait_atomic;
} else { } else {
parms.used_wait_atomic = 0; parms.used_wait_atomic = 0;
...@@ -552,7 +553,7 @@ static int allocateEvents(HvLpIndex remoteLp, int numEvents) ...@@ -552,7 +553,7 @@ static int allocateEvents(HvLpIndex remoteLp, int numEvents)
mf_allocateLpEvents(remoteLp, HvLpEvent_Type_VirtualIo, 250, /* It would be nice to put a real number here! */ mf_allocateLpEvents(remoteLp, HvLpEvent_Type_VirtualIo, 250, /* It would be nice to put a real number here! */
numEvents, &viopath_donealloc, &parms); numEvents, &viopath_donealloc, &parms);
if (in_atomic()) { if (in_atomic()) {
while (wait_atomic) while (atomic_read(&wait_atomic))
mb(); mb();
} else } else
down(&Semaphore); down(&Semaphore);
...@@ -656,6 +657,7 @@ int viopath_close(HvLpIndex remoteLp, int subtype, int numReq) ...@@ -656,6 +657,7 @@ int viopath_close(HvLpIndex remoteLp, int subtype, int numReq)
spin_unlock_irqrestore(&statuslock, flags); spin_unlock_irqrestore(&statuslock, flags);
doneAllocParms.used_wait_atomic = 0;
doneAllocParms.sem = &Semaphore; doneAllocParms.sem = &Semaphore;
mf_deallocateLpEvents(remoteLp, HvLpEvent_Type_VirtualIo, mf_deallocateLpEvents(remoteLp, HvLpEvent_Type_VirtualIo,
numReq, &viopath_donealloc, &doneAllocParms); numReq, &viopath_donealloc, &doneAllocParms);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment