Module Name:    src
Committed By:   christos
Date:           Fri Dec  9 13:16:22 UTC 2016

Modified Files:
        src/sys/dev: audiobell.c audiobellvar.h spkr_synth.c

Log Message:
minor cleanups (no functional change)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/audiobell.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/audiobellvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/spkr_synth.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audiobell.c
diff -u src/sys/dev/audiobell.c:1.9 src/sys/dev/audiobell.c:1.10
--- src/sys/dev/audiobell.c:1.9	Thu Dec  8 06:31:08 2016
+++ src/sys/dev/audiobell.c	Fri Dec  9 08:16:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiobell.c,v 1.9 2016/12/08 11:31:08 nat Exp $	*/
+/*	$NetBSD: audiobell.c,v 1.10 2016/12/09 13:16:22 christos Exp $	*/
 
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/types.h>
-__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.9 2016/12/08 11:31:08 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.10 2016/12/09 13:16:22 christos Exp $");
 
 #include <sys/audioio.h>
 #include <sys/conf.h>
@@ -137,24 +137,23 @@ audiobell_synthesize(uint8_t *buf, u_int
 }
 
 void
-audiobell(int arg, u_int pitch, u_int period, u_int volume, int poll)
+audiobell(int unit, u_int pitch, u_int period, u_int volume, int poll)
 {
-	dev_t audio = arg;
 	uint8_t *buf;
 	struct audio_info ai;
 	struct uio auio;
 	struct iovec aiov;
 	int size, len, offset;
+	dev_t audio = (dev_t)(AUDIO_DEVICE | unit);
 
 	/* The audio system isn't built for polling. */
 	if (poll) return;
 
 	/* If not configured, we can't beep. */
-	if (audioopen(AUDIO_DEVICE | audio, FWRITE, 0, NULL) != 0)
+	if (audioopen(audio, FWRITE, 0, NULL) != 0)
 		return;
 
-	if (audioioctl((dev_t)(AUDIO_DEVICE | audio),
-	    AUDIO_GETINFO, &ai, 0, NULL) != 0)
+	if (audioioctl(audio, AUDIO_GETINFO, &ai, 0, NULL) != 0)
 		return;
 
 	buf = NULL;
@@ -180,11 +179,11 @@ audiobell(int arg, u_int pitch, u_int pe
 		auio.uio_rw = UIO_WRITE;
 		UIO_SETUP_SYSSPACE(&auio);
 
-		audiowrite(AUDIO_DEVICE | audio, &auio, 0);
+		audiowrite(audio, &auio, 0);
 		len -= size;
 		offset += size;
 	}
 out:
 	if (buf != NULL) free(buf, M_TEMP);
-	audioclose(AUDIO_DEVICE | audio, FWRITE, 0, NULL);
+	audioclose(audio, FWRITE, 0, NULL);
 }

Index: src/sys/dev/audiobellvar.h
diff -u src/sys/dev/audiobellvar.h:1.7 src/sys/dev/audiobellvar.h:1.8
--- src/sys/dev/audiobellvar.h:1.7	Thu Dec  8 06:31:08 2016
+++ src/sys/dev/audiobellvar.h	Fri Dec  9 08:16:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiobellvar.h,v 1.7 2016/12/08 11:31:08 nat Exp $	*/
+/*	$NetBSD: audiobellvar.h,v 1.8 2016/12/09 13:16:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004 Ben Harris
@@ -38,4 +38,4 @@
  * This function is designed to be passed to pckbd_hookup_bell() and
  * equivalents.
  */
-extern void audiobell(int, u_int, u_int, u_int, int);
+void audiobell(int, u_int, u_int, u_int, int);

Index: src/sys/dev/spkr_synth.c
diff -u src/sys/dev/spkr_synth.c:1.3 src/sys/dev/spkr_synth.c:1.4
--- src/sys/dev/spkr_synth.c:1.3	Fri Dec  9 00:17:03 2016
+++ src/sys/dev/spkr_synth.c	Fri Dec  9 08:16:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr_synth.c,v 1.3 2016/12/09 05:17:03 christos Exp $	*/
+/*	$NetBSD: spkr_synth.c,v 1.4 2016/12/09 13:16:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr_synth.c,v 1.3 2016/12/09 05:17:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr_synth.c,v 1.4 2016/12/09 13:16:22 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -83,7 +83,7 @@ CFATTACH_DECL3_NEW(spkr_synth, 0,
 extern struct cfdriver audio_cd;
 
 static struct sysctllog	*spkr_sc_log;	/* sysctl log */
-static int beep_index = 0;
+static int beep_unit = 0;
 
 struct vbell_args sc_bell_args;
 lwp_t		*sc_bellthread;
@@ -97,7 +97,7 @@ struct spkr_attach_args {
 void
 spkr_tone(u_int xhz, u_int ticks)
 {
-	audiobell(beep_index, xhz, ticks * (1000 / hz), 80, 0);
+	audiobell(beep_unit, xhz, ticks * (1000 / hz), 80, 0);
 }
 
 void
@@ -107,7 +107,7 @@ spkr_rest(int ticks)
     printf("%s: %d\n", __func__, ticks);
 #endif /* SPKRDEBUG */
     if (ticks > 0)
-	audiobell(beep_index, 0, ticks * (1000 / hz), 80, 0);
+	audiobell(beep_unit, 0, ticks * (1000 / hz), 80, 0);
 }
 
 device_t
@@ -124,7 +124,7 @@ spkrattach(device_t parent, device_t sel
 	const struct sysctlnode *node;
 
 	printf("\n");
-	beep_index = 0;
+	beep_unit = 0;
 	spkr_attached = 1;
 	
 	if (!pmf_device_register(self, NULL, NULL))
@@ -202,14 +202,14 @@ bell_thread(void *arg)
 		bperiod = vb->period;
 		bvolume = vb->volume;
 		mutex_exit(&sc_bellock);
-		audiobell(beep_index, bpitch, bperiod, bvolume, 0);
+		audiobell(beep_unit, bpitch, bperiod, bvolume, 0);
 	}
 }
 
 void
 speaker_play(u_int pitch, u_int period, u_int volume)
 {
-	if (spkr_attached == 0 || beep_index == -1)
+	if (spkr_attached == 0 || beep_unit == -1)
 		return;
 
 	mutex_enter(&sc_bellock);
@@ -232,7 +232,7 @@ beep_sysctl_device(SYSCTLFN_ARGS)
 
 	node = *rnode;
 
-	t = beep_index;
+	t = beep_unit;
 	node.sysctl_data = &t;
 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
 	if (error || newp == NULL)
@@ -243,7 +243,7 @@ beep_sysctl_device(SYSCTLFN_ARGS)
 	    NULL))
 		return EINVAL;
 
-	beep_index = t;
+	beep_unit = t;
 
 	return error;
 }

Reply via email to