diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-07 15:54:25 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-07 15:54:25 +0100 |
commit | 3b6fe95a07a1bb13784df866aa75c7bcc28529e3 (patch) | |
tree | 9d27a8823f95be0274fa983021210cb70d414075 /sound/pci/fm801.c | |
parent | 4f7946eca787baa0f66b4a508595b768a4772f3f (diff) | |
parent | 5618955c4269b07c8177f88a8075d4879e74cd27 (diff) | |
download | linux-3b6fe95a07a1bb13784df866aa75c7bcc28529e3.tar.gz linux-3b6fe95a07a1bb13784df866aa75c7bcc28529e3.tar.bz2 linux-3b6fe95a07a1bb13784df866aa75c7bcc28529e3.zip |
Merge branch 'topic/pci-cleanup' into for-next
Diffstat (limited to 'sound/pci/fm801.c')
-rw-r--r-- | sound/pci/fm801.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 9a2122fd3a8e..46ac399d2f88 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -1178,12 +1178,6 @@ static int snd_fm801_free(struct fm801 *chip) v4l2_device_unregister(&chip->v4l2_dev); } #endif - if (chip->irq >= 0) - free_irq(chip->irq, chip); - pci_release_regions(chip->pci); - pci_disable_device(chip->pci); - - kfree(chip); return 0; } @@ -1206,28 +1200,23 @@ static int snd_fm801_create(struct snd_card *card, }; *rchip = NULL; - if ((err = pci_enable_device(pci)) < 0) + if ((err = pcim_enable_device(pci)) < 0) return err; - chip = kzalloc(sizeof(*chip), GFP_KERNEL); - if (chip == NULL) { - pci_disable_device(pci); + chip = devm_kzalloc(&pci->dev, sizeof(*chip), GFP_KERNEL); + if (chip == NULL) return -ENOMEM; - } spin_lock_init(&chip->reg_lock); chip->card = card; chip->pci = pci; chip->irq = -1; chip->tea575x_tuner = tea575x_tuner; - if ((err = pci_request_regions(pci, "FM801")) < 0) { - kfree(chip); - pci_disable_device(pci); + if ((err = pci_request_regions(pci, "FM801")) < 0) return err; - } chip->port = pci_resource_start(pci, 0); if ((tea575x_tuner & TUNER_ONLY) == 0) { - if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED, - KBUILD_MODNAME, chip)) { - dev_err(card->dev, "unable to grab IRQ %d\n", chip->irq); + if (devm_request_irq(&pci->dev, pci->irq, snd_fm801_interrupt, + IRQF_SHARED, KBUILD_MODNAME, chip)) { + dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); snd_fm801_free(chip); return -EBUSY; } @@ -1242,12 +1231,6 @@ static int snd_fm801_create(struct snd_card *card, /* init might set tuner access method */ tea575x_tuner = chip->tea575x_tuner; - if (chip->irq >= 0 && (tea575x_tuner & TUNER_ONLY)) { - pci_clear_master(pci); - free_irq(chip->irq, chip); - chip->irq = -1; - } - if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { snd_fm801_free(chip); return err; |