Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev minor cleanups (no functional change)
details: https://anonhg.NetBSD.org/src/rev/639e0be9b81f
branches: trunk
changeset: 349390:639e0be9b81f
user: christos <christos%NetBSD.org@localhost>
date: Fri Dec 09 13:16:22 2016 +0000
description:
minor cleanups (no functional change)
diffstat:
sys/dev/audiobell.c | 17 ++++++++---------
sys/dev/audiobellvar.h | 4 ++--
sys/dev/spkr_synth.c | 20 ++++++++++----------
3 files changed, 20 insertions(+), 21 deletions(-)
diffs (165 lines):
diff -r 1a2cd5435395 -r 639e0be9b81f sys/dev/audiobell.c
--- a/sys/dev/audiobell.c Fri Dec 09 13:06:41 2016 +0000
+++ b/sys/dev/audiobell.c Fri Dec 09 13:16:22 2016 +0000
@@ -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 @@
}
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 @@
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);
}
diff -r 1a2cd5435395 -r 639e0be9b81f sys/dev/audiobellvar.h
--- a/sys/dev/audiobellvar.h Fri Dec 09 13:06:41 2016 +0000
+++ b/sys/dev/audiobellvar.h Fri Dec 09 13:16:22 2016 +0000
@@ -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);
diff -r 1a2cd5435395 -r 639e0be9b81f sys/dev/spkr_synth.c
--- a/sys/dev/spkr_synth.c Fri Dec 09 13:06:41 2016 +0000
+++ b/sys/dev/spkr_synth.c Fri Dec 09 13:16:22 2016 +0000
@@ -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 <nathanialsloss%yahoo.com.au@localhost>
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
NULL))
return EINVAL;
- beep_index = t;
+ beep_unit = t;
return error;
}
Home |
Main Index |
Thread Index |
Old Index