Sun Jan 29 09:55:21 2017 UTC ()
Another tsleep bites the dust


(skrll)
diff -r1.9.14.9 -r1.9.14.10 src/sys/dev/usb/uyurex.c

cvs diff -r1.9.14.9 -r1.9.14.10 src/sys/dev/usb/Attic/uyurex.c (expand / switch to unified diff)

--- src/sys/dev/usb/Attic/uyurex.c 2017/01/28 10:15:01 1.9.14.9
+++ src/sys/dev/usb/Attic/uyurex.c 2017/01/29 09:55:21 1.9.14.10
@@ -1,38 +1,38 @@ @@ -1,38 +1,38 @@
1/* $NetBSD: uyurex.c,v 1.9.14.9 2017/01/28 10:15:01 skrll Exp $ */ 1/* $NetBSD: uyurex.c,v 1.9.14.10 2017/01/29 09:55:21 skrll Exp $ */
2/* $OpenBSD: uyurex.c,v 1.3 2010/03/04 03:47:22 deraadt Exp $ */ 2/* $OpenBSD: uyurex.c,v 1.3 2010/03/04 03:47:22 deraadt Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2010 Yojiro UO <yuo@nui.org> 5 * Copyright (c) 2010 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 Maywa-Denki & KAYAC YUREX BBU sensor 21 * Driver for Maywa-Denki & KAYAC YUREX BBU sensor
22 */ 22 */
23 23
24#include <sys/cdefs.h> 24#include <sys/cdefs.h>
25__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.14.9 2017/01/28 10:15:01 skrll Exp $"); 25__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.14.10 2017/01/29 09:55:21 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/kmem.h> 35#include <sys/kmem.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/conf.h> 37#include <sys/conf.h>
38#include <sys/envsys.h> 38#include <sys/envsys.h>
@@ -331,27 +331,27 @@ uyurex_set_mode(struct uyurex_softc *sc, @@ -331,27 +331,27 @@ uyurex_set_mode(struct uyurex_softc *sc,
331 req[0] = CMD_MODE; 331 req[0] = CMD_MODE;
332 req[1] = val; 332 req[1] = val;
333 req[2] = CMD_EOF; 333 req[2] = CMD_EOF;
334 sc->issueing_cmd = CMD_MODE; /* necessary? */ 334 sc->issueing_cmd = CMD_MODE; /* necessary? */
335 sc->accepted_cmd = CMD_NONE; /* necessary? */ 335 sc->accepted_cmd = CMD_NONE; /* necessary? */
336 err = uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT, req, 336 err = uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT, req,
337 sc->sc_olen); 337 sc->sc_olen);
338 if (err) { 338 if (err) {
339 printf("uhidev_set_report error:EIO\n"); 339 printf("uhidev_set_report error:EIO\n");
340 return; 340 return;
341 } 341 }
342 342
343 /* wait ack */ 343 /* wait ack */
344 tsleep(&sc->sc_sme, 0, "uyurex", (1000*hz+999)/1000 + 1); 344 kpause("uyurexsm", false, (1000*hz+999)/1000 + 1, NULL);
345} 345}
346 346
347void 347void
348uyurex_read_value_request(struct uyurex_softc *sc) 348uyurex_read_value_request(struct uyurex_softc *sc)
349{ 349{
350 uint8_t req[8]; 350 uint8_t req[8];
351 351
352 memset(req, CMD_PADDING, sizeof(req)); 352 memset(req, CMD_PADDING, sizeof(req));
353 req[0] = CMD_READ; 353 req[0] = CMD_READ;
354 req[1] = CMD_EOF; 354 req[1] = CMD_EOF;
355 sc->issueing_cmd = CMD_READ; 355 sc->issueing_cmd = CMD_READ;
356 sc->accepted_cmd = CMD_NONE; 356 sc->accepted_cmd = CMD_NONE;
357 if (uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT, req, 357 if (uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT, req,