diff options
author | ed <ed@FreeBSD.org> | 2009-01-25 09:20:59 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-01-25 09:20:59 +0000 |
commit | 7102d2b52f842820300cfa86e6b6be6cc887c6bf (patch) | |
tree | 44f0195e026a01fa66a367f8b019ca89fa516cfc | |
parent | dcd94957aa0fa1d6680b35197d2741a70eec9e37 (diff) | |
download | FreeBSD-src-7102d2b52f842820300cfa86e6b6be6cc887c6bf.zip FreeBSD-src-7102d2b52f842820300cfa86e6b6be6cc887c6bf.tar.gz |
Remove unneeded checks of device unit number from speaker(4).
Calls on the cdev can only be made on existing devices. This means we
don't have to check the value of dev2unit().
-rw-r--r-- | sys/dev/speaker/spkr.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index 8d2ceed..66fd302 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -419,9 +419,7 @@ spkropen(dev, flags, fmt, td) (void) printf("spkropen: entering with dev = %s\n", devtoname(dev)); #endif /* DEBUG */ - if (dev2unit(dev) != 0) - return(ENXIO); - else if (spkr_active) + if (spkr_active) return(EBUSY); else { #ifdef DEBUG @@ -444,9 +442,8 @@ spkrwrite(dev, uio, ioflag) printf("spkrwrite: entering with dev = %s, count = %d\n", devtoname(dev), uio->uio_resid); #endif /* DEBUG */ - if (dev2unit(dev) != 0) - return(ENXIO); - else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */ + + if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */ return(E2BIG); else { unsigned n; @@ -475,15 +472,11 @@ spkrclose(dev, flags, fmt, td) (void) printf("spkrclose: entering with dev = %s\n", devtoname(dev)); #endif /* DEBUG */ - if (dev2unit(dev) != 0) - return(ENXIO); - else { - wakeup(&endtone); - wakeup(&endrest); - free(spkr_inbuf, M_SPKR); - spkr_active = FALSE; - return(0); - } + wakeup(&endtone); + wakeup(&endrest); + free(spkr_inbuf, M_SPKR); + spkr_active = FALSE; + return(0); } static int @@ -499,9 +492,7 @@ spkrioctl(dev, cmd, cmdarg, flags, td) devtoname(dev), cmd); #endif /* DEBUG */ - if (dev2unit(dev) != 0) - return(ENXIO); - else if (cmd == SPKRTONE) { + if (cmd == SPKRTONE) { tone_t *tp = (tone_t *)cmdarg; if (tp->frequency == 0) |