Skip to content

Commit

Permalink
PCI: Fix build if quirks are not enabled
Browse files Browse the repository at this point in the history
After commit b9c3b26 ("PCI: support
device-specific reset methods") the kernel build is broken if
CONFIG_PCI_QUIRKS is unset.

Fix this by moving pci_dev_specific_reset() to drivers/pci/quirks.c and
providing an empty replacement for !CONFIG_PCI_QUIRKS builds.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Dec 31, 2009
1 parent 9de5460 commit 5b889bf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
15 changes: 0 additions & 15 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2284,21 +2284,6 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
return 0;
}

static int pci_dev_specific_reset(struct pci_dev *dev, int probe)
{
struct pci_dev_reset_methods *i;

for (i = pci_dev_reset_methods; i->reset; i++) {
if ((i->vendor == dev->vendor ||
i->vendor == (u16)PCI_ANY_ID) &&
(i->device == dev->device ||
i->device == (u16)PCI_ANY_ID))
return i->reset(dev, probe);
}

return -ENOTTY;
}

static int pci_dev_reset(struct pci_dev *dev, int probe)
{
int rc;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,6 @@ struct pci_dev_reset_methods {
int (*reset)(struct pci_dev *dev, int probe);
};

extern struct pci_dev_reset_methods pci_dev_reset_methods[];
extern int pci_dev_specific_reset(struct pci_dev *dev, int probe);

#endif /* DRIVERS_PCI_H */
19 changes: 18 additions & 1 deletion drivers/pci/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2684,14 +2684,31 @@ static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe)

#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed

struct pci_dev_reset_methods pci_dev_reset_methods[] = {
static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF,
reset_intel_82599_sfp_virtfn },
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
reset_intel_generic_dev },
{ 0 }
};

int pci_dev_specific_reset(struct pci_dev *dev, int probe)
{
struct pci_dev_reset_methods *i;

for (i = pci_dev_reset_methods; i->reset; i++) {
if ((i->vendor == dev->vendor ||
i->vendor == (u16)PCI_ANY_ID) &&
(i->device == dev->device ||
i->device == (u16)PCI_ANY_ID))
return i->reset(dev, probe);
}

return -ENOTTY;
}

#else
void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
int pci_dev_specific_reset(struct pci_dev *dev, int probe) { return -ENOTTY; }
#endif
EXPORT_SYMBOL(pci_fixup_device);

0 comments on commit 5b889bf

Please sign in to comment.