diff options
author | kstailey <kstailey@cvs.openbsd.org> | 1997-01-13 21:28:25 +0000 |
---|---|---|
committer | kstailey <kstailey@cvs.openbsd.org> | 1997-01-13 21:28:25 +0000 |
commit | 09d5e16337250d415a3f981597b5f141f9634b3a (patch) | |
tree | 04de31d8b1bc6b37d5dba756053bf5d58b53e407 /sys/arch/sun3 | |
parent | 57b15eb2bb48bd7c5ffab81fe8939dd47a5e94dc (diff) |
reformatted ala KNF
Diffstat (limited to 'sys/arch/sun3')
-rw-r--r-- | sys/arch/sun3/sun3/leds.c | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/sys/arch/sun3/sun3/leds.c b/sys/arch/sun3/sun3/leds.c index 6a524b27202..39bcc3da6c6 100644 --- a/sys/arch/sun3/sun3/leds.c +++ b/sys/arch/sun3/sun3/leds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: leds.c,v 1.2 1997/01/13 02:53:50 kstailey Exp $ */ +/* $OpenBSD: leds.c,v 1.3 1997/01/13 21:28:24 kstailey Exp $ */ #include <sys/types.h> #include <sys/uio.h> @@ -11,10 +11,10 @@ #define MAXPVLEN 10240 #define MAXCDOWN 128 -static volatile unsigned char pattern[MAXPVLEN] = - { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, - 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f - }; +static volatile unsigned char pattern[MAXPVLEN] = { + 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, + 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f +}; volatile unsigned int led_n_patterns = 16; volatile const unsigned char * volatile led_patterns = &pattern[0]; @@ -22,38 +22,44 @@ volatile unsigned int led_countmax = 5; volatile unsigned int led_countdown = 0; volatile unsigned int led_px = 0; -int ledrw(struct uio *uio) +int +ledrw(uio) + struct uio *uio; { - unsigned int v[2]; - int s; - unsigned int o; - int err; + unsigned int v[2]; + int s; + unsigned int o; + int err; - if (uio->uio_offset > MAXPVLEN+sizeof(v)) return(0); - s = splhigh(); - v[0] = led_countmax; - v[1] = led_n_patterns; - splx(s); - o = uio->uio_offset; - if (o < sizeof(v)) - { err = uiomove(((caddr_t)&v[0])+o,sizeof(v)-o,uio); - if (err) return(err); - o = sizeof(v); - if (uio->uio_rw == UIO_WRITE) - { if ((v[0] > MAXCDOWN) || (v[1] < 1) || (v[1] > MAXPVLEN)) return(EIO); - s = splhigh(); - led_countmax = v[0]; - led_n_patterns = v[1]; - led_countdown = 0; - led_px = 0; - splx(s); - } - } - o -= sizeof(v); - if (o >= v[1]) return(0); - if (uio->uio_resid > 0) - { err = uiomove((caddr_t)&pattern[o],v[1]-o,uio); - if (err) return(err); - } - return(0); + if (uio->uio_offset > MAXPVLEN+sizeof(v)) + return(0); + s = splhigh(); + v[0] = led_countmax; + v[1] = led_n_patterns; + splx(s); + o = uio->uio_offset; + if (o < sizeof(v)) { + err = uiomove(((caddr_t)&v[0])+o, sizeof(v)-o, uio); + if (err) return(err); + o = sizeof(v); + if (uio->uio_rw == UIO_WRITE) { + if ((v[0] > MAXCDOWN) || + (v[1] < 1) || (v[1] > MAXPVLEN)) + return(EIO); + s = splhigh(); + led_countmax = v[0]; + led_n_patterns = v[1]; + led_countdown = 0; + led_px = 0; + splx(s); + } + } + o -= sizeof(v); + if (o >= v[1]) + return(0); + if (uio->uio_resid > 0) { + err = uiomove((caddr_t)&pattern[o], v[1]-o, uio); + if (err) return(err); + } + return(0); } |