diff options
author | orion <orion@FreeBSD.org> | 2003-02-21 01:47:59 +0000 |
---|---|---|
committer | orion <orion@FreeBSD.org> | 2003-02-21 01:47:59 +0000 |
commit | f3417fa7ac285f769ac275d962f83e5b4da22394 (patch) | |
tree | 41883c6682d8a7e62ce8fb6d361623df0f2c6976 | |
parent | 453e885c33a6c165e9f20b4ccfa6b78caf96fe70 (diff) | |
download | FreeBSD-src-f3417fa7ac285f769ac275d962f83e5b4da22394.zip FreeBSD-src-f3417fa7ac285f769ac275d962f83e5b4da22394.tar.gz |
Clean up viachan_init.
-rw-r--r-- | sys/dev/sound/pci/via82c686.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/sound/pci/via82c686.c b/sys/dev/sound/pci/via82c686.c index 3638d39..1e0440f 100644 --- a/sys/dev/sound/pci/via82c686.c +++ b/sys/dev/sound/pci/via82c686.c @@ -242,27 +242,31 @@ static void * viachan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir) { struct via_info *via = devinfo; - struct via_chinfo *ch = (dir == PCMDIR_PLAY)? &via->pch : &via->rch; + struct via_chinfo *ch; - ch->parent = via; - ch->channel = c; - ch->buffer = b; - ch->dir = dir; - ch->sgd_table = &via->sgd_table[(dir == PCMDIR_PLAY)? 0 : SEGS_PER_CHAN]; - ch->sgd_addr = dir == PCMDIR_PLAY ? via->sgd_addr : via->sgd_addr + - sizeof(struct via_dma_op) * SEGS_PER_CHAN; - if (ch->dir == PCMDIR_PLAY) { + if (dir == PCMDIR_PLAY) { + ch = &via->pch; ch->base = VIA_PLAY_DMAOPS_BASE; ch->count = VIA_PLAY_DMAOPS_COUNT; ch->ctrl = VIA_PLAY_CONTROL; ch->mode = VIA_PLAY_MODE; + ch->sgd_addr = via->sgd_addr; + ch->sgd_table = &via->sgd_table[0]; } else { + ch = &via->rch; ch->base = VIA_RECORD_DMAOPS_BASE; ch->count = VIA_RECORD_DMAOPS_COUNT; ch->ctrl = VIA_RECORD_CONTROL; ch->mode = VIA_RECORD_MODE; + ch->sgd_addr = via->sgd_addr + sizeof(struct via_dma_op) * SEGS_PER_CHAN; + ch->sgd_table = &via->sgd_table[SEGS_PER_CHAN]; } + ch->parent = via; + ch->channel = c; + ch->buffer = b; + ch->dir = dir; + if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) == -1) return NULL; return ch; |