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

Tiago Vignatti tiago.vignatti at nokia.com
Thu Aug 26 08:37:34 PDT 2010


xf86PciOpenFbdev was created and put inside its proper file.

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 hw/xfree86/fbdevhw/fbdevhw.c         |   25 +++----------------------
 hw/xfree86/fbdevhw/fbdevhw.h         |    2 --
 hw/xfree86/os-support/bus/bsd_pci.c  |    6 ++++++
 hw/xfree86/os-support/bus/linuxPci.c |   20 ++++++++++++++++++++
 hw/xfree86/os-support/bus/xf86Pci.h  |    1 +
 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/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;
+}
diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h
index ce1336b..0ab7080 100644
--- a/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/hw/xfree86/os-support/bus/xf86Pci.h
@@ -253,6 +253,7 @@ typedef enum {
 /* Public PCI access functions */
 extern _X_EXPORT PCITAG pciTag(int busnum, int devnum, int funcnum);
 extern _X_EXPORT Bool xf86scanpci(void);
+extern _X_EXPORT int xf86PciOpenFbdev(struct pci_device *pPci, int num);
 
 /* Domain access functions.  Some of these probably shouldn't be public */
 extern _X_EXPORT pointer xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
-- 
1.7.1.226.g770c5



More information about the xorg-devel mailing list