--- zzzz-none-000/linux-3.10.107/sound/pci/als4000.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/pci/als4000.c 2021-02-04 17:41:59.000000000 +0000 @@ -65,7 +65,7 @@ * - power management? (card can do voice wakeup according to datasheet!!) */ -#include +#include #include #include #include @@ -116,7 +116,7 @@ #endif }; -static DEFINE_PCI_DEVICE_TABLE(snd_als4000_ids) = { +static const struct pci_device_id snd_als4000_ids[] = { { 0x4005, 0x4000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* ALS4000 */ { 0, } }; @@ -578,7 +578,7 @@ snd_als4k_iobase_readb(chip->alt_port, ALS4K_IOB_16_ACK_FOR_CR1E); - /* printk(KERN_INFO "als4000: irq 0x%04x 0x%04x\n", + /* dev_dbg(chip->card->dev, "als4000: irq 0x%04x 0x%04x\n", pci_irqstatus, sb_irqstatus); */ /* only ack the things we actually handled above */ @@ -791,13 +791,13 @@ } if (!r) { - printk(KERN_WARNING "als4000: cannot reserve joystick ports\n"); + dev_warn(&acard->pci->dev, "cannot reserve joystick ports\n"); return -EBUSY; } acard->gameport = gp = gameport_allocate_port(); if (!gp) { - printk(KERN_ERR "als4000: cannot allocate memory for gameport\n"); + dev_err(&acard->pci->dev, "cannot allocate memory for gameport\n"); release_and_free_resource(r); return -ENOMEM; } @@ -871,9 +871,9 @@ return err; } /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { - snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 || + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) { + dev_err(&pci->dev, "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; } @@ -888,9 +888,9 @@ pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO); pci_set_master(pci); - err = snd_card_create(index[dev], id[dev], THIS_MODULE, - sizeof(*acard) /* private_data: acard */, - &card); + err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, + sizeof(*acard) /* private_data: acard */, + &card); if (err < 0) { pci_release_regions(pci); pci_disable_device(pci); @@ -920,7 +920,6 @@ chip->pci = pci; chip->alt_port = iobase; - snd_card_set_dev(card, &pci->dev); snd_als4000_configure(chip); @@ -934,7 +933,7 @@ MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK, -1, &chip->rmidi)) < 0) { - printk(KERN_ERR "als4000: no MPU-401 device at 0x%lx?\n", + dev_err(&pci->dev, "no MPU-401 device at 0x%lx?\n", iobase + ALS4K_IOB_30_MIDI_DATA); goto out_err; } @@ -955,7 +954,7 @@ iobase + ALS4K_IOB_10_ADLIB_ADDR0, iobase + ALS4K_IOB_12_ADLIB_ADDR2, OPL3_HW_AUTO, 1, &opl3) < 0) { - printk(KERN_ERR "als4000: no OPL device at 0x%lx-0x%lx?\n", + dev_err(&pci->dev, "no OPL device at 0x%lx-0x%lx?\n", iobase + ALS4K_IOB_10_ADLIB_ADDR0, iobase + ALS4K_IOB_12_ADLIB_ADDR2); } else { @@ -984,13 +983,11 @@ static void snd_card_als4000_remove(struct pci_dev *pci) { snd_card_free(pci_get_drvdata(pci)); - pci_set_drvdata(pci, NULL); } #ifdef CONFIG_PM_SLEEP static int snd_als4000_suspend(struct device *dev) { - struct pci_dev *pci = to_pci_dev(dev); struct snd_card *card = dev_get_drvdata(dev); struct snd_card_als4000 *acard = card->private_data; struct snd_sb *chip = acard->chip; @@ -999,30 +996,15 @@ snd_pcm_suspend_all(chip->pcm); snd_sbmixer_suspend(chip); - - pci_disable_device(pci); - pci_save_state(pci); - pci_set_power_state(pci, PCI_D3hot); return 0; } static int snd_als4000_resume(struct device *dev) { - struct pci_dev *pci = to_pci_dev(dev); struct snd_card *card = dev_get_drvdata(dev); struct snd_card_als4000 *acard = card->private_data; struct snd_sb *chip = acard->chip; - pci_set_power_state(pci, PCI_D0); - pci_restore_state(pci); - if (pci_enable_device(pci) < 0) { - printk(KERN_ERR "als4000: pci_enable_device failed, " - "disabling device\n"); - snd_card_disconnect(card); - return -EIO; - } - pci_set_master(pci); - snd_als4000_configure(chip); snd_sbdsp_reset(chip); snd_sbmixer_resume(chip);