]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sgi-xp: open-code interruptible_sleep_on_timeout
authorArnd Bergmann <arnd@arndb.de>
Thu, 2 Jan 2014 12:07:52 +0000 (13:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Jan 2014 23:18:02 +0000 (15:18 -0800)
interruptible_sleep_on_timeout is deprecated and going away soon.
The use in the sgi-xp driver leaves me puzzled, so I'd prefer not
to touch it. This patch replaces it with an open-coded prepare_to_wait
and finish_wait pair, which should be completely equivalent, so it
doesn't fix an existing race, but lets us get away with removing
the function so we can not get any new users.

In order to remove the typical sleep_on race, one would have to
replace the call with wait_event_interruptible_timeout and add
a condition to wait for. The fact that there is a one-jiffy timeout
suggests that we don't actually expect to get woken up properly
and the caller just uses this as a short sleeping function
if it doesn't wake up properly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Cliff Whickman <cpw@sgi.com>
Acked-by: Robin Holt <robinmholt@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/sgi-xp/xpc_channel.c

index 652593fc486d69f3fc3cd7c50df2f9d7e4fc8a20..128d5615c8040ce2c1225487cfc53f0d4d7fed97 100644 (file)
@@ -828,6 +828,7 @@ enum xp_retval
 xpc_allocate_msg_wait(struct xpc_channel *ch)
 {
        enum xp_retval ret;
+       DEFINE_WAIT(wait);
 
        if (ch->flags & XPC_C_DISCONNECTING) {
                DBUG_ON(ch->reason == xpInterrupted);
@@ -835,7 +836,9 @@ xpc_allocate_msg_wait(struct xpc_channel *ch)
        }
 
        atomic_inc(&ch->n_on_msg_allocate_wq);
-       ret = interruptible_sleep_on_timeout(&ch->msg_allocate_wq, 1);
+       prepare_to_wait(&ch->msg_allocate_wq, &wait, TASK_INTERRUPTIBLE);
+       ret = schedule_timeout(1);
+       finish_wait(&ch->msg_allocate_wq, &wait);
        atomic_dec(&ch->n_on_msg_allocate_wq);
 
        if (ch->flags & XPC_C_DISCONNECTING) {