Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53345
b: refs/heads/master
c: b1e2303
h: refs/heads/master
i:
  53343: c004f0b
v: v3
  • Loading branch information
Michael Ellerman authored and Greg Kroah-Hartman committed May 3, 2007
1 parent d3ac3e0 commit 9fe4910
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3e916c0503a34ba32202a69df1cfeb82f2c5749d
refs/heads/master: b1e2303dba021ee417c65a89e467a2b145ff9217
19 changes: 8 additions & 11 deletions trunk/drivers/pci/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,13 @@ static int msix_capability_init(struct pci_dev *dev,
/**
* pci_msi_supported - check whether MSI may be enabled on device
* @dev: pointer to the pci_dev data structure of MSI device function
* @type: are we checking for MSI or MSI-X ?
*
* Look at global flags, the device itself, and its parent busses
* to return 0 if MSI are supported for the device.
**/
static
int pci_msi_supported(struct pci_dev * dev)
int pci_msi_supported(struct pci_dev * dev, int type)
{
struct pci_bus *bus;

Expand All @@ -482,6 +483,9 @@ int pci_msi_supported(struct pci_dev * dev)
if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
return -EINVAL;

if (!pci_find_capability(dev, type))
return -EINVAL;

return 0;
}

Expand All @@ -497,13 +501,9 @@ int pci_msi_supported(struct pci_dev * dev)
**/
int pci_enable_msi(struct pci_dev* dev)
{
int pos, status;
int status;

if (pci_msi_supported(dev) < 0)
return -EINVAL;

pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
if (!pos)
if (pci_msi_supported(dev, PCI_CAP_ID_MSI))
return -EINVAL;

WARN_ON(!!dev->msi_enabled);
Expand Down Expand Up @@ -606,13 +606,10 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
int i, j;
u16 control;

if (!entries || pci_msi_supported(dev) < 0)
if (!entries || pci_msi_supported(dev, PCI_CAP_ID_MSIX))
return -EINVAL;

pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
if (!pos)
return -EINVAL;

pci_read_config_word(dev, msi_control_reg(pos), &control);
nr_entries = multi_msix_capable(control);
if (nvec > nr_entries)
Expand Down

0 comments on commit 9fe4910

Please sign in to comment.