psm.c (109710) | psm.c (111748) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 Erik Forsberg. 3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 6 unchanged lines hidden (view full) --- 15 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 16 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 17 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 18 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 19 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * | 1/*- 2 * Copyright (c) 1992, 1993 Erik Forsberg. 3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 6 unchanged lines hidden (view full) --- 15 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 16 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 17 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 18 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 19 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * |
23 * $FreeBSD: head/sys/dev/atkbdc/psm.c 109710 2003-01-22 22:02:09Z marcel $ | 23 * $FreeBSD: head/sys/dev/atkbdc/psm.c 111748 2003-03-02 16:54:40Z des $ |
24 */ 25 26/* 27 * Ported to 386bsd Oct 17, 1992 28 * Sandi Donno, Computer Science, University of Cape Town, South Africa 29 * Please send bug reports to sandi@cs.uct.ac.za 30 * 31 * Thanks are also due to Rick Macklem, rick@snowhite.cis.uoguelph.ca - --- 1491 unchanged lines hidden (view full) --- 1523 /* block until mouse activity occured */ 1524 s = spltty(); 1525 while (sc->queue.count <= 0) { 1526 if (PSM_NBLOCKIO(dev)) { 1527 splx(s); 1528 return EWOULDBLOCK; 1529 } 1530 sc->state |= PSM_ASLP; | 24 */ 25 26/* 27 * Ported to 386bsd Oct 17, 1992 28 * Sandi Donno, Computer Science, University of Cape Town, South Africa 29 * Please send bug reports to sandi@cs.uct.ac.za 30 * 31 * Thanks are also due to Rick Macklem, rick@snowhite.cis.uoguelph.ca - --- 1491 unchanged lines hidden (view full) --- 1523 /* block until mouse activity occured */ 1524 s = spltty(); 1525 while (sc->queue.count <= 0) { 1526 if (PSM_NBLOCKIO(dev)) { 1527 splx(s); 1528 return EWOULDBLOCK; 1529 } 1530 sc->state |= PSM_ASLP; |
1531 error = tsleep((caddr_t) sc, PZERO | PCATCH, "psmrea", 0); | 1531 error = tsleep( sc, PZERO | PCATCH, "psmrea", 0); |
1532 sc->state &= ~PSM_ASLP; 1533 if (error) { 1534 splx(s); 1535 return error; 1536 } else if ((sc->state & PSM_VALID) == 0) { 1537 /* the device disappeared! */ 1538 splx(s); 1539 return EIO; --- 821 unchanged lines hidden (view full) --- 2361 sc->queue.tail = 2362 (sc->queue.tail + sc->inputbytes) % sizeof(sc->queue.buf); 2363 sc->queue.count += sc->inputbytes; 2364 } 2365 sc->inputbytes = 0; 2366 2367 if (sc->state & PSM_ASLP) { 2368 sc->state &= ~PSM_ASLP; | 1532 sc->state &= ~PSM_ASLP; 1533 if (error) { 1534 splx(s); 1535 return error; 1536 } else if ((sc->state & PSM_VALID) == 0) { 1537 /* the device disappeared! */ 1538 splx(s); 1539 return EIO; --- 821 unchanged lines hidden (view full) --- 2361 sc->queue.tail = 2362 (sc->queue.tail + sc->inputbytes) % sizeof(sc->queue.buf); 2363 sc->queue.count += sc->inputbytes; 2364 } 2365 sc->inputbytes = 0; 2366 2367 if (sc->state & PSM_ASLP) { 2368 sc->state &= ~PSM_ASLP; |
2369 wakeup((caddr_t) sc); | 2369 wakeup( sc); |
2370 } 2371 selwakeup(&sc->rsel); 2372 } 2373} 2374 2375static int 2376psmpoll(dev_t dev, int events, struct thread *td) 2377{ --- 438 unchanged lines hidden (view full) --- 2816 err = reinitialize(sc, sc->config & PSM_CONFIG_INITAFTERSUSPEND); 2817 2818 if ((sc->state & PSM_ASLP) && !(sc->state & PSM_VALID)) { 2819 /* 2820 * Release the blocked process; it must be notified that the device 2821 * cannot be accessed anymore. 2822 */ 2823 sc->state &= ~PSM_ASLP; | 2370 } 2371 selwakeup(&sc->rsel); 2372 } 2373} 2374 2375static int 2376psmpoll(dev_t dev, int events, struct thread *td) 2377{ --- 438 unchanged lines hidden (view full) --- 2816 err = reinitialize(sc, sc->config & PSM_CONFIG_INITAFTERSUSPEND); 2817 2818 if ((sc->state & PSM_ASLP) && !(sc->state & PSM_VALID)) { 2819 /* 2820 * Release the blocked process; it must be notified that the device 2821 * cannot be accessed anymore. 2822 */ 2823 sc->state &= ~PSM_ASLP; |
2824 wakeup((caddr_t)sc); | 2824 wakeup(sc); |
2825 } 2826 2827 if (verbose >= 2) 2828 log(LOG_DEBUG, "psm%d: system resume hook exiting.\n", unit); 2829 2830 return (err); 2831} 2832 --- 134 unchanged lines hidden --- | 2825 } 2826 2827 if (verbose >= 2) 2828 log(LOG_DEBUG, "psm%d: system resume hook exiting.\n", unit); 2829 2830 return (err); 2831} 2832 --- 134 unchanged lines hidden --- |