From c711558a51f695366b24817d2b02e6458b4c3e69 Mon Sep 17 00:00:00 2001 From: kstailey Date: Mon, 13 Jan 1997 21:28:24 +0000 Subject: [PATCH] reformatted ala KNF --- sys/arch/sun3/sun3/leds.c | 80 +++++++++++++++++++++------------------ 1 file 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 #include @@ -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); } -- 2.20.1