compat: backport pci_enable_device_mem()
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Tue, 24 Apr 2012 04:33:30 +0000 (21:33 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Tue, 24 Apr 2012 04:34:48 +0000 (21:34 -0700)
To backport b718989d correctly which added pci_enable_device_mem()
the routine pcibios_enable_device() is required but we don't
have access to it on modules as its an architecture specific
routine that is not exported and as such only core kernel code
has access to it. We implement a sloppy work around for
backporting this.

mcgrof@tux ~/compat (git::master)$ ckmake
Trying kernel                  3.4.0-030400rc1-generic  [OK]
Trying kernel                  3.3.0-030300rc2-generic  [OK]
Trying kernel                     3.2.2-030202-generic  [OK]
Trying kernel                    3.1.10-030110-generic  [OK]
Trying kernel                    3.0.18-030018-generic  [OK]
Trying kernel                  2.6.39-02063904-generic  [OK]
Trying kernel                  2.6.38-02063808-generic  [OK]
Trying kernel                  2.6.37-02063706-generic  [OK]
Trying kernel                  2.6.36-02063604-generic  [OK]
Trying kernel                  2.6.35-02063512-generic  [OK]
Trying kernel                  2.6.34-02063410-generic  [OK]
Trying kernel                  2.6.33-02063305-generic  [OK]
Trying kernel                  2.6.32-02063255-generic  [OK]
Trying kernel                  2.6.31-02063113-generic  [OK]
Trying kernel                  2.6.30-02063010-generic  [OK]
Trying kernel                  2.6.29-02062906-generic  [OK]
Trying kernel                  2.6.28-02062810-generic  [OK]
Trying kernel                    2.6.27-020627-generic  [OK]
Trying kernel                    2.6.26-020626-generic  [OK]
Trying kernel                    2.6.25-020625-generic  [OK]
Trying kernel                    2.6.24-020624-generic  [OK]

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
compat/compat-2.6.25.c
include/linux/compat-2.6.25.h

index 2e9c3a8..1550024 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007-2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
+ * Copyright 2007-2012 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -9,6 +9,23 @@
  */
 
 #include <linux/miscdevice.h>
+#include <linux/pci.h>
+
+/*
+ * To backport b718989d correctly pcibios_enable_device()
+ * is required but we don't have access to it on modules
+ * as its an architecture specific routine that is not
+ * exported and as such only core kernel code has access
+ * to it. We implement a sloppy work around for backporting
+ * this.
+ */
+int pci_enable_device_mem(struct pci_dev *dev)
+{
+       int bars = pci_select_bars(dev, IORESOURCE_MEM);
+
+       return pci_enable_device_bars(dev, bars);
+}
+EXPORT_SYMBOL_GPL(pci_enable_device_mem);
 
 /**
  * The following things are out of ./lib/vsprintf.c
index d0cd50b..356186d 100644 (file)
 #include <linux/in.h>
 #include <linux/errno.h>
 #include <linux/init.h>
+#include <linux/pci.h>
+
+/* Backports b718989da7 */
+int __must_check pci_enable_device_mem(struct pci_dev *dev);
 
 /*
  * Backports 312b1485fb509c9bc32eda28ad29537896658cb8