Skip to content

Commit

Permalink
[media] cobalt: use pci_irq_allocate_vectors()
Browse files Browse the repository at this point in the history
Simplify the interrupt setup by using the new PCI layer helpers.

Despite using pci_enable_msi_range(), this driver was only requesting a
single MSI vector anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Christoph Hellwig authored and Bjorn Helgaas committed Jan 13, 2017
1 parent dadf173 commit e8e8dd6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 2 additions & 6 deletions drivers/media/pci/cobalt/cobalt-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ static void cobalt_pci_iounmap(struct cobalt *cobalt, struct pci_dev *pci_dev)
static void cobalt_free_msi(struct cobalt *cobalt, struct pci_dev *pci_dev)
{
free_irq(pci_dev->irq, (void *)cobalt);

if (cobalt->msi_enabled)
pci_disable_msi(pci_dev);
pci_free_irq_vectors(pci_dev);
}

static int cobalt_setup_pci(struct cobalt *cobalt, struct pci_dev *pci_dev,
Expand Down Expand Up @@ -387,14 +385,12 @@ static int cobalt_setup_pci(struct cobalt *cobalt, struct pci_dev *pci_dev,
from being generated. */
cobalt_set_interrupt(cobalt, false);

if (pci_enable_msi_range(pci_dev, 1, 1) < 1) {
if (pci_alloc_irq_vectors(pci_dev, 1, 1, PCI_IRQ_MSI) < 1) {
cobalt_err("Could not enable MSI\n");
cobalt->msi_enabled = false;
ret = -EIO;
goto err_release;
}
msi_config_show(cobalt, pci_dev);
cobalt->msi_enabled = true;

/* Register IRQ */
if (request_irq(pci_dev->irq, cobalt_irq_handler, IRQF_SHARED,
Expand Down
2 changes: 0 additions & 2 deletions drivers/media/pci/cobalt/cobalt-driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ struct cobalt {
u32 irq_none;
u32 irq_full_fifo;

bool msi_enabled;

/* omnitek dma */
int dma_channels;
int first_fifo_channel;
Expand Down

0 comments on commit e8e8dd6

Please sign in to comment.