Convert all tsleep(9) in the USB stack to the new tsleep_nsec(9), ok?
Index: usb.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb.c,v
retrieving revision 1.123
diff -u -p -r1.123 usb.c
--- usb.c 9 Jan 2019 12:10:37 -0000 1.123
+++ usb.c 4 Oct 2019 08:44:04 -0000
@@ -381,7 +381,7 @@ usb_wait_task(struct usbd_device *dev, s
s = splusb();
while (task->state != USB_TASK_STATE_NONE) {
DPRINTF(("%s: waiting for task to complete\n", __func__));
- tsleep(task, PWAIT, "endtask", 0);
+ tsleep_nsec(task, PWAIT, "endtask", INFSLP);
}
splx(s);
}
@@ -408,7 +408,7 @@ usb_task_thread(void *arg)
else if ((task = TAILQ_FIRST(&usb_generic_tasks)) != NULL)
TAILQ_REMOVE(&usb_generic_tasks, task, next);
else {
- tsleep(&usb_run_tasks, PWAIT, "usbtsk", 0);
+ tsleep_nsec(&usb_run_tasks, PWAIT, "usbtsk", INFSLP);
continue;
}
/*
@@ -452,7 +452,8 @@ usb_abort_task_thread(void *arg)
if ((task = TAILQ_FIRST(&usb_abort_tasks)) != NULL)
TAILQ_REMOVE(&usb_abort_tasks, task, next);
else {
- tsleep(&usb_run_abort_tasks, PWAIT, "usbatsk", 0);
+ tsleep_nsec(&usb_run_abort_tasks, PWAIT, "usbatsk",
+ INFSLP);
continue;
}
/*
Index: usb_subr.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.149
diff -u -p -r1.149 usb_subr.c
--- usb_subr.c 24 Jun 2019 06:45:06 -0000 1.149
+++ usb_subr.c 4 Oct 2019 08:41:48 -0000
@@ -347,8 +347,8 @@ usb_delay_ms(struct usbd_bus *bus, u_int
if (bus->use_polling || cold)
delay((ms+1) * 1000);
else
- tsleep(&usb_delay_wchan, PRIBIO, "usbdly",
- (ms*hz+999)/1000 + 1);
+ tsleep_nsec(&usb_delay_wchan, PRIBIO, "usbdly",
+ MSEC_TO_NSEC(ms));
}
/* Delay given a device handle. */
Index: usbdi.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usbdi.c,v
retrieving revision 1.100
diff -u -p -r1.100 usbdi.c
--- usbdi.c 18 Nov 2018 16:33:26 -0000 1.100
+++ usbdi.c 4 Oct 2019 08:40:58 -0000
@@ -88,7 +88,7 @@ void
usbd_ref_wait(struct usbd_device *dev)
{
while (dev->ref_cnt > 0)
- tsleep(&dev->ref_cnt, PWAIT, "usbref", hz * 60);
+ tsleep_nsec(&dev->ref_cnt, PWAIT, "usbref", SEC_TO_NSEC(60));
}
int
@@ -364,7 +364,7 @@ usbd_transfer(struct usbd_xfer *xfer)
while (!xfer->done) {
flags = PRIBIO|(xfer->flags & USBD_CATCH ? PCATCH : 0);
- err = tsleep(xfer, flags, "usbsyn", 0);
+ err = tsleep_nsec(xfer, flags, "usbsyn", INFSLP);
if (err && !xfer->done) {
usbd_abort_pipe(pipe);
if (err == EINTR)
Index: usbdi_util.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usbdi_util.c,v
retrieving revision 1.43
diff -u -p -r1.43 usbdi_util.c
--- usbdi_util.c 18 Nov 2018 16:33:26 -0000 1.43
+++ usbdi_util.c 4 Oct 2019 08:40:14 -0000
@@ -269,7 +269,7 @@ void
usb_detach_wait(struct device *dv)
{
DPRINTF(("%s: waiting for %s\n", __func__, dv->dv_xname));
- if (tsleep(dv, PZERO, "usbdet", hz * 60))
+ if (tsleep_nsec(dv, PZERO, "usbdet", SEC_TO_NSEC(60)))
printf("%s: %s didn't detach\n", __func__, dv->dv_xname);
DPRINTF(("%s: %s done\n", __func__, dv->dv_xname));
}