aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-01-02 16:57:24 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-02-22 19:15:21 -0500
commit93177a748ba0d4f3d3e51c8e6c785773bf6a70df (patch)
tree1207e03e87d1b68a54ff159c9a8a2f279ea0b6a1
parent3804259475314a50e4d7a8a974a22fddb6ac7dd7 (diff)
PCI: Clean up build for CONFIG_PCI_QUIRKS unset
Currently, drivers/pci/quirks.c is built unconditionally, but if CONFIG_PCI_QUIRKS is unset, the only things actually built in this file are definitions of global variables and empty functions (due to the #ifdef CONFIG_PCI_QUIRKS embracing all of the code inside the file). This is not particularly nice and if someone overlooks the #ifdef CONFIG_PCI_QUIRKS, build errors are introduced. To clean that up, move the definitions of the global variables in quirks.c that are always built to pci.c, move the definitions of the empty functions (compiled when CONFIG_PCI_QUIRKS is unset) to headers (additionally make these functions static inline) and modify drivers/pci/Makefile so that quirks.c is only built if CONFIG_PCI_QUIRKS is set. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--drivers/pci/Makefile4
-rw-r--r--drivers/pci/pci.c7
-rw-r--r--drivers/pci/pci.h7
-rw-r--r--drivers/pci/quirks.c14
-rw-r--r--include/linux/pci.h6
5 files changed, 23 insertions, 15 deletions
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 4df48d58eaa6..adb74253a996 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -2,12 +2,14 @@
2# Makefile for the PCI bus specific drivers. 2# Makefile for the PCI bus specific drivers.
3# 3#
4 4
5obj-y += access.o bus.o probe.o remove.o pci.o quirks.o \ 5obj-y += access.o bus.o probe.o remove.o pci.o \
6 pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \ 6 pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
7 irq.o 7 irq.o
8obj-$(CONFIG_PROC_FS) += proc.o 8obj-$(CONFIG_PROC_FS) += proc.o
9obj-$(CONFIG_SYSFS) += slot.o 9obj-$(CONFIG_SYSFS) += slot.o
10 10
11obj-$(CONFIG_PCI_QUIRKS) += quirks.o
12
11obj-$(CONFIG_PCI_LEGACY) += legacy.o 13obj-$(CONFIG_PCI_LEGACY) += legacy.o
12CFLAGS_legacy.o += -Wno-deprecated-declarations 14CFLAGS_legacy.o += -Wno-deprecated-declarations
13 15
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 315fea47e784..1f9be53c39ba 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -19,7 +19,6 @@
19#include <linux/pci-aspm.h> 19#include <linux/pci-aspm.h>
20#include <linux/pm_wakeup.h> 20#include <linux/pm_wakeup.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <asm/dma.h> /* isa_dma_bridge_buggy */
23#include <linux/device.h> 22#include <linux/device.h>
24#include <asm/setup.h> 23#include <asm/setup.h>
25#include "pci.h" 24#include "pci.h"
@@ -29,6 +28,12 @@ const char *pci_power_names[] = {
29}; 28};
30EXPORT_SYMBOL_GPL(pci_power_names); 29EXPORT_SYMBOL_GPL(pci_power_names);
31 30
31int isa_dma_bridge_buggy;
32EXPORT_SYMBOL(isa_dma_bridge_buggy);
33
34int pci_pci_problems;
35EXPORT_SYMBOL(pci_pci_problems);
36
32unsigned int pci_pm_d3_delay; 37unsigned int pci_pm_d3_delay;
33 38
34static void pci_dev_d3_sleep(struct pci_dev *dev) 39static void pci_dev_d3_sleep(struct pci_dev *dev)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index fbd0e3adbca3..5d169bc3ccd1 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -319,6 +319,13 @@ struct pci_dev_reset_methods {
319 int (*reset)(struct pci_dev *dev, int probe); 319 int (*reset)(struct pci_dev *dev, int probe);
320}; 320};
321 321
322#ifdef CONFIG_PCI_QUIRKS
322extern int pci_dev_specific_reset(struct pci_dev *dev, int probe); 323extern int pci_dev_specific_reset(struct pci_dev *dev, int probe);
324#else
325static inline int pci_dev_specific_reset(struct pci_dev *dev, int probe)
326{
327 return -ENOTTY;
328}
329#endif
323 330
324#endif /* DRIVERS_PCI_H */ 331#endif /* DRIVERS_PCI_H */
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index d58b94030ef3..790eb69a4aa9 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -25,14 +25,9 @@
25#include <linux/dmi.h> 25#include <linux/dmi.h>
26#include <linux/pci-aspm.h> 26#include <linux/pci-aspm.h>
27#include <linux/ioport.h> 27#include <linux/ioport.h>
28#include <asm/dma.h> /* isa_dma_bridge_buggy */
28#include "pci.h" 29#include "pci.h"
29 30
30int isa_dma_bridge_buggy;
31EXPORT_SYMBOL(isa_dma_bridge_buggy);
32int pci_pci_problems;
33EXPORT_SYMBOL(pci_pci_problems);
34
35#ifdef CONFIG_PCI_QUIRKS
36/* 31/*
37 * This quirk function disables memory decoding and releases memory resources 32 * This quirk function disables memory decoding and releases memory resources
38 * of the device specified by kernel's boot parameter 'pci=resource_alignment='. 33 * of the device specified by kernel's boot parameter 'pci=resource_alignment='.
@@ -2612,6 +2607,7 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
2612 } 2607 }
2613 pci_do_fixups(dev, start, end); 2608 pci_do_fixups(dev, start, end);
2614} 2609}
2610EXPORT_SYMBOL(pci_fixup_device);
2615 2611
2616static int __init pci_apply_final_quirks(void) 2612static int __init pci_apply_final_quirks(void)
2617{ 2613{
@@ -2723,9 +2719,3 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
2723 2719
2724 return -ENOTTY; 2720 return -ENOTTY;
2725} 2721}
2726
2727#else
2728void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
2729int pci_dev_specific_reset(struct pci_dev *dev, int probe) { return -ENOTTY; }
2730#endif
2731EXPORT_SYMBOL(pci_fixup_device);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0c3a29444f89..16f48e7506ed 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1271,8 +1271,12 @@ enum pci_fixup_pass {
1271 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1271 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1272 suspend##vendor##device##hook, vendor, device, hook) 1272 suspend##vendor##device##hook, vendor, device, hook)
1273 1273
1274 1274#ifdef CONFIG_PCI_QUIRKS
1275void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1275void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1276#else
1277static inline void pci_fixup_device(enum pci_fixup_pass pass,
1278 struct pci_dev *dev) {}
1279#endif
1276 1280
1277void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1281void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
1278void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1282void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);