Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sgi-xp: open-code interruptible_sleep_on_timeout

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>

authored by

Arnd Bergmann and committed by
Greg Kroah-Hartman
11d5ceb6 a45a0258

+4 -1
+4 -1
drivers/misc/sgi-xp/xpc_channel.c
··· 828 828 xpc_allocate_msg_wait(struct xpc_channel *ch) 829 829 { 830 830 enum xp_retval ret; 831 + DEFINE_WAIT(wait); 831 832 832 833 if (ch->flags & XPC_C_DISCONNECTING) { 833 834 DBUG_ON(ch->reason == xpInterrupted); ··· 836 835 } 837 836 838 837 atomic_inc(&ch->n_on_msg_allocate_wq); 839 - ret = interruptible_sleep_on_timeout(&ch->msg_allocate_wq, 1); 838 + prepare_to_wait(&ch->msg_allocate_wq, &wait, TASK_INTERRUPTIBLE); 839 + ret = schedule_timeout(1); 840 + finish_wait(&ch->msg_allocate_wq, &wait); 840 841 atomic_dec(&ch->n_on_msg_allocate_wq); 841 842 842 843 if (ch->flags & XPC_C_DISCONNECTING) {