ahci: use pci_alloc_irq_vectors
authorChristoph Hellwig <hch@lst.de>
Mon, 5 Sep 2016 15:21:45 +0000 (17:21 +0200)
committerTejun Heo <tj@kernel.org>
Tue, 6 Sep 2016 16:38:17 +0000 (12:38 -0400)
commit0b9e2988ab2261fd6d4a0039edf81ed1e3662be8
tree75dbefd4076fca402d2c62b4e62bd0e4469439e0
parent2536524a91fe5c5a9fddd282fd4e79ee0976aefe
ahci: use pci_alloc_irq_vectors

Use the new pci_alloc_irq_vectors API to allocate MSI-X and MSI vectors.
The big advantage over the old code is that we can use the same API for
MSI and MSI-X, and that we don't need to store the MSI-X vector mapping
in driver-private data structures.

This first conversion keeps the probe order as-is: MSI-X multi vector,
MSI multi vector, MSI single vector, MSI-X single vector and last a
single least legacy interrupt line.  There is one small change of
behavior: we now check the "MSI Revert to Single Message" flag for
MSI-X in addition to MSI.

Because the API to find the Linux IRQ number for a MSI/MSI-X vector
is PCI specific, but libahaci is bus-agnostic I had to a
get_irq_vector function pointer to struct ahci_host_priv.  The
alternative would be to move the multi-vector case of ahci_host_activate
to ahci.c and just call ata_host_activate directly from the others
users of ahci_host_activate.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/ahci.c
drivers/ata/ahci.h
drivers/ata/libahci.c