From: Nishanth Aravamudan <nacc@xxxxxxxxxx> [applies on top of msleep+msleep_interruptible-drivers_net_tokenring_ibmtr.patch] Replace deprecated sleep_on*() function calls with direct wait-queue usage. Patch is compile-tested. The patch also fixes a potentially racy conditional in tok_open(), whereby msleep_interruptible() could receive a signal within the last jiffy, thus returning 0, but signal_pending(current) would be true. Signed-off-by: Nishanth Aravamudan <nacc@xxxxxxxxxx> Signed-off-by: Domen Puncer <domen@xxxxxxxxxxxx> --- ibmtr.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) Index: quilt/drivers/net/tokenring/ibmtr.c =================================================================== --- quilt.orig/drivers/net/tokenring/ibmtr.c +++ quilt/drivers/net/tokenring/ibmtr.c @@ -109,6 +109,7 @@ in the event that chatty debug messages #include <linux/module.h> #include <linux/delay.h> +#include <linux/wait.h> #ifdef PCMCIA /* required for ibmtr_cs.c to build */ #undef MODULE /* yes, really */ @@ -848,6 +849,7 @@ static int __devinit trdev_init(struct n static int tok_init_card(struct net_device *dev) { + DEFINE_WAIT(wait); struct tok_info *ti; short PIOaddr; unsigned long i; @@ -868,13 +870,16 @@ static int tok_init_card(struct net_devi writeb(SRPR_ENABLE_PAGING,ti->mmio+ACA_OFFSET+ACA_RW+SRPR_EVEN); #endif writeb(INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_SET + ISRP_EVEN); - i = sleep_on_timeout(&ti->wait_for_reset, 4 * HZ); + prepare_to_wait(&ti->wait_for_reset, &wait, TASK_UNINTERRUPTIBLE); + i = schedule_timeout(4*HZ); + finish_wait(&ti->wait_for_reset, &wait); return i? 0 : -EAGAIN; } /*****************************************************************************/ static int tok_open(struct net_device *dev) { + DEFINE_WAIT(wait); struct tok_info *ti = (struct tok_info *) dev->priv; int i; @@ -904,7 +909,9 @@ static int tok_open(struct net_device *d while (1){ tok_open_adapter((unsigned long) dev); - i= interruptible_sleep_on_timeout(&ti->wait_for_reset, 25 * HZ); + prepare_to_wait(&ti->wait_for_reset, &wait, TASK_INTERRUPTIBLE); + i = schedule_timeout(25 * HZ); + finish_wait(&ti->wait_for_reset, &wait); /* sig catch: estimate opening adapter takes more than .5 sec*/ if (i>(245*HZ)/10) break; /* fancier than if (i==25*HZ) */ if (i==0) break; @@ -913,7 +920,8 @@ static int tok_open(struct net_device *d DPRINTK("Adapter is up and running\n"); return 0; } - if(msleep_interruptible(jiffies_to_msecs(TR_RETRY_INTERVAL))) + msleep_interruptible(jiffies_to_msecs(TR_RETRY_INTERVAL)); + if (signal_pending(current)) break; /*prob. a signal, like the i>24*HZ case above */ } outb(0, dev->base_addr + ADAPTRESET);/* kill pending interrupts*/ -- - : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html