--- zzzz-none-000/linux-3.10.107/sound/pci/bt87x.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/pci/bt87x.c 2021-02-04 17:41:59.000000000 +0000 @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -293,17 +293,23 @@ PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY; pci_write_config_word(chip->pci, PCI_STATUS, pci_status); if (pci_status != PCI_STATUS_DETECTED_PARITY) - snd_printk(KERN_ERR "Aieee - PCI error! status %#08x, PCI status %#04x\n", + dev_err(chip->card->dev, + "Aieee - PCI error! status %#08x, PCI status %#04x\n", status & ERROR_INTERRUPTS, pci_status); else { - snd_printk(KERN_ERR "Aieee - PCI parity error detected!\n"); + dev_err(chip->card->dev, + "Aieee - PCI parity error detected!\n"); /* error 'handling' similar to aic7xxx_pci.c: */ chip->pci_parity_errors++; if (chip->pci_parity_errors > 20) { - snd_printk(KERN_ERR "Too many PCI parity errors observed.\n"); - snd_printk(KERN_ERR "Some device on this bus is generating bad parity.\n"); - snd_printk(KERN_ERR "This is an error *observed by*, not *generated by*, this card.\n"); - snd_printk(KERN_ERR "PCI parity error checking has been disabled.\n"); + dev_err(chip->card->dev, + "Too many PCI parity errors observed.\n"); + dev_err(chip->card->dev, + "Some device on this bus is generating bad parity.\n"); + dev_err(chip->card->dev, + "This is an error *observed by*, not *generated by*, this card.\n"); + dev_err(chip->card->dev, + "PCI parity error checking has been disabled.\n"); chip->interrupt_mask &= ~(INT_PPERR | INT_RIPERR); snd_bt87x_writel(chip, REG_INT_MASK, chip->interrupt_mask); } @@ -323,9 +329,11 @@ if (irq_status & ERROR_INTERRUPTS) { if (irq_status & (INT_FBUS | INT_FTRGT)) - snd_printk(KERN_WARNING "FIFO overrun, status %#08x\n", status); + dev_warn(chip->card->dev, + "FIFO overrun, status %#08x\n", status); if (irq_status & INT_OCERR) - snd_printk(KERN_ERR "internal RISC error, status %#08x\n", status); + dev_err(chip->card->dev, + "internal RISC error, status %#08x\n", status); if (irq_status & (INT_PPERR | INT_RIPERR | INT_PABORT)) snd_bt87x_pci_error(chip, irq_status); } @@ -435,7 +443,7 @@ _error: clear_bit(0, &chip->opened); - smp_mb__after_clear_bit(); + smp_mb__after_atomic(); return err; } @@ -450,7 +458,7 @@ chip->substream = NULL; clear_bit(0, &chip->opened); - smp_mb__after_clear_bit(); + smp_mb__after_atomic(); return 0; } @@ -682,8 +690,7 @@ snd_bt87x_stop(chip); if (chip->irq >= 0) free_irq(chip->irq, chip); - if (chip->mmio) - iounmap(chip->mmio); + iounmap(chip->mmio); pci_release_regions(chip->pci); pci_disable_device(chip->pci); kfree(chip); @@ -747,7 +754,7 @@ } chip->mmio = pci_ioremap_bar(pci, 0); if (!chip->mmio) { - snd_printk(KERN_ERR "cannot remap io memory\n"); + dev_err(card->dev, "cannot remap io memory\n"); err = -ENOMEM; goto fail; } @@ -762,7 +769,7 @@ err = request_irq(pci->irq, snd_bt87x_interrupt, IRQF_SHARED, KBUILD_MODNAME, chip); if (err < 0) { - snd_printk(KERN_ERR "cannot grab irq %d\n", pci->irq); + dev_err(card->dev, "cannot grab irq %d\n", pci->irq); goto fail; } chip->irq = pci->irq; @@ -773,7 +780,6 @@ if (err < 0) goto fail; - snd_card_set_dev(card, &pci->dev); *rchip = chip; return 0; @@ -789,7 +795,7 @@ .driver_data = SND_BT87X_BOARD_ ## id } /* driver_data is the card id for that device */ -static DEFINE_PCI_DEVICE_TABLE(snd_bt87x_ids) = { +static const struct pci_device_id snd_bt87x_ids[] = { /* Hauppauge WinTV series */ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0x13eb, GENERIC), /* Hauppauge WinTV series */ @@ -851,14 +857,15 @@ for (i = 0; i < ARRAY_SIZE(blacklist); ++i) if (blacklist[i].subvendor == pci->subsystem_vendor && blacklist[i].subdevice == pci->subsystem_device) { - snd_printdd(KERN_INFO "card %#04x-%#04x:%#04x has no audio\n", + dev_dbg(&pci->dev, + "card %#04x-%#04x:%#04x has no audio\n", pci->device, pci->subsystem_vendor, pci->subsystem_device); return -EBUSY; } - snd_printk(KERN_INFO "unknown card %#04x-%#04x:%#04x\n", + dev_info(&pci->dev, "unknown card %#04x-%#04x:%#04x\n", pci->device, pci->subsystem_vendor, pci->subsystem_device); - snd_printk(KERN_DEBUG "please mail id, board name, and, " + dev_info(&pci->dev, "please mail id, board name, and, " "if it works, the correct digital_rate option to " "\n"); return SND_BT87X_BOARD_UNKNOWN; @@ -888,7 +895,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; @@ -925,7 +933,7 @@ if (err < 0) goto _error; } - snd_printk(KERN_INFO "bt87x%d: Using board %d, %sanalog, %sdigital " + dev_info(card->dev, "bt87x%d: Using board %d, %sanalog, %sdigital " "(rate %d Hz)\n", dev, boardid, chip->board.no_analog ? "no " : "", chip->board.no_digital ? "no " : "", chip->board.dig_rate); @@ -953,12 +961,11 @@ static void snd_bt87x_remove(struct pci_dev *pci) { snd_card_free(pci_get_drvdata(pci)); - pci_set_drvdata(pci, NULL); } /* default entries for all Bt87x cards - it's not exported */ /* driver_data is set to 0 to call detection */ -static DEFINE_PCI_DEVICE_TABLE(snd_bt87x_default_ids) = { +static const struct pci_device_id snd_bt87x_default_ids[] = { BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, PCI_ANY_ID, PCI_ANY_ID, UNKNOWN), BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, PCI_ANY_ID, PCI_ANY_ID, UNKNOWN), { }