Skip to content

Commit

Permalink
ALSA: hda: intel: Switch to pci_alloc_irq_vectors API
Browse files Browse the repository at this point in the history
Switch from legacy pci_msi_enable()/pci_intx() API to the
pci_alloc_irq_vectors API.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/11c60429-9435-4666-8e27-77160abef68e@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
hkallweit authored and tiwai committed Nov 4, 2024
1 parent cac99f7 commit 149cb7d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,14 @@ static void azx_clear_irq_pending(struct azx *chip)
static int azx_acquire_irq(struct azx *chip, int do_disconnect)
{
struct hdac_bus *bus = azx_bus(chip);
int ret;

if (!chip->msi || pci_alloc_irq_vectors(chip->pci, 1, 1, PCI_IRQ_MSI) < 0) {
ret = pci_alloc_irq_vectors(chip->pci, 1, 1, PCI_IRQ_INTX);
if (ret < 0)
return ret;
chip->msi = 0;
}

if (request_irq(chip->pci->irq, azx_interrupt,
chip->msi ? 0 : IRQF_SHARED,
Expand All @@ -786,7 +794,6 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect)
}
bus->irq = chip->pci->irq;
chip->card->sync_irq = bus->irq;
pci_intx(chip->pci, !chip->msi);
return 0;
}

Expand Down Expand Up @@ -1879,13 +1886,9 @@ static int azx_first_init(struct azx *chip)
chip->gts_present = true;
#endif

if (chip->msi) {
if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
dev_dbg(card->dev, "Disabling 64bit MSI\n");
pci->no_64bit_msi = true;
}
if (pci_enable_msi(pci) < 0)
chip->msi = 0;
if (chip->msi && chip->driver_caps & AZX_DCAPS_NO_MSI64) {
dev_dbg(card->dev, "Disabling 64bit MSI\n");
pci->no_64bit_msi = true;
}

pci_set_master(pci);
Expand Down Expand Up @@ -2037,7 +2040,7 @@ static int disable_msi_reset_irq(struct azx *chip)
free_irq(bus->irq, chip);
bus->irq = -1;
chip->card->sync_irq = -1;
pci_disable_msi(chip->pci);
pci_free_irq_vectors(chip->pci);
chip->msi = 0;
err = azx_acquire_irq(chip, 1);
if (err < 0)
Expand Down

0 comments on commit 149cb7d

Please sign in to comment.