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

Tiago Vignatti tiago.vignatti at nokia.com
Tue Jun 1 05:22:35 PDT 2010


xf86PciOpenFbDev was created and put inside its proper file.

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
Mark and Alan: I hope this is okay for you now?

 hw/xfree86/fbdevhw/fbdevhw.c         |   25 +++----------------------
 hw/xfree86/fbdevhw/fbdevhw.h         |    2 --
 hw/xfree86/os-support/bus/Pci.h      |    1 +
 hw/xfree86/os-support/bus/bsd_pci.c  |    6 ++++++
 hw/xfree86/os-support/bus/linuxPci.c |   20 ++++++++++++++++++++
 5 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 5a414e7..ac18f06 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -7,14 +7,8 @@
 
 #include "xf86.h"
 #include "xf86_OSproc.h"
-
-/* pci stuff */
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
 #include "Pci.h"
-
 #include "xf86cmap.h"
-
 #include "fbdevhw.h"
 #include "fbpriv.h"
 #include "globals.h"
@@ -277,23 +271,10 @@ fbdev_open_pci(struct pci_device * pPci)
 
 
     /* There are two ways to that we can determine which fb device is
-     * associated with this PCI device.  The more modern way is to look in
-     * the sysfs directory for the PCI device for a file named
-     * "graphics/fb*"
-     */
-
+     * associated with this PCI device. In modern operating system, one way
+     * is to look in the sysfs directory */
     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.h b/hw/xfree86/os-support/bus/Pci.h
index 56eb258..c22e5fc 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -159,5 +159,6 @@
 extern void ARCH_PCI_INIT(void);
 uint64_t xf86PciGetBaseAddr(struct pci_device *pci, int idx);
 uint64_t xf86PciGetSize(struct pci_device *pci, int idx);
+int xf86PciOpenFbdev(struct pci_device *pPci, int num);
 
 #endif /* _PCI_H */
diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c
index 17b52db..58a57f9 100644
--- a/hw/xfree86/os-support/bus/bsd_pci.c
+++ b/hw/xfree86/os-support/bus/bsd_pci.c
@@ -67,3 +67,9 @@ bsdPciInit(void)
 {
     xf86InitVidMem();
 }
+
+int
+xf86PciOpenFbdev(struct pci_device *pPci, int num)
+{
+    return -1;
+}
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 289315e..f650ae7 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -452,3 +452,23 @@ xf86MapLegacyIO(struct pci_device *dev)
     return (IOADDRESS)DomainMmappedIO[domain];
 }
 
+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;
+}
-- 
1.7.1.226.g770c5



More information about the xorg-devel mailing list