summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-06-02 05:03:19 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-06-02 05:03:19 +0000
commit14afc40f4a23e63d14062ad04db0d0bd50006a7c (patch)
treee711e834775403497206ba0ab6ba544909b4736f
parentf7363d73c96f7d1b4a383a4ad299f1b362bc31a3 (diff)
knf, spaces, no \n in panic
-rw-r--r--sys/dev/pci/auvia.c103
1 files changed, 46 insertions, 57 deletions
diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c
index de0afe759a6..ce7a55a2014 100644
--- a/sys/dev/pci/auvia.c
+++ b/sys/dev/pci/auvia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auvia.c,v 1.18 2002/05/31 20:28:38 mickey Exp $ */
+/* $OpenBSD: auvia.c,v 1.19 2002/06/02 05:03:18 mickey Exp $ */
/* $NetBSD: auvia.c,v 1.7 2000/11/15 21:06:33 jdolecek Exp $ */
/*-
@@ -153,14 +153,14 @@ struct cfattach auvia_ca = {
#define AUVIA_RPMODE_AUTOSTART 0x80
#define AUVIA_RP_DMAOPS_BASE 0x04
-#define VIA8233_RP_DXS_LVOL 0x02
-#define VIA8233_RP_DXS_RVOL 0x03
-#define VIA8233_RP_RATEFMT 0x08
+#define VIA8233_RP_DXS_LVOL 0x02
+#define VIA8233_RP_DXS_RVOL 0x03
+#define VIA8233_RP_RATEFMT 0x08
#define VIA8233_RATEFMT_48K 0xfffff
#define VIA8233_RATEFMT_STEREO 0x00100000
#define VIA8233_RATEFMT_16BIT 0x00200000
-#define VIA_RP_DMAOPS_COUNT 0x0C
+#define VIA_RP_DMAOPS_COUNT 0x0C
#define AUVIA_CODEC_CTL 0x80
#define AUVIA_CODEC_READ 0x00800000
@@ -215,7 +215,7 @@ auvia_match(struct device *parent, void *match, void *aux)
if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_VIATECH)
return 0;
- switch(PCI_PRODUCT(pa->pa_id)) {
+ switch(PCI_PRODUCT(pa->pa_id)) {
case PCI_PRODUCT_VIATECH_VT82C686A_AC97:
return 1;
case PCI_PRODUCT_VIATECH_VT8233_AC97:
@@ -279,8 +279,8 @@ auvia_attach(struct device *parent, struct device *self, void *aux)
pr &= ~AUVIA_PCICONF_ENABLES; /* clear compat function enables */
/* XXX what to do about MIDI, FM, joystick? */
- pr |= (AUVIA_PCICONF_ACLINKENAB | AUVIA_PCICONF_ACNOTRST
- | AUVIA_PCICONF_ACVSR | AUVIA_PCICONF_ACSGD);
+ pr |= (AUVIA_PCICONF_ACLINKENAB | AUVIA_PCICONF_ACNOTRST |
+ AUVIA_PCICONF_ACVSR | AUVIA_PCICONF_ACSGD);
pr &= ~(AUVIA_PCICONF_ACFM | AUVIA_PCICONF_ACSB);
@@ -294,7 +294,7 @@ auvia_attach(struct device *parent, struct device *self, void *aux)
if ((r = ac97_attach(&sc->host_if)) != 0) {
printf("%s: can't attach codec (error 0x%X)\n",
- sc->sc_dev.dv_xname, r);
+ sc->sc_dev.dv_xname, r);
pci_intr_disestablish(pc, sc->sc_ih);
bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize);
return;
@@ -315,7 +315,7 @@ auvia_attach(struct device *parent, struct device *self, void *aux)
ctl.un.ord = 0;
ctl.dev = sc->codec_if->vtbl->get_portnum_by_name(sc->codec_if,
- d[i].class, d[i].device, AudioNmute);
+ d[i].class, d[i].device, AudioNmute);
auvia_set_port(sc, &ctl);
}
@@ -327,7 +327,7 @@ auvia_attach(struct device *parent, struct device *self, void *aux)
ctl.un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = 199;
ctl.dev = sc->codec_if->vtbl->get_portnum_by_name(sc->codec_if,
- AudioCoutputs, AudioNmaster, NULL);
+ AudioCoutputs, AudioNmaster, NULL);
auvia_set_port(sc, &ctl);
audio_attach_mi(&auvia_hw_if, sc, &sc->sc_dev);
@@ -360,7 +360,7 @@ auvia_reset_codec(void *addr)
pci_conf_write(sc->sc_pc, sc->sc_pt, AUVIA_PCICONF_JUNK, r);
delay(2);
- r |= AUVIA_PCICONF_ACNOTRST; /* disable RESET (inactive high) */
+ r |= AUVIA_PCICONF_ACNOTRST; /* disable RESET (inactive high) */
pci_conf_write(sc->sc_pc, sc->sc_pt, AUVIA_PCICONF_JUNK, r);
delay(200);
@@ -376,8 +376,9 @@ auvia_waitready_codec(struct auvia_softc *sc)
/* poll until codec not busy */
for (i = 0; (i < TIMEOUT) && (bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- AUVIA_CODEC_CTL) & AUVIA_CODEC_BUSY); i++)
+ AUVIA_CODEC_CTL) & AUVIA_CODEC_BUSY); i++)
delay(1);
+
if (i >= TIMEOUT) {
printf("%s: codec busy\n", sc->sc_dev.dv_xname);
return 1;
@@ -394,8 +395,9 @@ auvia_waitvalid_codec(struct auvia_softc *sc)
/* poll until codec valid */
for (i = 0; (i < TIMEOUT) && !(bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- AUVIA_CODEC_CTL) & AUVIA_CODEC_PRIVALID); i++)
- delay(1);
+ AUVIA_CODEC_CTL) & AUVIA_CODEC_PRIVALID); i++)
+ delay(1);
+
if (i >= TIMEOUT) {
printf("%s: codec invalid\n", sc->sc_dev.dv_xname);
return 1;
@@ -414,7 +416,7 @@ auvia_write_codec(void *addr, u_int8_t reg, u_int16_t val)
return 1;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, AUVIA_CODEC_CTL,
- AUVIA_CODEC_PRIVALID | AUVIA_CODEC_INDEX(reg) | val);
+ AUVIA_CODEC_PRIVALID | AUVIA_CODEC_INDEX(reg) | val);
return 0;
}
@@ -429,7 +431,7 @@ auvia_read_codec(void *addr, u_int8_t reg, u_int16_t *val)
return 1;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, AUVIA_CODEC_CTL,
- AUVIA_CODEC_PRIVALID | AUVIA_CODEC_READ | AUVIA_CODEC_INDEX(reg));
+ AUVIA_CODEC_PRIVALID | AUVIA_CODEC_READ | AUVIA_CODEC_INDEX(reg));
if (auvia_waitready_codec(sc))
return 1;
@@ -523,7 +525,7 @@ auvia_query_encoding(void *addr, struct audio_encoding *fp)
int
auvia_set_params(void *addr, int setmode, int usemode,
- struct audio_params *play, struct audio_params *rec)
+ struct audio_params *play, struct audio_params *rec)
{
struct auvia_softc *sc = addr;
struct audio_params *p;
@@ -582,12 +584,10 @@ auvia_set_params(void *addr, int setmode, int usemode,
p->sw_code = change_sign8;
break;
case AUDIO_ENCODING_ULINEAR_BE:
- if (p->precision == 16) {
- if (mode == AUMODE_PLAY)
- p->sw_code = swap_bytes_change_sign16_le;
- else
- p->sw_code = change_sign16_swap_bytes_le;
- }
+ if (p->precision == 16)
+ p->sw_code = mode == AUMODE_PLAY?
+ swap_bytes_change_sign16_le :
+ change_sign16_swap_bytes_le;
break;
case AUDIO_ENCODING_ULINEAR_LE:
if (p->precision == 16)
@@ -617,11 +617,10 @@ auvia_set_params(void *addr, int setmode, int usemode,
| AUVIA_RPMODE_INTR_FLAG | AUVIA_RPMODE_INTR_EOL
| AUVIA_RPMODE_AUTOSTART;
- if (mode == AUMODE_PLAY) {
+ if (mode == AUMODE_PLAY)
sc->sc_play.sc_reg = regval;
- } else {
+ else
sc->sc_record.sc_reg = regval;
- }
}
return 0;
@@ -814,14 +813,14 @@ auvia_mappage(void *addr, void *mem, off_t off, int prot)
int
auvia_get_props(void *addr)
{
- return AUDIO_PROP_MMAP | AUDIO_PROP_INDEPENDENT
- | AUDIO_PROP_FULLDUPLEX;
+ return (AUDIO_PROP_MMAP | AUDIO_PROP_INDEPENDENT |
+ AUDIO_PROP_FULLDUPLEX);
}
int
auvia_build_dma_ops(struct auvia_softc *sc, struct auvia_softc_chan *ch,
- struct auvia_dma *p, void *start, void *end, int blksize)
+ struct auvia_dma *p, void *start, void *end, int blksize)
{
struct auvia_dma_op *op;
struct auvia_dma *dp;
@@ -836,22 +835,20 @@ auvia_build_dma_ops(struct auvia_softc *sc, struct auvia_softc_chan *ch,
if (segs > (ch->sc_dma_op_count)) {
/* if old list was too small, free it */
- if (ch->sc_dma_ops) {
+ if (ch->sc_dma_ops)
auvia_free(sc, ch->sc_dma_ops, M_DEVBUF);
- }
ch->sc_dma_ops = auvia_malloc(sc, 0,
- sizeof(struct auvia_dma_op) * segs, M_DEVBUF, M_WAITOK);
+ sizeof(struct auvia_dma_op) * segs, M_DEVBUF, M_WAITOK);
- for (dp = sc->sc_dmas;
- dp && dp->addr != (void *)(ch->sc_dma_ops);
- dp = dp->next)
- ;
+ for (dp = sc->sc_dmas; dp &&
+ dp->addr != (void *)(ch->sc_dma_ops); dp = dp->next)
+ ;
if (!dp)
panic("%s: build_dma_ops: where'd my memory go??? "
- "address (%p)\n", sc->sc_dev.dv_xname,
- ch->sc_dma_ops);
+ "address (%p)", sc->sc_dev.dv_xname,
+ ch->sc_dma_ops);
ch->sc_dma_op_count = segs;
ch->sc_dma_ops_dma = dp;
@@ -863,12 +860,8 @@ auvia_build_dma_ops(struct auvia_softc *sc, struct auvia_softc_chan *ch,
while (l) {
op->ptr = s;
l = l - blksize;
- if (!l) {
- /* if last block */
- op->flags = AUVIA_DMAOP_EOL | blksize;
- } else {
- op->flags = AUVIA_DMAOP_FLAG | blksize;
- }
+ /* if last block */
+ op->flags = (l? AUVIA_DMAOP_FLAG : AUVIA_DMAOP_EOL) | blksize;
s += blksize;
op++;
}
@@ -878,9 +871,8 @@ auvia_build_dma_ops(struct auvia_softc *sc, struct auvia_softc_chan *ch,
int
-auvia_trigger_output(void *addr, void *start, void *end,
- int blksize, void (*intr)(void *), void *arg,
- struct audio_params *param)
+auvia_trigger_output(void *addr, void *start, void *end, int blksize,
+ void (*intr)(void *), void *arg, struct audio_params *param)
{
struct auvia_softc *sc = addr;
struct auvia_softc_chan *ch = &(sc->sc_play);
@@ -891,7 +883,7 @@ auvia_trigger_output(void *addr, void *start, void *end,
if (!p)
panic("auvia_trigger_output: request with bad start "
- "address (%p)\n", start);
+ "address (%p)", start);
if (auvia_build_dma_ops(sc, ch, p, start, end, blksize)) {
return 1;
@@ -925,9 +917,8 @@ auvia_trigger_output(void *addr, void *start, void *end,
int
-auvia_trigger_input(void *addr, void *start, void *end,
- int blksize, void (*intr)(void *), void *arg,
- struct audio_params *param)
+auvia_trigger_input(void *addr, void *start, void *end, int blksize,
+ void (*intr)(void *), void *arg, struct audio_params *param)
{
struct auvia_softc *sc = addr;
struct auvia_softc_chan *ch = &(sc->sc_record);
@@ -938,11 +929,10 @@ auvia_trigger_input(void *addr, void *start, void *end,
if (!p)
panic("auvia_trigger_input: request with bad start "
- "address (%p)\n", start);
+ "address (%p)", start);
- if (auvia_build_dma_ops(sc, ch, p, start, end, blksize)) {
+ if (auvia_build_dma_ops(sc, ch, p, start, end, blksize))
return 1;
- }
ch->sc_intr = intr;
ch->sc_arg = arg;
@@ -951,8 +941,7 @@ auvia_trigger_input(void *addr, void *start, void *end,
AUVIA_RECORD_BASE + AUVIA_RP_DMAOPS_BASE,
ch->sc_dma_ops_dma->map->dm_segs[0].ds_addr);
bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- AUVIA_RECORD_BASE + AUVIA_RP_MODE,
- ch->sc_reg);
+ AUVIA_RECORD_BASE + AUVIA_RP_MODE, ch->sc_reg);
if (sc->sc_flags & AUVIA_FLAGS_VT8233) {
bus_space_write_1(sc->sc_iot, sc->sc_ioh,