summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/pcaudio.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit1900eea896e2aaeae8a9fa8affa5fded2068c9b4 (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/i386/isa/pcaudio.c
parentaaf9d7f10ecc63adae1dc4f55cfd31a2926c605a (diff)
downloadFreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.zip
FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.tar.gz
Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter) If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :) pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
Diffstat (limited to 'sys/i386/isa/pcaudio.c')
-rw-r--r--sys/i386/isa/pcaudio.c58
1 files changed, 27 insertions, 31 deletions
diff --git a/sys/i386/isa/pcaudio.c b/sys/i386/isa/pcaudio.c
index 7a285ea1..d0bb085 100644
--- a/sys/i386/isa/pcaudio.c
+++ b/sys/i386/isa/pcaudio.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pcaudio.c,v 1.20 1995/11/30 05:58:53 julian Exp $
+ * $Id: pcaudio.c,v 1.21 1995/12/01 23:09:20 julian Exp $
*/
#include "pca.h"
@@ -39,6 +39,7 @@
#include <sys/file.h>
#include <sys/proc.h>
#include <sys/devconf.h>
+#include <sys/kernel.h>
#include <machine/clock.h>
#include <machine/pcaudioio.h>
@@ -52,11 +53,6 @@
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /* DEVFS */
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#endif /* JREMOD */
-#define CDEV_MAJOR 24
#define BUF_SIZE 8192
#define SAMPLE_RATE 8000
@@ -85,6 +81,8 @@ static char buffer1[BUF_SIZE];
static char buffer2[BUF_SIZE];
static char volume_table[256];
+static void *pca_devfs_token;
+static void *pcac_devfs_token;
static int pca_sleep = 0;
static int pca_initialized = 0;
@@ -96,6 +94,18 @@ struct isa_driver pcadriver = {
pcaprobe, pcaattach, "pca",
};
+static d_open_t pcaopen;
+static d_close_t pcaclose;
+static d_write_t pcawrite;
+static d_ioctl_t pcaioctl;
+static d_select_t pcaselect;
+
+#define CDEV_MAJOR 24
+struct cdevsw pca_cdevsw =
+ { pcaopen, pcaclose, noread, pcawrite, /*24*/
+ pcaioctl, nostop, nullreset, nodevtotty,/* pcaudio */
+ pcaselect, nommap, NULL, "pca", NULL, -1 };
+
inline void conv(const void *table, void *buff, unsigned long n)
{
@@ -250,17 +260,6 @@ pca_registerdev(struct isa_device *id)
dev_attach(&kdc_pca[id->id_unit]);
}
-#ifdef DEVFS
-
-void pcadevfs_init(caddr_t data) /* data not used */
-{
- void * x;
-/* path name devsw minor type uid gid perm*/
- x=devfs_add_devsw("/", "pcaudio", CDEV_MAJOR, 0, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/", "pcaudioctl", CDEV_MAJOR, 128, DV_CHR, 0, 0, 0666);
-}
-#endif /*DEVFS*/
-
int
pcaattach(struct isa_device *dvp)
@@ -269,14 +268,18 @@ pcaattach(struct isa_device *dvp)
pca_init();
pca_registerdev(dvp);
#ifdef DEVFS
- pcadevfs_init(NULL);
+/* path name devsw minor type uid gid perm*/
+ pca_devfs_token = devfs_add_devsw("/", "pcaudio", &pca_cdevsw, 0,
+ DV_CHR, 0, 0, 0666);
+ pcac_devfs_token = devfs_add_devsw("/", "pcaudioctl", &pca_cdevsw, 128,
+ DV_CHR, 0, 0, 0666);
#endif /*DEVFS*/
return 1;
}
-int
+static int
pcaopen(dev_t dev, int flags, int fmt, struct proc *p)
{
/* audioctl device can always be opened */
@@ -304,7 +307,7 @@ pcaopen(dev_t dev, int flags, int fmt, struct proc *p)
}
-int
+static int
pcaclose(dev_t dev, int flags, int fmt, struct proc *p)
{
/* audioctl device can always be closed */
@@ -320,7 +323,7 @@ pcaclose(dev_t dev, int flags, int fmt, struct proc *p)
}
-int
+static int
pcawrite(dev_t dev, struct uio *uio, int flag)
{
int count, error, which;
@@ -364,7 +367,7 @@ pcawrite(dev_t dev, struct uio *uio, int flag)
}
-int
+static int
pcaioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
audio_info_t *auptr;
@@ -487,12 +490,6 @@ pcaselect(dev_t dev, int rw, struct proc *p)
}
}
-#ifdef JREMOD
-struct cdevsw pca_cdevsw =
- { pcaopen, pcaclose, noread, pcawrite, /*24*/
- pcaioctl, nostop, nullreset, nodevtotty,/* pcaudio */
- pcaselect, nommap, NULL };
-
static pca_devsw_installed = 0;
static void pca_drvinit(void *unused)
@@ -500,14 +497,13 @@ static void pca_drvinit(void *unused)
dev_t dev;
if( ! pca_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&pca_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&pca_cdevsw, NULL);
pca_devsw_installed = 1;
}
}
SYSINIT(pcadev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,pca_drvinit,NULL)
-#endif /* JREMOD */
#endif
OpenPOWER on IntegriCloud