summaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-24 00:12:35 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-24 00:12:35 +0000
commit482368b1a8e45430672c58c9a42e7d2004367126 (patch)
treece2a1a567d4d62dee7c2e71a46a99cf72cf1d606 /include/linux/pci.h
parente4d0251c6f56ab2e191afb70f80f382793e23f74 (diff)
Merge with 2.3.47. Guys, this is buggy as shit. You've been warned.
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8fae97e9b..eda945b6c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -286,6 +286,12 @@
#include <linux/ioport.h>
#include <linux/list.h>
+/* This defines the direction arg to the DMA mapping routines. */
+#define PCI_DMA_BIDIRECTIONAL 0
+#define PCI_DMA_TODEVICE 1
+#define PCI_DMA_FROMDEVICE 2
+#define PCI_DMA_NONE 3
+
#include <asm/pci.h>
#define DEVICE_COUNT_COMPATIBLE 4
@@ -568,7 +574,39 @@ unsigned int ss_vendor, unsigned int ss_device, const struct pci_dev *from)
{ return NULL; }
extern inline void pci_set_master(struct pci_dev *dev) { }
-extern inline int pci_enable_device(struct pci_dev *dev) { return 0; }
+extern inline int pci_enable_device(struct pci_dev *dev) { return -EIO; }
+extern inline int pci_module_init(struct pci_driver *drv) { return -ENODEV; }
+
+#else
+
+/*
+ * a helper function which helps ensure correct pci_driver
+ * setup and cleanup for commonly-encountered hotplug/modular cases
+ *
+ * This MUST stay in a header, as it checks for -DMODULE
+ */
+extern inline int pci_module_init(struct pci_driver *drv)
+{
+ int rc = pci_register_driver (drv);
+
+ if (rc > 0)
+ return 0;
+
+ /* iff CONFIG_HOTPLUG and built into kernel, we should
+ * leave the driver around for future hotplug events.
+ * For the module case, a hotplug daemon of some sort
+ * should load a module in response to an insert event. */
+#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
+ if (rc == 0)
+ return 0;
+#endif
+
+ /* if we get here, we need to clean up pci driver instance
+ * and return some sort of error */
+ pci_unregister_driver (drv);
+
+ return -ENODEV;
+}
#endif /* !CONFIG_PCI */