--- zzzz-none-000/linux-3.10.107/sound/pci/cs5535audio/cs5535audio.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/pci/cs5535audio/cs5535audio.c 2021-02-04 17:41:59.000000000 +0000 @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ module_param(ac97_quirk, charp, 0444); MODULE_PARM_DESC(ac97_quirk, "AC'97 board specific workarounds."); -static struct ac97_quirk ac97_quirks[] = { +static const struct ac97_quirk ac97_quirks[] = { #if 0 /* Not yet confirmed if all 5536 boards are HP only */ { .subvendor = PCI_VENDOR_ID_AMD, @@ -66,7 +66,7 @@ module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable " DRIVER_NAME); -static DEFINE_PCI_DEVICE_TABLE(snd_cs5535audio_ids) = { +static const struct pci_device_id snd_cs5535audio_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) }, {} @@ -84,7 +84,8 @@ udelay(1); } while (--timeout); if (!timeout) - snd_printk(KERN_ERR "Failure writing to cs5535 codec\n"); + dev_err(cs5535au->card->dev, + "Failure writing to cs5535 codec\n"); } static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au, @@ -109,8 +110,9 @@ udelay(1); } while (--timeout); if (!timeout) - snd_printk(KERN_ERR "Failure reading codec reg 0x%x," - "Last value=0x%x\n", reg, val); + dev_err(cs5535au->card->dev, + "Failure reading codec reg 0x%x, Last value=0x%x\n", + reg, val); return (unsigned short) val; } @@ -168,7 +170,7 @@ olpc_prequirks(card, &ac97); if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) { - snd_printk(KERN_ERR "mixer failed\n"); + dev_err(card->dev, "mixer failed\n"); return err; } @@ -176,7 +178,7 @@ err = olpc_quirks(card, cs5535au->ac97); if (err < 0) { - snd_printk(KERN_ERR "olpc quirks failed\n"); + dev_err(card->dev, "olpc quirks failed\n"); return err; } @@ -194,8 +196,9 @@ dma = cs5535au->playback_substream->runtime->private_data; snd_pcm_period_elapsed(cs5535au->playback_substream); } else { - snd_printk(KERN_ERR "unexpected bm0 irq src, bm_stat=%x\n", - bm_stat); + dev_err(cs5535au->card->dev, + "unexpected bm0 irq src, bm_stat=%x\n", + bm_stat); } } @@ -241,8 +244,9 @@ process_bm1_irq(cs5535au); break; default: - snd_printk(KERN_ERR "Unexpected irq src: " - "0x%x\n", acc_irq_stat); + dev_err(cs5535au->card->dev, + "Unexpected irq src: 0x%x\n", + acc_irq_stat); break; } } @@ -253,7 +257,7 @@ static int snd_cs5535audio_free(struct cs5535audio *cs5535au) { synchronize_irq(cs5535au->irq); - pci_set_power_state(cs5535au->pci, 3); + pci_set_power_state(cs5535au->pci, PCI_D3hot); if (cs5535au->irq >= 0) free_irq(cs5535au->irq, cs5535au); @@ -285,9 +289,9 @@ if ((err = pci_enable_device(pci)) < 0) return err; - if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { - printk(KERN_WARNING "unable to get 32bit dma\n"); + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 || + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) { + dev_warn(card->dev, "unable to get 32bit dma\n"); err = -ENXIO; goto pcifail; } @@ -312,7 +316,7 @@ if (request_irq(pci->irq, snd_cs5535audio_interrupt, IRQF_SHARED, KBUILD_MODNAME, cs5535au)) { - snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); + dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); err = -EBUSY; goto sndfail; } @@ -324,8 +328,6 @@ cs5535au, &ops)) < 0) goto sndfail; - snd_card_set_dev(card, &pci->dev); - *rcs5535au = cs5535au; return 0; @@ -353,7 +355,8 @@ return -ENOENT; } - err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); + err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, + 0, &card); if (err < 0) return err; @@ -391,7 +394,6 @@ { olpc_quirks_cleanup(); snd_card_free(pci_get_drvdata(pci)); - pci_set_drvdata(pci, NULL); } static struct pci_driver cs5535audio_driver = {