From: Takashi Iwai Date: Mon, 16 Feb 2009 22:03:57 +0000 (+0100) Subject: Merge branch 'topic/snd_card_new-err' into topic/cs423x-merge X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=96cf45cf559be375de29dd45afc50fa8946fb2aa;hp=-c;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git Merge branch 'topic/snd_card_new-err' into topic/cs423x-merge --- 96cf45cf559be375de29dd45afc50fa8946fb2aa diff --combined sound/isa/ad1816a/ad1816a.c index 15f60107a11e,9660e598232c..bbcbf92a8ebe --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@@ -156,11 -156,11 +156,12 @@@ static int __devinit snd_card_ad1816a_p struct snd_card_ad1816a *acard; struct snd_ad1816a *chip; struct snd_opl3 *opl3; + struct snd_timer *timer; - if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_card_ad1816a))) == NULL) - return -ENOMEM; + error = snd_card_create(index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_card_ad1816a), &card); + if (error < 0) + return error; acard = (struct snd_card_ad1816a *)card->private_data; if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { @@@ -195,12 -195,6 +196,12 @@@ return error; } + error = snd_ad1816a_timer(chip, 0, &timer); + if (error < 0) { + snd_card_free(card); + return error; + } + if (mpu_port[dev] > 0) { if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, mpu_port[dev], 0, mpu_irq[dev], IRQF_DISABLED, @@@ -214,8 -208,11 +215,8 @@@ OPL3_HW_AUTO, 0, &opl3) < 0) { printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx.\n", fm_port[dev], fm_port[dev] + 2); } else { - if ((error = snd_opl3_timer_new(opl3, 1, 2)) < 0) { - snd_card_free(card); - return error; - } - if ((error = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { + error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); + if (error < 0) { snd_card_free(card); return error; } diff --combined sound/isa/cmi8330.c index 9ca8122f7ba2,24e60902f8ca..de83608719ea --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@@ -31,11 -31,11 +31,11 @@@ * To quickly load the module, * * modprobe -a snd-cmi8330 sbport=0x220 sbirq=5 sbdma8=1 - * sbdma16=5 wssport=0x530 wssirq=11 wssdma=0 + * sbdma16=5 wssport=0x530 wssirq=11 wssdma=0 fmport=0x388 * * This card has two mixers and two PCM devices. I've cheesed it such * that recording and playback can be done through the same device. - * The driver "magically" routes the capturing to the AD1848 codec, + * The driver "magically" routes the capturing to the CMI8330 codec, * and playback to the SB16 codec. This allows for full-duplex mode * to some extent. * The utilities in alsa-utils are aware of both devices, so passing @@@ -51,8 -51,6 +51,8 @@@ #include #include #include +#include +#include #include #include @@@ -81,9 -79,6 +81,9 @@@ static int sbdma16[SNDRV_CARDS] = SNDRV static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; +static long fmport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static long mpuport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static int mpuirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard."); @@@ -112,12 -107,6 +112,12 @@@ MODULE_PARM_DESC(wssirq, "IRQ # for CMI module_param_array(wssdma, int, NULL, 0444); MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); +module_param_array(fmport, long, NULL, 0444); +MODULE_PARM_DESC(fmport, "FM port # for CMI8330 driver."); +module_param_array(mpuport, long, NULL, 0444); +MODULE_PARM_DESC(mpuport, "MPU-401 port # for CMI8330 driver."); +module_param_array(mpuirq, int, NULL, 0444); +MODULE_PARM_DESC(mpuirq, "IRQ # for CMI8330 MPU-401 port."); #ifdef CONFIG_PNP static int isa_registered; static int pnp_registered; @@@ -160,7 -149,6 +160,7 @@@ struct snd_cmi8330 #ifdef CONFIG_PNP struct pnp_dev *cap; struct pnp_dev *play; + struct pnp_dev *mpu; #endif struct snd_card *card; struct snd_wss *wss; @@@ -177,7 -165,7 +177,7 @@@ #ifdef CONFIG_PNP static struct pnp_card_device_id snd_cmi8330_pnpids[] = { - { .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" } } }, + { .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } } }, { .id = "" } }; @@@ -231,10 -219,8 +231,10 @@@ WSS_SINGLE("3D Control - Switch", 0 CMI8330_RMUX3D, 5, 1, 1), WSS_SINGLE("PC Speaker Playback Volume", 0, CMI8330_OUTPUTVOL, 3, 3, 0), -WSS_SINGLE("FM Playback Switch", 0, - CMI8330_RECMUX, 3, 1, 1), +WSS_DOUBLE("FM Playback Switch", 0, + CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), +WSS_DOUBLE("FM Playback Volume", 0, + CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", CAPTURE, SWITCH), 0, CMI8330_RMUX3D, 7, 1, 1), WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", PLAYBACK, SWITCH), 0, @@@ -337,21 -323,16 +337,21 @@@ static int __devinit snd_cmi8330_pnp(in if (acard->play == NULL) return -EBUSY; + acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL); + if (acard->play == NULL) + return -EBUSY; + pdev = acard->cap; err = pnp_activate_dev(pdev); if (err < 0) { - snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP configure failure\n"); + snd_printk(KERN_ERR "CMI8330/C3D PnP configure failure\n"); return -EBUSY; } wssport[dev] = pnp_port_start(pdev, 0); wssdma[dev] = pnp_dma(pdev, 0); wssirq[dev] = pnp_irq(pdev, 0); + fmport[dev] = pnp_port_start(pdev, 1); /* allocate SB16 resources */ pdev = acard->play; @@@ -366,17 -347,6 +366,17 @@@ sbdma16[dev] = pnp_dma(pdev, 1); sbirq[dev] = pnp_irq(pdev, 0); + /* allocate MPU-401 resources */ + pdev = acard->mpu; + + err = pnp_activate_dev(pdev); + if (err < 0) { + snd_printk(KERN_ERR + "CMI8330/C3D (MPU-401) PnP configure failure\n"); + return -EBUSY; + } + mpuport[dev] = pnp_port_start(pdev, 0); + mpuirq[dev] = pnp_irq(pdev, 0); return 0; } #endif @@@ -497,27 -467,28 +497,29 @@@ static int snd_cmi8330_resume(struct sn #define PFX "cmi8330: " - static struct snd_card *snd_cmi8330_card_new(int dev) + static int snd_cmi8330_card_new(int dev, struct snd_card **cardp) { struct snd_card *card; struct snd_cmi8330 *acard; + int err; - card = snd_card_new(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_cmi8330)); - if (card == NULL) { + err = snd_card_create(index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_cmi8330), &card); + if (err < 0) { snd_printk(KERN_ERR PFX "could not get a new card\n"); - return NULL; + return err; } acard = card->private_data; acard->card = card; - return card; + *cardp = card; + return 0; } static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) { struct snd_cmi8330 *acard; int i, err; + struct snd_opl3 *opl3; acard = card->private_data; err = snd_wss_create(card, wssport[dev] + 4, -1, @@@ -525,11 -496,11 +527,11 @@@ wssdma[dev], -1, WSS_HW_DETECT, 0, &acard->wss); if (err < 0) { - snd_printk(KERN_ERR PFX "(AD1848) device busy??\n"); + snd_printk(KERN_ERR PFX "(CMI8330) device busy??\n"); return err; } if (acard->wss->hardware != WSS_HW_CMI8330) { - snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n"); + snd_printk(KERN_ERR PFX "(CMI8330) not found during probe\n"); return -ENODEV; } @@@ -561,27 -532,6 +563,27 @@@ snd_printk(KERN_ERR PFX "failed to create pcms\n"); return err; } + if (fmport[dev] != SNDRV_AUTO_PORT) { + if (snd_opl3_create(card, + fmport[dev], fmport[dev] + 2, + OPL3_HW_AUTO, 0, &opl3) < 0) { + snd_printk(KERN_ERR PFX + "no OPL device at 0x%lx-0x%lx ?\n", + fmport[dev], fmport[dev] + 2); + } else { + err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); + if (err < 0) + return err; + } + } + + if (mpuport[dev] != SNDRV_AUTO_PORT) { + if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, + mpuport[dev], 0, mpuirq[dev], + IRQF_DISABLED, NULL) < 0) + printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", + mpuport[dev]); + } strcpy(card->driver, "CMI8330/C3D"); strcpy(card->shortname, "C-Media CMI8330/C3D"); @@@ -616,9 -566,9 +618,9 @@@ static int __devinit snd_cmi8330_isa_pr struct snd_card *card; int err; - card = snd_cmi8330_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_cmi8330_card_new(dev, &card); + if (err < 0) + return err; snd_card_set_dev(card, pdev); if ((err = snd_cmi8330_probe(card, dev)) < 0) { snd_card_free(card); @@@ -680,9 -630,9 +682,9 @@@ static int __devinit snd_cmi8330_pnp_de if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_cmi8330_card_new(dev); - if (! card) - return -ENOMEM; + res = snd_cmi8330_card_new(dev, &card); + if (res < 0) + return res; if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) { snd_printk(KERN_ERR PFX "PnP detection failed\n"); snd_card_free(card); diff --combined sound/isa/es1688/es1688.c index b0eb0cf6050e,d746750410ea..442b081cafb7 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@@ -49,7 -49,6 +49,7 @@@ static int index[SNDRV_CARDS] = SNDRV_D static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ +static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */ static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ @@@ -66,8 -65,6 +66,8 @@@ MODULE_PARM_DESC(port, "Port # for " CR module_param_array(mpu_port, long, NULL, 0444); MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); module_param_array(irq, int, NULL, 0444); +module_param_array(fm_port, long, NULL, 0444); +MODULE_PARM_DESC(fm_port, "FM port # for ES1688 driver."); MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); module_param_array(mpu_irq, int, NULL, 0444); MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); @@@ -125,9 -122,9 +125,9 @@@ static int __devinit snd_es1688_probe(s struct snd_pcm *pcm; int error; - card = snd_card_new(index[n], id[n], THIS_MODULE, 0); - if (!card) - return -EINVAL; + error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); + if (error < 0) + return error; error = snd_es1688_legacy_create(card, dev, n, &chip); if (error < 0) @@@ -146,19 -143,13 +146,19 @@@ sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, chip->irq, chip->dma8); - if (snd_opl3_create(card, chip->port, chip->port + 2, - OPL3_HW_OPL3, 0, &opl3) < 0) - dev_warn(dev, "opl3 not detected at 0x%lx\n", chip->port); - else { - error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); - if (error < 0) - goto out; + if (fm_port[n] == SNDRV_AUTO_PORT) + fm_port[n] = port[n]; /* share the same port */ + + if (fm_port[n] > 0) { + if (snd_opl3_create(card, fm_port[n], fm_port[n] + 2, + OPL3_HW_OPL3, 0, &opl3) < 0) + dev_warn(dev, + "opl3 not detected at 0x%lx\n", fm_port[n]); + else { + error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); + if (error < 0) + goto out; + } } if (mpu_irq[n] >= 0 && mpu_irq[n] != SNDRV_AUTO_IRQ && diff --combined sound/isa/gus/interwave.c index 418d49eef926,50e429a120da..534a6eced2b8 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@@ -170,7 -170,7 +170,7 @@@ static void snd_interwave_i2c_setlines( unsigned long port = bus->private_value; #if 0 - printk("i2c_setlines - 0x%lx <- %i,%i\n", port, ctrl, data); + printk(KERN_DEBUG "i2c_setlines - 0x%lx <- %i,%i\n", port, ctrl, data); #endif outb((data << 1) | ctrl, port); udelay(10); @@@ -183,7 -183,7 +183,7 @@@ static int snd_interwave_i2c_getclockli res = inb(port) & 1; #if 0 - printk("i2c_getclockline - 0x%lx -> %i\n", port, res); + printk(KERN_DEBUG "i2c_getclockline - 0x%lx -> %i\n", port, res); #endif return res; } @@@ -197,7 -197,7 +197,7 @@@ static int snd_interwave_i2c_getdatalin udelay(10); res = (inb(port) & 2) >> 1; #if 0 - printk("i2c_getdataline - 0x%lx -> %i\n", port, res); + printk(KERN_DEBUG "i2c_getdataline - 0x%lx -> %i\n", port, res); #endif return res; } @@@ -342,8 -342,7 +342,8 @@@ static void __devinit snd_interwave_ban snd_gf1_poke(gus, local, d); snd_gf1_poke(gus, local + 1, d + 1); #if 0 - printk("d = 0x%x, local = 0x%x, local + 1 = 0x%x, idx << 22 = 0x%x\n", + printk(KERN_DEBUG "d = 0x%x, local = 0x%x, " + "local + 1 = 0x%x, idx << 22 = 0x%x\n", d, snd_gf1_peek(gus, local), snd_gf1_peek(gus, local + 1), @@@ -357,8 -356,7 +357,8 @@@ } } #if 0 - printk("sizes: %i %i %i %i\n", sizes[0], sizes[1], sizes[2], sizes[3]); + printk(KERN_DEBUG "sizes: %i %i %i %i\n", + sizes[0], sizes[1], sizes[2], sizes[3]); #endif } @@@ -412,12 -410,12 +412,12 @@@ static void __devinit snd_interwave_det lmct = (psizes[3] << 24) | (psizes[2] << 16) | (psizes[1] << 8) | psizes[0]; #if 0 - printk("lmct = 0x%08x\n", lmct); + printk(KERN_DEBUG "lmct = 0x%08x\n", lmct); #endif for (i = 0; i < ARRAY_SIZE(lmc); i++) if (lmct == lmc[i]) { #if 0 - printk("found !!! %i\n", i); + printk(KERN_DEBUG "found !!! %i\n", i); #endif snd_gf1_write16(gus, SNDRV_GF1_GW_MEMORY_CONFIG, (snd_gf1_look16(gus, SNDRV_GF1_GW_MEMORY_CONFIG) & 0xfff0) | i); snd_interwave_bank_sizes(gus, psizes); @@@ -628,20 -626,22 +628,22 @@@ static void snd_interwave_free(struct s free_irq(iwcard->irq, (void *)iwcard); } - static struct snd_card *snd_interwave_card_new(int dev) + static int snd_interwave_card_new(int dev, struct snd_card **cardp) { struct snd_card *card; struct snd_interwave *iwcard; + int err; - card = snd_card_new(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_interwave)); - if (card == NULL) - return NULL; + err = snd_card_create(index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_interwave), &card); + if (err < 0) + return err; iwcard = card->private_data; iwcard->card = card; iwcard->irq = -1; card->private_free = snd_interwave_free; - return card; + *cardp = card; + return 0; } static int __devinit snd_interwave_probe(struct snd_card *card, int dev) @@@ -780,9 -780,9 +782,9 @@@ static int __devinit snd_interwave_isa_ struct snd_card *card; int err; - card = snd_interwave_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_interwave_card_new(dev, &card); + if (err < 0) + return err; snd_card_set_dev(card, devptr); if ((err = snd_interwave_probe(card, dev)) < 0) { @@@ -878,9 -878,9 +880,9 @@@ static int __devinit snd_interwave_pnp_ if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_interwave_card_new(dev); - if (! card) - return -ENOMEM; + res = snd_interwave_card_new(dev, &card); + if (res < 0) + return res; if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) { snd_card_free(card); diff --combined sound/isa/opl3sa2.c index 06810dfb9d9a,645491a53023..e8d6e1ac88a8 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@@ -179,13 -179,12 +179,13 @@@ static unsigned char __snd_opl3sa2_read unsigned char result; #if 0 outb(0x1d, port); /* password */ - printk("read [0x%lx] = 0x%x\n", port, inb(port)); + printk(KERN_DEBUG "read [0x%lx] = 0x%x\n", port, inb(port)); #endif outb(reg, chip->port); /* register */ result = inb(chip->port + 1); #if 0 - printk("read [0x%lx] = 0x%x [0x%x]\n", port, result, inb(port)); + printk(KERN_DEBUG "read [0x%lx] = 0x%x [0x%x]\n", + port, result, inb(port)); #endif return result; } @@@ -234,10 -233,7 +234,10 @@@ static int __devinit snd_opl3sa2_detect snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port); return -EBUSY; } - // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); + /* + snd_printk(KERN_DEBUG "REG 0A = 0x%x\n", + snd_opl3sa2_read(chip, 0x0a)); + */ chip->version = 0; tmp = snd_opl3sa2_read(chip, OPL3SA2_MISC); if (tmp == 0xff) { @@@ -621,21 -617,24 +621,24 @@@ static void snd_opl3sa2_free(struct snd release_and_free_resource(chip->res_port); } - static struct snd_card *snd_opl3sa2_card_new(int dev) + static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp) { struct snd_card *card; struct snd_opl3sa2 *chip; + int err; - card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); - if (card == NULL) - return NULL; + err = snd_card_create(index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_opl3sa2), &card); + if (err < 0) + return err; strcpy(card->driver, "OPL3SA2"); strcpy(card->shortname, "Yamaha OPL3-SA2"); chip = card->private_data; spin_lock_init(&chip->reg_lock); chip->irq = -1; card->private_free = snd_opl3sa2_free; - return card; + *cardp = card; + return 0; } static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) @@@ -727,9 -726,9 +730,9 @@@ static int __devinit snd_opl3sa2_pnp_de if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_opl3sa2_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_opl3sa2_card_new(dev, &card); + if (err < 0) + return err; if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { snd_card_free(card); return err; @@@ -793,9 -792,9 +796,9 @@@ static int __devinit snd_opl3sa2_pnp_cd if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_opl3sa2_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_opl3sa2_card_new(dev, &card); + if (err < 0) + return err; if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { snd_card_free(card); return err; @@@ -874,9 -873,9 +877,9 @@@ static int __devinit snd_opl3sa2_isa_pr struct snd_card *card; int err; - card = snd_opl3sa2_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_opl3sa2_card_new(dev, &card); + if (err < 0) + return err; snd_card_set_dev(card, pdev); if ((err = snd_opl3sa2_probe(card, dev)) < 0) { snd_card_free(card); diff --combined sound/isa/opti9xx/opti92x-ad1848.c index d5bc0e03132a,cd6e60a6a4ea..5cd555325b9d --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@@ -252,7 -252,7 +252,7 @@@ static int __devinit snd_opti9xx_init(s #endif /* OPTi93X */ default: - snd_printk("chip %d not supported\n", hardware); + snd_printk(KERN_ERR "chip %d not supported\n", hardware); return -ENODEV; } return 0; @@@ -294,7 -294,7 +294,7 @@@ static unsigned char snd_opti9xx_read(s #endif /* OPTi93X */ default: - snd_printk("chip %d not supported\n", chip->hardware); + snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); } spin_unlock_irqrestore(&chip->lock, flags); @@@ -336,7 -336,7 +336,7 @@@ static void snd_opti9xx_write(struct sn #endif /* OPTi93X */ default: - snd_printk("chip %d not supported\n", chip->hardware); + snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); } spin_unlock_irqrestore(&chip->lock, flags); @@@ -412,7 -412,7 +412,7 @@@ static int __devinit snd_opti9xx_config #endif /* OPTi93X */ default: - snd_printk("chip %d not supported\n", chip->hardware); + snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); return -EINVAL; } @@@ -430,8 -430,7 +430,8 @@@ wss_base_bits = 0x02; break; default: - snd_printk("WSS port 0x%lx not valid\n", chip->wss_base); + snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", + chip->wss_base); goto __skip_base; } snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); @@@ -456,7 -455,7 +456,7 @@@ __skip_base irq_bits = 0x04; break; default: - snd_printk("WSS irq # %d not valid\n", chip->irq); + snd_printk(KERN_WARNING "WSS irq # %d not valid\n", chip->irq); goto __skip_resources; } @@@ -471,14 -470,13 +471,14 @@@ dma_bits = 0x03; break; default: - snd_printk("WSS dma1 # %d not valid\n", chip->dma1); + snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", + chip->dma1); goto __skip_resources; } #if defined(CS4231) || defined(OPTi93X) if (chip->dma1 == chip->dma2) { - snd_printk("don't want to share dmas\n"); + snd_printk(KERN_ERR "don't want to share dmas\n"); return -EBUSY; } @@@ -487,8 -485,7 +487,8 @@@ case 1: break; default: - snd_printk("WSS dma2 # %d not valid\n", chip->dma2); + snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", + chip->dma2); goto __skip_resources; } dma_bits |= 0x04; @@@ -519,8 -516,7 +519,8 @@@ __skip_resources mpu_port_bits = 0x00; break; default: - snd_printk("MPU-401 port 0x%lx not valid\n", + snd_printk(KERN_WARNING + "MPU-401 port 0x%lx not valid\n", chip->mpu_port); goto __skip_mpu; } @@@ -539,7 -535,7 +539,7 @@@ mpu_irq_bits = 0x01; break; default: - snd_printk("MPU-401 irq # %d not valid\n", + snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n", chip->mpu_irq); goto __skip_mpu; } @@@ -730,7 -726,7 +730,7 @@@ static int __devinit snd_opti9xx_probe( if (chip->wss_base == SNDRV_AUTO_PORT) { chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4); if (chip->wss_base < 0) { - snd_printk("unable to find a free WSS port\n"); + snd_printk(KERN_ERR "unable to find a free WSS port\n"); return -EBUSY; } } @@@ -819,8 -815,14 +819,8 @@@ chip->fm_port, chip->fm_port + 4 - 1); } if (opl3) { -#ifdef CS4231 - const int t1dev = 1; -#else - const int t1dev = 0; -#endif - if ((error = snd_opl3_timer_new(opl3, t1dev, t1dev+1)) < 0) - return error; - if ((error = snd_opl3_hwdep_new(opl3, 0, 1, &synth)) < 0) + error = snd_opl3_hwdep_new(opl3, 0, 1, &synth); + if (error < 0) return error; } } @@@ -828,15 -830,18 +828,18 @@@ return snd_card_register(card); } - static struct snd_card *snd_opti9xx_card_new(void) + static int snd_opti9xx_card_new(struct snd_card **cardp) { struct snd_card *card; + int err; - card = snd_card_new(index, id, THIS_MODULE, sizeof(struct snd_opti9xx)); - if (! card) - return NULL; + err = snd_card_create(index, id, THIS_MODULE, + sizeof(struct snd_opti9xx), &card); + if (err < 0) + return err; card->private_free = snd_card_opti9xx_free; - return card; + *cardp = card; + return 0; } static int __devinit snd_opti9xx_isa_match(struct device *devptr, @@@ -895,15 -900,15 +898,15 @@@ static int __devinit snd_opti9xx_isa_pr #if defined(CS4231) || defined(OPTi93X) if (dma2 == SNDRV_AUTO_DMA) { if ((dma2 = snd_legacy_find_free_dma(possible_dma2s[dma1 % 4])) < 0) { - snd_printk("unable to find a free DMA2\n"); + snd_printk(KERN_ERR "unable to find a free DMA2\n"); return -EBUSY; } } #endif - card = snd_opti9xx_card_new(); - if (! card) - return -ENOMEM; + error = snd_opti9xx_card_new(&card); + if (error < 0) + return error; if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) { snd_card_free(card); @@@ -948,9 -953,9 +951,9 @@@ static int __devinit snd_opti9xx_pnp_pr return -EBUSY; if (! isapnp) return -ENODEV; - card = snd_opti9xx_card_new(); - if (! card) - return -ENOMEM; + error = snd_opti9xx_card_new(&card); + if (error < 0) + return error; chip = card->private_data; hw = snd_card_opti9xx_pnp(chip, pcard, pid); diff --combined sound/isa/sc6000.c index bbc53692e68d,7a1470376c6d..782010608ef4 --- a/sound/isa/sc6000.c +++ b/sound/isa/sc6000.c @@@ -489,9 -489,9 +489,9 @@@ static int __devinit snd_sc6000_probe(s char __iomem *vmss_port; - card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); - if (!card) - return -ENOMEM; + err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); + if (err < 0) + return err; if (xirq == SNDRV_AUTO_IRQ) { xirq = snd_legacy_find_free_irq(possible_irqs); @@@ -576,6 -576,10 +576,6 @@@ snd_printk(KERN_ERR PFX "no OPL device at 0x%x-0x%x ?\n", 0x388, 0x388 + 2); } else { - err = snd_opl3_timer_new(opl3, 0, 1); - if (err < 0) - goto err_unmap2; - err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); if (err < 0) goto err_unmap2; diff --combined sound/isa/wavefront/wavefront.c index c280e6220aee,95898b2b7b58..a34ae7b1f7d0 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@@ -338,15 -338,16 +338,16 @@@ snd_wavefront_free(struct snd_card *car } } - static struct snd_card *snd_wavefront_card_new(int dev) + static int snd_wavefront_card_new(int dev, struct snd_card **cardp) { struct snd_card *card; snd_wavefront_card_t *acard; + int err; - card = snd_card_new (index[dev], id[dev], THIS_MODULE, - sizeof(snd_wavefront_card_t)); - if (card == NULL) - return NULL; + err = snd_card_create(index[dev], id[dev], THIS_MODULE, + sizeof(snd_wavefront_card_t), &card); + if (err < 0) + return err; acard = card->private_data; acard->wavefront.irq = -1; @@@ -357,7 -358,8 +358,8 @@@ acard->wavefront.card = card; card->private_free = snd_wavefront_free; - return card; + *cardp = card; + return 0; } static int __devinit @@@ -551,11 -553,11 +553,11 @@@ static int __devinit snd_wavefront_isa_ return 0; #endif if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify CS4232 port\n"); + snd_printk(KERN_ERR "specify CS4232 port\n"); return 0; } if (ics2115_port[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify ICS2115 port\n"); + snd_printk(KERN_ERR "specify ICS2115 port\n"); return 0; } return 1; @@@ -567,9 -569,9 +569,9 @@@ static int __devinit snd_wavefront_isa_ struct snd_card *card; int err; - card = snd_wavefront_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_wavefront_card_new(dev, &card); + if (err < 0) + return err; snd_card_set_dev(card, pdev); if ((err = snd_wavefront_probe(card, dev)) < 0) { snd_card_free(card); @@@ -616,9 -618,9 +618,9 @@@ static int __devinit snd_wavefront_pnp_ if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_wavefront_card_new(dev); - if (! card) - return -ENOMEM; + res = snd_wavefront_card_new(dev, &card); + if (res < 0) + return res; if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) { if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { diff --combined sound/pci/hda/hda_intel.c index 11e791b965f6,ad5df2ae6f7d..f9603443f086 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@@ -996,11 -996,10 +996,11 @@@ static irqreturn_t azx_interrupt(int ir spin_unlock(&chip->reg_lock); snd_pcm_period_elapsed(azx_dev->substream); spin_lock(&chip->reg_lock); - } else { + } else if (chip->bus && chip->bus->workq) { /* bogus IRQ, process it later */ azx_dev->irq_pending = 1; - schedule_work(&chip->irq_pending_work); + queue_work(chip->bus->workq, + &chip->irq_pending_work); } } } @@@ -1742,6 -1741,7 +1742,6 @@@ static void azx_clear_irq_pending(struc for (i = 0; i < chip->num_streams; i++) chip->azx_dev[i].irq_pending = 0; spin_unlock_irq(&chip->reg_lock); - flush_scheduled_work(); } static struct snd_pcm_ops azx_pcm_ops = { @@@ -2335,10 -2335,10 +2335,10 @@@ static int __devinit azx_probe(struct p return -ENOENT; } - card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); - if (!card) { + err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); + if (err < 0) { snd_printk(KERN_ERR SFX "Error creating card!\n"); - return -ENOMEM; + return err; } err = azx_create(card, pci, dev, pci_id->driver_data, &chip); diff --combined sound/ppc/snd_ps3.c index ff321110ec02,ef2c3f417175..f361c26506aa --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c @@@ -477,7 -477,7 +477,7 @@@ static int snd_ps3_pcm_prepare(struct s card->dma_start_bus_addr[SND_PS3_CH_R] = runtime->dma_addr + (runtime->dma_bytes / 2); - pr_debug("%s: vaddr=%p bus=%#lx\n", __func__, + pr_debug("%s: vaddr=%p bus=%#llx\n", __func__, card->dma_start_vaddr[SND_PS3_CH_L], card->dma_start_bus_addr[SND_PS3_CH_L]); @@@ -969,11 -969,9 +969,9 @@@ static int __init snd_ps3_driver_probe( } /* create card instance */ - the_card.card = snd_card_new(index, id, THIS_MODULE, 0); - if (!the_card.card) { - ret = -ENXIO; + ret = snd_card_create(index, id, THIS_MODULE, 0, &the_card.card); + if (ret < 0) goto clean_irq; - } strcpy(the_card.card->driver, "PS3"); strcpy(the_card.card->shortname, "PS3"); @@@ -1030,7 -1028,7 +1028,7 @@@ pr_info("%s: nullbuffer alloc failed\n", __func__); goto clean_preallocate; } - pr_debug("%s: null vaddr=%p dma=%#lx\n", __func__, + pr_debug("%s: null vaddr=%p dma=%#llx\n", __func__, the_card.null_buffer_start_vaddr, the_card.null_buffer_start_dma_addr); /* set default sample rate/word width */ diff --combined sound/soc/soc-core.c index 55fdb4abb179,318dfdd54d7f..8592d95023ed --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@@ -1311,17 -1311,17 +1311,17 @@@ int snd_soc_new_pcms(struct snd_soc_dev { struct snd_soc_codec *codec = socdev->codec; struct snd_soc_card *card = socdev->card; - int ret = 0, i; + int ret, i; mutex_lock(&codec->mutex); /* register a sound card */ - codec->card = snd_card_new(idx, xid, codec->owner, 0); - if (!codec->card) { + ret = snd_card_create(idx, xid, codec->owner, 0, &codec->card); + if (ret < 0) { printk(KERN_ERR "asoc: can't create sound card for codec %s\n", codec->name); mutex_unlock(&codec->mutex); - return -ENODEV; + return ret; } codec->card->dev = socdev->dev; @@@ -1584,6 -1584,37 +1584,6 @@@ int snd_soc_put_enum_double(struct snd_ } EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); -/** - * snd_soc_info_value_enum_double - semi enumerated double mixer info callback - * @kcontrol: mixer control - * @uinfo: control element information - * - * Callback to provide information about a double semi enumerated - * mixer control. - * - * Semi enumerated mixer: the enumerated items are referred as values. Can be - * used for handling bitfield coded enumeration for example. - * - * Returns 0 for success. - */ -int snd_soc_info_value_enum_double(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - struct soc_value_enum *e = (struct soc_value_enum *) - kcontrol->private_value; - - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->count = e->shift_l == e->shift_r ? 1 : 2; - uinfo->value.enumerated.items = e->max; - - if (uinfo->value.enumerated.item > e->max - 1) - uinfo->value.enumerated.item = e->max - 1; - strcpy(uinfo->value.enumerated.name, - e->texts[uinfo->value.enumerated.item]); - return 0; -} -EXPORT_SYMBOL_GPL(snd_soc_info_value_enum_double); - /** * snd_soc_get_value_enum_double - semi enumerated double mixer get callback * @kcontrol: mixer control @@@ -1600,7 -1631,8 +1600,7 @@@ int snd_soc_get_value_enum_double(struc struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct soc_value_enum *e = (struct soc_value_enum *) - kcontrol->private_value; + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; unsigned short reg_val, val, mux; reg_val = snd_soc_read(codec, e->reg); @@@ -1639,7 -1671,8 +1639,7 @@@ int snd_soc_put_value_enum_double(struc struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct soc_value_enum *e = (struct soc_value_enum *) - kcontrol->private_value; + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; unsigned short val; unsigned short mask; diff --combined sound/usb/caiaq/caiaq-device.c index 41c36b055f6b,55a9075cb097..09aed2363cc9 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@@ -42,7 -42,7 +42,7 @@@ #endif MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.9"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," @@@ -336,9 -336,10 +336,10 @@@ static void __devinit setup_card(struc log("Unable to set up control system (ret=%d)\n", ret); } - static struct snd_card* create_card(struct usb_device* usb_dev) + static int create_card(struct usb_device* usb_dev, struct snd_card **cardp) { int devnum; + int err; struct snd_card *card; struct snd_usb_caiaqdev *dev; @@@ -347,12 -348,12 +348,12 @@@ break; if (devnum >= SNDRV_CARDS) - return NULL; + return -ENODEV; - card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, - sizeof(struct snd_usb_caiaqdev)); - if (!card) - return NULL; + err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, + sizeof(struct snd_usb_caiaqdev), &card); + if (err < 0) + return err; dev = caiaqdev(card); dev->chip.dev = usb_dev; @@@ -362,7 -363,8 +363,8 @@@ spin_lock_init(&dev->spinlock); snd_card_set_dev(card, &usb_dev->dev); - return card; + *cardp = card; + return 0; } static int __devinit init_card(struct snd_usb_caiaqdev *dev) @@@ -441,10 -443,10 +443,10 @@@ static int __devinit snd_probe(struct u struct snd_card *card; struct usb_device *device = interface_to_usbdev(intf); - card = create_card(device); + ret = create_card(device, &card); - if (!card) - return -ENOMEM; + if (ret < 0) + return ret; usb_set_intfdata(intf, card); ret = init_card(caiaqdev(card));