summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2009-12-04 20:38:44 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2009-12-04 20:38:44 +0000
commitc8bbf87ce742472bb08bf1a2a223ec2a1dfe0979 (patch)
tree1f2a0f9f497d58b4459b82abe2269a354499f407 /sys/dev/usb
parentde35bb790b6d269adb4a65e00fb9aa25056056c2 (diff)
instead of returning a structure, return the only member of the
structure that will be used. discussed with deraadt.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uaudio.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index fba633e7c8f..038687ee64c 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uaudio.c,v 1.71 2009/12/04 08:17:39 ratchov Exp $ */
+/* $OpenBSD: uaudio.c,v 1.72 2009/12/04 20:38:43 jakemsr Exp $ */
/* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */
/*
@@ -230,7 +230,7 @@ const usb_interface_descriptor_t *uaudio_find_iface
void uaudio_mixer_add_ctl(struct uaudio_softc *, struct mixerctl *);
char *uaudio_id_name
(struct uaudio_softc *, const struct io_terminal *, int);
-struct usb_audio_cluster uaudio_get_cluster
+uByte uaudio_get_cluster_nchan
(int, const struct io_terminal *);
void uaudio_add_input
(struct uaudio_softc *, const struct io_terminal *, int);
@@ -669,8 +669,8 @@ uaudio_id_name(struct uaudio_softc *sc, const struct io_terminal *iot, int id)
return (buf);
}
-struct usb_audio_cluster
-uaudio_get_cluster(int id, const struct io_terminal *iot)
+uByte
+uaudio_get_cluster_nchan(int id, const struct io_terminal *iot)
{
struct usb_audio_cluster r;
const usb_descriptor_t *dp;
@@ -682,17 +682,14 @@ uaudio_get_cluster(int id, const struct io_terminal *iot)
goto bad;
switch (dp->bDescriptorSubtype) {
case UDESCSUB_AC_INPUT:
- r.bNrChannels = iot[id].d.it->bNrChannels;
- USETW(r.wChannelConfig, UGETW(iot[id].d.it->wChannelConfig));
- r.iChannelNames = iot[id].d.it->iChannelNames;
- return (r);
+ return (iot[id].d.it->bNrChannels);
case UDESCSUB_AC_OUTPUT:
id = iot[id].d.ot->bSourceId;
break;
case UDESCSUB_AC_MIXER:
r = *(struct usb_audio_cluster *)
&iot[id].d.mu->baSourceId[iot[id].d.mu->bNrInPins];
- return (r);
+ return (r.bNrChannels);
case UDESCSUB_AC_SELECTOR:
/* XXX This is not really right */
id = iot[id].d.su->baSourceId[0];
@@ -703,20 +700,18 @@ uaudio_get_cluster(int id, const struct io_terminal *iot)
case UDESCSUB_AC_PROCESSING:
r = *(struct usb_audio_cluster *)
&iot[id].d.pu->baSourceId[iot[id].d.pu->bNrInPins];
- return (r);
+ return (r.bNrChannels);
case UDESCSUB_AC_EXTENSION:
r = *(struct usb_audio_cluster *)
&iot[id].d.eu->baSourceId[iot[id].d.eu->bNrInPins];
- return (r);
+ return (r.bNrChannels);
default:
goto bad;
}
}
- bad:
- printf("uaudio_get_cluster: bad data\n");
- memset(&r, 0, sizeof r);
- return (r);
-
+bad:
+ printf("uaudio_get_cluster_nchan: bad data\n");
+ return (0);
}
void
@@ -762,7 +757,7 @@ uaudio_add_mixer(struct uaudio_softc *sc, const struct io_terminal *iot, int id)
/* Compute the number of input channels */
ichs = 0;
for (i = 0; i < d->bNrInPins; i++)
- ichs += uaudio_get_cluster(d->baSourceId[i], iot).bNrChannels;
+ ichs += uaudio_get_cluster_nchan(d->baSourceId[i], iot);
/* and the number of output channels */
d1 = (struct usb_audio_mixer_unit_1 *)&d->baSourceId[d->bNrInPins];
@@ -776,7 +771,7 @@ uaudio_add_mixer(struct uaudio_softc *sc, const struct io_terminal *iot, int id)
mix.ctlunit = AudioNvolume;
#define BIT(bno) ((bm[bno / 8] >> (7 - bno % 8)) & 1)
for (p = i = 0; i < d->bNrInPins; i++) {
- chs = uaudio_get_cluster(d->baSourceId[i], iot).bNrChannels;
+ chs = uaudio_get_cluster_nchan(d->baSourceId[i], iot);
mc = 0;
for (c = 0; c < chs; c++) {
mo = 0;