Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/jmcneill-usbmp]: src/sys/dev/usb use kpause() in usb{d, }_delay_ms(), and...



details:   https://anonhg.NetBSD.org/src/rev/56b08655ec16
branches:  jmcneill-usbmp
changeset: 771825:56b08655ec16
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Feb 26 06:59:38 2012 +0000

description:
use kpause() in usb{d,}_delay_ms(), and add a version that takes a mutex

diffstat:

 sys/dev/usb/ukbd.c     |   5 +++--
 sys/dev/usb/usb_subr.c |  23 ++++++++++++++++++-----
 sys/dev/usb/usbdivar.h |   6 +++++-
 3 files changed, 26 insertions(+), 8 deletions(-)

diffs (109 lines):

diff -r 9f32bb0affa1 -r 56b08655ec16 sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c        Sun Feb 26 06:28:58 2012 +0000
+++ b/sys/dev/usb/ukbd.c        Sun Feb 26 06:59:38 2012 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.113.4.3 2012/02/24 09:11:43 mrg Exp $        */
+/*      $NetBSD: ukbd.c,v 1.113.4.4 2012/02/26 06:59:38 mrg Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.113.4.3 2012/02/24 09:11:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.113.4.4 2012/02/26 06:59:38 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,7 @@
 
 #include <dev/usb/usbdi.h>
 #include <dev/usb/usbdi_util.h>
+#include <dev/usb/usbdivar.h>
 #include <dev/usb/usbdevs.h>
 #include <dev/usb/usb_quirks.h>
 #include <dev/usb/uhidev.h>
diff -r 9f32bb0affa1 -r 56b08655ec16 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Sun Feb 26 06:28:58 2012 +0000
+++ b/sys/dev/usb/usb_subr.c    Sun Feb 26 06:59:38 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.180.6.3 2011/12/09 01:53:00 mrg Exp $   */
+/*     $NetBSD: usb_subr.c,v 1.180.6.4 2012/02/26 06:59:38 mrg Exp $   */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.180.6.3 2011/12/09 01:53:00 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.180.6.4 2012/02/26 06:59:38 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usbverbose.h"
@@ -296,20 +296,33 @@
 
 /* Delay for a certain number of ms */
 void
-usb_delay_ms(usbd_bus_handle bus, u_int ms)
+usb_delay_ms_locked(usbd_bus_handle bus, u_int ms, kmutex_t *lock)
 {
        /* Wait at least two clock ticks so we know the time has passed. */
        if (bus->use_polling || cold)
                delay((ms+1) * 1000);
        else
-               tsleep(&ms, PRIBIO, "usbdly", (ms*hz+999)/1000 + 1);
+               kpause("usbdly", false, (ms*hz+999)/1000 + 1, lock);
+}
+
+void
+usb_delay_ms(usbd_bus_handle bus, u_int ms)
+{
+       usb_delay_ms_locked(bus, ms, NULL);
+}
+
+/* Delay given a device handle. */
+void
+usbd_delay_ms_locked(usbd_device_handle dev, u_int ms, kmutex_t *lock)
+{
+       usb_delay_ms_locked(dev->bus, ms, lock);
 }
 
 /* Delay given a device handle. */
 void
 usbd_delay_ms(usbd_device_handle dev, u_int ms)
 {
-       usb_delay_ms(dev->bus, ms);
+       usb_delay_ms_locked(dev->bus, ms, NULL);
 }
 
 usbd_status
diff -r 9f32bb0affa1 -r 56b08655ec16 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h    Sun Feb 26 06:28:58 2012 +0000
+++ b/sys/dev/usb/usbdivar.h    Sun Feb 26 06:59:38 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdivar.h,v 1.93.8.10 2012/02/25 20:46:34 mrg Exp $   */
+/*     $NetBSD: usbdivar.h,v 1.93.8.11 2012/02/26 06:59:38 mrg Exp $   */
 /*     $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $   */
 
 /*
@@ -33,6 +33,7 @@
 
 #include <sys/callout.h>
 #include <sys/mutex.h>
+#include <sys/bus.h>
 
 /*
  * Discussion about locking in the USB code:
@@ -278,7 +279,10 @@
 
 /* Routines from usb_subr.c */
 int            usbctlprint(void *, const char *);
+void           usb_delay_ms_locked(usbd_bus_handle, u_int, kmutex_t *);
 void           usb_delay_ms(usbd_bus_handle, u_int);
+void           usbd_delay_ms_locked(usbd_device_handle, u_int, kmutex_t *);
+void           usbd_delay_ms(usbd_device_handle, u_int);
 usbd_status    usbd_reset_port(usbd_device_handle, int, usb_port_status_t *);
 usbd_status    usbd_setup_pipe(usbd_device_handle dev,
                                usbd_interface_handle iface,



Home | Main Index | Thread Index | Old Index