diff options
Diffstat (limited to 'sound/pci/oxygen')
-rw-r--r-- | sound/pci/oxygen/oxygen.c | 4 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen.h | 1 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen_lib.c | 74 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen_pcm.c | 2 | ||||
-rw-r--r-- | sound/pci/oxygen/se6x.c | 2 | ||||
-rw-r--r-- | sound/pci/oxygen/virtuoso.c | 2 | ||||
-rw-r--r-- | sound/pci/oxygen/xonar_dg.c | 2 | ||||
-rw-r--r-- | sound/pci/oxygen/xonar_pcm179x.c | 4 | ||||
-rw-r--r-- | sound/pci/oxygen/xonar_wm87x6.c | 6 |
9 files changed, 39 insertions, 58 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index a751fcce7c8e..c346f42befc2 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -56,9 +56,6 @@ MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); MODULE_DESCRIPTION("C-Media CMI8788 driver"); MODULE_LICENSE("GPL v2"); -MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8786}" - ",{C-Media,CMI8787}" - ",{C-Media,CMI8788}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; @@ -857,7 +854,6 @@ static struct pci_driver oxygen_driver = { .name = KBUILD_MODNAME, .id_table = oxygen_ids, .probe = generic_oxygen_probe, - .remove = oxygen_pci_remove, #ifdef CONFIG_PM_SLEEP .driver = { .pm = &oxygen_pci_pm, diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index 06bf7e5744d0..0cae640708f3 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h @@ -161,7 +161,6 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, const struct pci_device_id *id ) ); -void oxygen_pci_remove(struct pci_dev *pci); #ifdef CONFIG_PM_SLEEP extern const struct dev_pm_ops oxygen_pci_pm; #endif diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index afc6dd329c09..92ffe9dc20c5 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -570,18 +570,13 @@ static void oxygen_card_free(struct snd_card *card) struct oxygen *chip = card->private_data; oxygen_shutdown(chip); - if (chip->irq >= 0) - free_irq(chip->irq, chip); flush_work(&chip->spdif_input_bits_work); flush_work(&chip->gpio_work); chip->model.cleanup(chip); - kfree(chip->model_data); mutex_destroy(&chip->mutex); - pci_release_regions(chip->pci); - pci_disable_device(chip->pci); } -int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, +static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id, struct module *owner, const struct pci_device_id *ids, int (*get_model)(struct oxygen *chip, @@ -594,8 +589,8 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, const struct pci_device_id *pci_id; int err; - err = snd_card_new(&pci->dev, index, id, owner, - sizeof(*chip), &card); + err = snd_devm_card_new(&pci->dev, index, id, owner, + sizeof(*chip), &card); if (err < 0) return err; @@ -610,41 +605,38 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, INIT_WORK(&chip->gpio_work, oxygen_gpio_changed); init_waitqueue_head(&chip->ac97_waitqueue); - err = pci_enable_device(pci); + err = pcim_enable_device(pci); if (err < 0) - goto err_card; + return err; err = pci_request_regions(pci, DRIVER); if (err < 0) { dev_err(card->dev, "cannot reserve PCI resources\n"); - goto err_pci_enable; + return err; } if (!(pci_resource_flags(pci, 0) & IORESOURCE_IO) || pci_resource_len(pci, 0) < OXYGEN_IO_SIZE) { dev_err(card->dev, "invalid PCI I/O range\n"); - err = -ENXIO; - goto err_pci_regions; + return -ENXIO; } chip->addr = pci_resource_start(pci, 0); pci_id = oxygen_search_pci_id(chip, ids); - if (!pci_id) { - err = -ENODEV; - goto err_pci_regions; - } + if (!pci_id) + return -ENODEV; + oxygen_restore_eeprom(chip, pci_id); err = get_model(chip, pci_id); if (err < 0) - goto err_pci_regions; + return err; if (chip->model.model_data_size) { - chip->model_data = kzalloc(chip->model.model_data_size, - GFP_KERNEL); - if (!chip->model_data) { - err = -ENOMEM; - goto err_pci_regions; - } + chip->model_data = devm_kzalloc(&pci->dev, + chip->model.model_data_size, + GFP_KERNEL); + if (!chip->model_data) + return -ENOMEM; } pci_set_master(pci); @@ -654,11 +646,11 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, oxygen_init(chip); chip->model.init(chip); - err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED, - KBUILD_MODNAME, chip); + err = devm_request_irq(&pci->dev, pci->irq, oxygen_interrupt, + IRQF_SHARED, KBUILD_MODNAME, chip); if (err < 0) { dev_err(card->dev, "cannot grab interrupt %d\n", pci->irq); - goto err_card; + return err; } chip->irq = pci->irq; card->sync_irq = chip->irq; @@ -672,11 +664,11 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, err = oxygen_pcm_init(chip); if (err < 0) - goto err_card; + return err; err = oxygen_mixer_init(chip); if (err < 0) - goto err_card; + return err; if (chip->model.device_config & (MIDI_OUTPUT | MIDI_INPUT)) { unsigned int info_flags = @@ -689,7 +681,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, chip->addr + OXYGEN_MPU401, info_flags, -1, &chip->midi); if (err < 0) - goto err_card; + return err; } oxygen_proc_init(chip); @@ -704,26 +696,22 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, err = snd_card_register(card); if (err < 0) - goto err_card; + return err; pci_set_drvdata(pci, card); return 0; - -err_pci_regions: - pci_release_regions(pci); -err_pci_enable: - pci_disable_device(pci); -err_card: - snd_card_free(card); - return err; } -EXPORT_SYMBOL(oxygen_pci_probe); -void oxygen_pci_remove(struct pci_dev *pci) +int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, + struct module *owner, + const struct pci_device_id *ids, + int (*get_model)(struct oxygen *chip, + const struct pci_device_id *id)) { - snd_card_free(pci_get_drvdata(pci)); + return snd_card_free_on_error(&pci->dev, + __oxygen_pci_probe(pci, index, id, owner, ids, get_model)); } -EXPORT_SYMBOL(oxygen_pci_remove); +EXPORT_SYMBOL(oxygen_pci_probe); #ifdef CONFIG_PM_SLEEP static int oxygen_pci_suspend(struct device *dev) diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index 75b25ecf83a9..b2a3fcfe31d4 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c @@ -137,7 +137,7 @@ static int oxygen_open(struct snd_pcm_substream *substream, SNDRV_PCM_RATE_64000); runtime->hw.rate_min = 44100; } - /* fall through */ + fallthrough; case PCM_A: case PCM_B: runtime->hw.fifo_size = 0; diff --git a/sound/pci/oxygen/se6x.c b/sound/pci/oxygen/se6x.c index 78c35a0a5477..17650a5b1bfa 100644 --- a/sound/pci/oxygen/se6x.c +++ b/sound/pci/oxygen/se6x.c @@ -29,7 +29,6 @@ MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); MODULE_DESCRIPTION("Studio Evolution SE6X driver"); MODULE_LICENSE("GPL v2"); -MODULE_SUPPORTED_DEVICE("{{Studio Evolution,SE6X}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; @@ -138,7 +137,6 @@ static struct pci_driver se6x_driver = { .name = KBUILD_MODNAME, .id_table = se6x_ids, .probe = se6x_probe, - .remove = oxygen_pci_remove, #ifdef CONFIG_PM_SLEEP .driver = { .pm = &oxygen_pci_pm, diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 98ab16329827..2e405133371f 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -16,7 +16,6 @@ MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); MODULE_DESCRIPTION("Asus Virtuoso driver"); MODULE_LICENSE("GPL v2"); -MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; @@ -83,7 +82,6 @@ static struct pci_driver xonar_driver = { .name = KBUILD_MODNAME, .id_table = xonar_ids, .probe = xonar_probe, - .remove = oxygen_pci_remove, #ifdef CONFIG_PM_SLEEP .driver = { .pm = &oxygen_pci_pm, diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c index c3f8721624cd..b90421a1d909 100644 --- a/sound/pci/oxygen/xonar_dg.c +++ b/sound/pci/oxygen/xonar_dg.c @@ -29,7 +29,7 @@ * GPIO 4 <- headphone detect * GPIO 5 -> enable ADC analog circuit for the left channel * GPIO 6 -> enable ADC analog circuit for the right channel - * GPIO 7 -> switch green rear output jack between CS4245 and and the first + * GPIO 7 -> switch green rear output jack between CS4245 and the first * channel of CS4361 (mechanical relay) * GPIO 8 -> enable output to speakers * diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c index 6a0520c4fb5a..cf801a235df9 100644 --- a/sound/pci/oxygen/xonar_pcm179x.c +++ b/sound/pci/oxygen/xonar_pcm179x.c @@ -460,7 +460,7 @@ static void xonar_st_init(struct oxygen *chip) data->generic.anti_pop_delay = 100; data->h6 = chip->model.dac_channels_mixer > 2; - data->has_cs2000 = 1; + data->has_cs2000 = true; data->cs2000_regs[CS2000_FUN_CFG_1] = CS2000_REF_CLK_DIV_1; data->broken_i2c = true; @@ -502,7 +502,7 @@ static void xonar_xense_init(struct oxygen *chip) xonar_init_ext_power(chip); data->generic.anti_pop_delay = 100; - data->has_cs2000 = 1; + data->has_cs2000 = true; data->cs2000_regs[CS2000_FUN_CFG_1] = CS2000_REF_CLK_DIV_1; oxygen_write16(chip, OXYGEN_I2S_A_FORMAT, diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c index 0767276582ca..8aa92f3e5ee8 100644 --- a/sound/pci/oxygen/xonar_wm87x6.c +++ b/sound/pci/oxygen/xonar_wm87x6.c @@ -116,7 +116,8 @@ static void wm8776_write(struct oxygen *chip, else wm8776_write_i2c(chip, reg, value); if (reg < ARRAY_SIZE(data->wm8776_regs)) { - if (reg >= WM8776_HPLVOL && reg <= WM8776_DACMASTER) + /* reg >= WM8776_HPLVOL is always true */ + if (reg <= WM8776_DACMASTER) value &= ~WM8776_UPDATE; data->wm8776_regs[reg] = value; } @@ -144,7 +145,8 @@ static void wm8766_write(struct oxygen *chip, OXYGEN_SPI_CEN_LATCH_CLOCK_LO, (reg << 9) | value); if (reg < ARRAY_SIZE(data->wm8766_regs)) { - if ((reg >= WM8766_LDA1 && reg <= WM8766_RDA1) || + /* reg >= WM8766_LDA1 is always true */ + if (reg <= WM8766_RDA1 || (reg >= WM8766_LDA2 && reg <= WM8766_MASTDA)) value &= ~WM8766_UPDATE; data->wm8766_regs[reg] = value; |