aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pci/maestro3.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/sound/pci/maestro3.c')
-rw-r--r--sys/dev/sound/pci/maestro3.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/dev/sound/pci/maestro3.c b/sys/dev/sound/pci/maestro3.c
index 6dd54a66f683..2d102fcd6dbe 100644
--- a/sys/dev/sound/pci/maestro3.c
+++ b/sys/dev/sound/pci/maestro3.c
@@ -488,7 +488,7 @@ m3_pchan_init(kobj_t kobj, void *devinfo, struct snd_dbuf *b, struct pcm_channel
DMAC_BLOCKF_SELECTOR);
/* set an armload of static initializers */
- for(i = 0 ; i < (sizeof(pv) / sizeof(pv[0])) ; i++) {
+ for(i = 0 ; i < nitems(pv); i++) {
m3_wr_assp_data(sc, ch->dac_data + pv[i].addr, pv[i].val);
}
@@ -862,7 +862,7 @@ m3_rchan_init(kobj_t kobj, void *devinfo, struct snd_dbuf *b, struct pcm_channel
DMAC_PAGE3_SELECTOR + DMAC_BLOCKF_SELECTOR);
/* set an armload of static initializers */
- for(i = 0 ; i < (sizeof(rv) / sizeof(rv[0])) ; i++) {
+ for(i = 0 ; i < nitems(rv); i++) {
m3_wr_assp_data(sc, ch->adc_data + rv[i].addr, rv[i].val);
}
@@ -1423,10 +1423,7 @@ m3_pci_attach(device_t dev)
m3_enable_ints(sc);
- if (pcm_register(dev, sc, dacn, adcn)) {
- device_printf(dev, "pcm_register error\n");
- goto bad;
- }
+ pcm_init(dev, sc);
for (i=0 ; i<dacn ; i++) {
if (pcm_addchan(dev, PCMDIR_PLAY, &m3_pch_class, sc)) {
device_printf(dev, "pcm_addchan (play) error\n");
@@ -1443,8 +1440,8 @@ m3_pci_attach(device_t dev)
(sc->regtype == SYS_RES_IOPORT)? "port" : "mem",
rman_get_start(sc->reg), rman_get_start(sc->irq),
device_get_nameunit(device_get_parent(dev)));
- if (pcm_setstatus(dev, status)) {
- device_printf(dev, "attach: pcm_setstatus error\n");
+ if (pcm_register(dev, status)) {
+ device_printf(dev, "pcm_register error\n");
goto bad;
}
@@ -1453,7 +1450,7 @@ m3_pci_attach(device_t dev)
/* Create the buffer for saving the card state during suspend */
len = sizeof(u_int16_t) * (REV_B_CODE_MEMORY_LENGTH +
REV_B_DATA_MEMORY_LENGTH);
- sc->savemem = (u_int16_t*)malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
+ sc->savemem = malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
return 0;