Sat Jan 28 10:10:15 2017 UTC ()
Remove tsleep from uthum(4)


(skrll)
diff -r1.8.4.7 -r1.8.4.8 src/sys/dev/usb/TODO.usbmp
diff -r1.10.14.8 -r1.10.14.9 src/sys/dev/usb/uthum.c

cvs diff -r1.8.4.7 -r1.8.4.8 src/sys/dev/usb/TODO.usbmp (expand / switch to unified diff)

--- src/sys/dev/usb/TODO.usbmp 2017/01/28 10:05:09 1.8.4.7
+++ src/sys/dev/usb/TODO.usbmp 2017/01/28 10:10:15 1.8.4.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: TODO.usbmp,v 1.8.4.7 2017/01/28 10:05:09 skrll Exp $ 1$NetBSD: TODO.usbmp,v 1.8.4.8 2017/01/28 10:10:15 skrll Exp $
2 2
3 3
4the majority of the USB MP device interface is documented in usbdivar.h. 4the majority of the USB MP device interface is documented in usbdivar.h.
5 5
6 6
7flesh out most of usbdi(9). 7flesh out most of usbdi(9).
8 8
9usb_event_thread() startup should use something to sync companions 9usb_event_thread() startup should use something to sync companions
10 10
11 11
12KERNEL_LOCK 12KERNEL_LOCK
13 - auvitek.c 13 - auvitek.c
14 - auvitek_dtv.c 14 - auvitek_dtv.c
@@ -94,27 +94,26 @@ splusb drivers: @@ -94,27 +94,26 @@ splusb drivers:
94 - ustir.c 94 - ustir.c
95 - utoppy.c 95 - utoppy.c
96 - uvideo.c 96 - uvideo.c
97 97
98wakeup/tsleep drivers: 98wakeup/tsleep drivers:
99 - if_run.c 99 - if_run.c
100 - if_urtwn.c 100 - if_urtwn.c
101 - if_zyd.c 101 - if_zyd.c
102 - ucycom.c 102 - ucycom.c
103 - udsir.c 103 - udsir.c
104 - uirda.c 104 - uirda.c
105 - umass_isdata.c 105 - umass_isdata.c
106 - ustir.c 106 - ustir.c
107 - uthum.c 
108 - uyurex.c 107 - uyurex.c
109 108
110missing D_MPSAFE drivers: 109missing D_MPSAFE drivers:
111 - ucycom 110 - ucycom
112 - ugen - partially ready 111 - ugen - partially ready
113 - uhso 112 - uhso
114 - ulpt 113 - ulpt
115 - urio 114 - urio
116 - usb 115 - usb
117 - uscanner 116 - uscanner
118 - utoppy 117 - utoppy
119 118
120missing CALLOUT_MPSAFE drivers: 119missing CALLOUT_MPSAFE drivers:

cvs diff -r1.10.14.8 -r1.10.14.9 src/sys/dev/usb/uthum.c (expand / switch to unified diff)

--- src/sys/dev/usb/uthum.c 2016/12/05 10:55:20 1.10.14.8
+++ src/sys/dev/usb/uthum.c 2017/01/28 10:10:15 1.10.14.9
@@ -1,38 +1,38 @@ @@ -1,38 +1,38 @@
1/* $NetBSD: uthum.c,v 1.10.14.8 2016/12/05 10:55:20 skrll Exp $ */ 1/* $NetBSD: uthum.c,v 1.10.14.9 2017/01/28 10:10:15 skrll Exp $ */
2/* $OpenBSD: uthum.c,v 1.6 2010/01/03 18:43:02 deraadt Exp $ */ 2/* $OpenBSD: uthum.c,v 1.6 2010/01/03 18:43:02 deraadt Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2009 Yojiro UO <yuo@nui.org> 5 * Copyright (c) 2009 Yojiro UO <yuo@nui.org>
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above 8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies. 9 * copyright notice and this permission notice appear in all copies.
10 * 10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCAIMS ALL WARRANTIES 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */ 18 */
19 19
20/* 20/*
21 * Driver for TEMPer and TEMPerHUM HID 21 * Driver for TEMPer and TEMPerHUM HID
22 */ 22 */
23 23
24#include <sys/cdefs.h> 24#include <sys/cdefs.h>
25__KERNEL_RCSID(0, "$NetBSD: uthum.c,v 1.10.14.8 2016/12/05 10:55:20 skrll Exp $"); 25__KERNEL_RCSID(0, "$NetBSD: uthum.c,v 1.10.14.9 2017/01/28 10:10:15 skrll Exp $");
26 26
27#ifdef _KERNEL_OPT 27#ifdef _KERNEL_OPT
28#include "opt_usb.h" 28#include "opt_usb.h"
29#endif 29#endif
30 30
31#include <sys/param.h> 31#include <sys/param.h>
32#include <sys/proc.h> 32#include <sys/proc.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/conf.h> 36#include <sys/conf.h>
37 37
38#include <dev/sysmon/sysmonvar.h> 38#include <dev/sysmon/sysmonvar.h>
@@ -284,27 +284,27 @@ uthum_read_data(struct uthum_softc *sc,  @@ -284,27 +284,27 @@ uthum_read_data(struct uthum_softc *sc,
284 memset(cmdbuf, 0, sizeof(cmdbuf)); 284 memset(cmdbuf, 0, sizeof(cmdbuf));
285 for (i = 0; i < 7; i++) { 285 for (i = 0; i < 7; i++) {
286 if (uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT, 286 if (uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT,
287 cmdbuf, sc->sc_olen)) 287 cmdbuf, sc->sc_olen))
288 return EIO; 288 return EIO;
289 } 289 }
290 memcpy(cmdbuf, cmd_end, sizeof(cmd_end)); 290 memcpy(cmdbuf, cmd_end, sizeof(cmd_end));
291 if (uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT, 291 if (uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT,
292 cmdbuf, sc->sc_olen)) 292 cmdbuf, sc->sc_olen))
293 return EIO; 293 return EIO;
294 294
295 /* wait if required */ 295 /* wait if required */
296 if (need_delay > 1) 296 if (need_delay > 1)
297 tsleep(&sc->sc_sme, 0, "uthum", (need_delay*hz+999)/1000 + 1); 297 kpause("uthum", false, (need_delay*hz+999)/1000 + 1, NULL);
298 298
299 /* get answer */ 299 /* get answer */
300 if (uhidev_get_report(&sc->sc_hdev, UHID_FEATURE_REPORT, 300 if (uhidev_get_report(&sc->sc_hdev, UHID_FEATURE_REPORT,
301 report, sc->sc_flen)) 301 report, sc->sc_flen))
302 return EIO; 302 return EIO;
303 memcpy(buf, report, len); 303 memcpy(buf, report, len);
304 return 0; 304 return 0;
305} 305}
306 306
307int 307int
308uthum_check_sensortype(struct uthum_softc *sc) 308uthum_check_sensortype(struct uthum_softc *sc)
309{ 309{
310 uint8_t buf[8]; 310 uint8_t buf[8];