From owner-svn-src-all@FreeBSD.ORG Sun Jan 25 09:20:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68B891065690; Sun, 25 Jan 2009 09:20:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 570A08FC29; Sun, 25 Jan 2009 09:20:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0P9KxeO011926; Sun, 25 Jan 2009 09:20:59 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0P9Kxco011925; Sun, 25 Jan 2009 09:20:59 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901250920.n0P9Kxco011925@svn.freebsd.org> From: Ed Schouten Date: Sun, 25 Jan 2009 09:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187683 - head/sys/dev/speaker X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 09:21:00 -0000 Author: ed Date: Sun Jan 25 09:20:59 2009 New Revision: 187683 URL: http://svn.freebsd.org/changeset/base/187683 Log: 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(). Modified: head/sys/dev/speaker/spkr.c Modified: head/sys/dev/speaker/spkr.c ============================================================================== --- head/sys/dev/speaker/spkr.c Sun Jan 25 09:17:16 2009 (r187682) +++ head/sys/dev/speaker/spkr.c Sun Jan 25 09:20:59 2009 (r187683) @@ -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)