diff options
Diffstat (limited to 'sound/isa/sb/sb8.c')
-rw-r--r-- | sound/isa/sb/sb8.c | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index b08e6e7690c9..e5ef1777161f 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -54,15 +54,6 @@ static irqreturn_t snd_sb8_interrupt(int irq, void *dev_id) } } -static void snd_sb8_free(struct snd_card *card) -{ - struct snd_sb8 *acard = card->private_data; - - if (acard == NULL) - return; - release_and_free_resource(acard->fm_res); -} - static int snd_sb8_match(struct device *pdev, unsigned int dev) { if (!enable[dev]) @@ -86,26 +77,26 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) struct snd_opl3 *opl3; int err; - err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_sb8), &card); + err = snd_devm_card_new(pdev, index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_sb8), &card); if (err < 0) return err; acard = card->private_data; - card->private_free = snd_sb8_free; /* * Block the 0x388 port to avoid PnP conflicts. * No need to check this value after request_region, * as we never do anything with it. */ - acard->fm_res = request_region(0x388, 4, "SoundBlaster FM"); + acard->fm_res = devm_request_region(card->dev, 0x388, 4, + "SoundBlaster FM"); if (port[dev] != SNDRV_AUTO_PORT) { err = snd_sbdsp_create(card, port[dev], irq[dev], snd_sb8_interrupt, dma8[dev], -1, SB_HW_AUTO, &chip); if (err < 0) - goto _err; + return err; } else { /* auto-probe legacy ports */ static const unsigned long possible_ports[] = { @@ -125,10 +116,8 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) break; } } - if (i >= ARRAY_SIZE(possible_ports)) { - err = -EINVAL; - goto _err; - } + if (i >= ARRAY_SIZE(possible_ports)) + return -EINVAL; } acard->chip = chip; @@ -139,17 +128,16 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) else snd_printk(KERN_WARNING "SB 16 chip detected at 0x%lx, try snd-sb16 module\n", port[dev]); - err = -ENODEV; - goto _err; + return -ENODEV; } err = snd_sb8dsp_pcm(chip, 0); if (err < 0) - goto _err; + return err; err = snd_sbmixer_new(chip); if (err < 0) - goto _err; + return err; if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) { err = snd_opl3_create(card, chip->port + 8, 0, @@ -167,12 +155,12 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) if (err >= 0) { err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); if (err < 0) - goto _err; + return err; } err = snd_sb8dsp_midi(chip, 0); if (err < 0) - goto _err; + return err; strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8"); strcpy(card->shortname, chip->name); @@ -183,19 +171,10 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) err = snd_card_register(card); if (err < 0) - goto _err; + return err; dev_set_drvdata(pdev, card); return 0; - - _err: - snd_card_free(card); - return err; -} - -static void snd_sb8_remove(struct device *pdev, unsigned int dev) -{ - snd_card_free(dev_get_drvdata(pdev)); } #ifdef CONFIG_PM @@ -229,7 +208,6 @@ static int snd_sb8_resume(struct device *dev, unsigned int n) static struct isa_driver snd_sb8_driver = { .match = snd_sb8_match, .probe = snd_sb8_probe, - .remove = snd_sb8_remove, #ifdef CONFIG_PM .suspend = snd_sb8_suspend, .resume = snd_sb8_resume, |