[PATCH 6/6] xfree86: fbdevhw: remove all pci symbols from the module

Tiago Vignatti tiago.vignatti at nokia.com
Mon May 31 06:16:56 PDT 2010


xf86PciOpenFbDev was created and put inside its proper file... well, almost
proper because in theory it should go inside linuxPci.c given the nature of
fbdevhw. But that's another story.

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 hw/xfree86/fbdevhw/fbdevhw.c    |   19 ++-----------------
 hw/xfree86/fbdevhw/fbdevhw.h    |    2 --
 hw/xfree86/os-support/bus/Pci.c |   22 ++++++++++++++++++++++
 hw/xfree86/os-support/bus/Pci.h |    2 ++
 4 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 60279ed..d3a6b90 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -7,15 +7,10 @@
 
 #include "xf86.h"
 #include "xf86_OSproc.h"
-
-/* pci stuff */
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-
 #include "xf86cmap.h"
-
 #include "fbdevhw.h"
 #include "fbpriv.h"
+#include "Pci.h"
 
 #define PAGE_MASK               (~(getpagesize() - 1))
 
@@ -284,17 +279,7 @@ fbdev_open_pci(struct pci_device * pPci)
      */
 
     for (i = 0; i < 8; i++) {
-	sprintf(filename, 
-		"/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d",
-		pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
-
-	fd = open(filename, O_RDONLY, 0);
-        if (fd < 0) {
-            sprintf(filename,
-                    "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d",
-                    pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
-            fd = open(filename, O_RDONLY, 0);
-        }
+	fd = xf86PciOpenFbDev(pPci, i);
 	if (fd >= 0) {
 	    close(fd);
 	    sprintf(filename, "/dev/fb%d", i);
diff --git a/hw/xfree86/fbdevhw/fbdevhw.h b/hw/xfree86/fbdevhw/fbdevhw.h
index 60d8985..fe44a8b 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.h
+++ b/hw/xfree86/fbdevhw/fbdevhw.h
@@ -5,8 +5,6 @@
 #include "xf86str.h"
 #include "colormapst.h"
 
-#include <pciaccess.h>
-
 #define FBDEVHW_PACKED_PIXELS		0	/* Packed Pixels	*/
 #define FBDEVHW_PLANES			1	/* Non interleaved planes */
 #define FBDEVHW_INTERLEAVED_PLANES	2	/* Interleaved planes	*/
diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c
index a0a597d..76f00b6 100644
--- a/hw/xfree86/os-support/bus/Pci.c
+++ b/hw/xfree86/os-support/bus/Pci.c
@@ -134,6 +134,7 @@
 #include "Pci.h"
 
 #include <pciaccess.h>
+#include <fcntl.h>
 
 /* Global data */
 
@@ -155,3 +156,24 @@ xf86scanpci(void)
 
     return success;
 }
+
+int
+xf86PciOpenFbDev(struct pci_device *pPci, int num)
+{
+    char filename[256];
+    int fd;
+
+    sprintf(filename,
+        "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d",
+        pPci->domain, pPci->bus, pPci->dev, pPci->func, num);
+
+    fd = open(filename, O_RDONLY, 0);
+    if (fd < 0) {
+        sprintf(filename,
+            "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d",
+            pPci->domain, pPci->bus, pPci->dev, pPci->func, num);
+        fd = open(filename, O_RDONLY, 0);
+    }
+
+    return fd;
+}
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index e001c30..78cf472 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -158,4 +158,6 @@
 
 extern void ARCH_PCI_INIT(void);
 
+int xf86PciOpenFbDev(struct pci_device *pPci, int num);
+
 #endif /* _PCI_H */
-- 
1.7.1.226.g770c5



More information about the xorg-devel mailing list