[PATCH v2 08/14] OdevAttribute: Remove unowned flag from OdevAttributes head

Hans de Goede hdegoede at redhat.com
Tue Feb 4 12:49:14 CET 2014


The OdevAttributes struct should just be a head of the attributes list, and
not contain various unrelated flags. Instead add a flags field to
struct xf86_platform_device and use that.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 hw/xfree86/common/xf86Module.h             |  2 +-
 hw/xfree86/common/xf86platformBus.c        | 11 +++++++----
 hw/xfree86/common/xf86platformBus.h        |  6 +++++-
 hw/xfree86/os-support/linux/lnx_platform.c |  5 ++---
 include/hotplug.h                          |  1 -
 5 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 96ac3b0..e8c24f2 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -80,7 +80,7 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(15, 0)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(16, 0)
 #define ABI_XINPUT_VERSION	SET_ABI_VERSION(21, 0)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(8, 0)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 7a9600a..97d606a 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -55,7 +55,7 @@ int xf86_num_platform_devices;
 static struct xf86_platform_device *xf86_platform_devices;
 
 int
-xf86_add_platform_device(struct OdevAttributes *attribs)
+xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned)
 {
     xf86_platform_devices = xnfrealloc(xf86_platform_devices,
                                    (sizeof(struct xf86_platform_device)
@@ -63,6 +63,8 @@ xf86_add_platform_device(struct OdevAttributes *attribs)
 
     xf86_platform_devices[xf86_num_platform_devices].attribs = attribs;
     xf86_platform_devices[xf86_num_platform_devices].pdev = NULL;
+    xf86_platform_devices[xf86_num_platform_devices].flags =
+        unowned ? XF86_PDEV_UNOWNED : 0;
 
     xf86_num_platform_devices++;
     return 0;
@@ -122,7 +124,8 @@ xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int att
 Bool
 xf86_get_platform_device_unowned(int index)
 {
-    return xf86_platform_devices[index].attribs->unowned;
+    return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ?
+        TRUE : FALSE;
 }
 
 /*
@@ -529,10 +532,10 @@ void xf86platformVTProbe(void)
     int i;
 
     for (i = 0; i < xf86_num_platform_devices; i++) {
-        if (xf86_platform_devices[i].attribs->unowned == FALSE)
+        if (!(xf86_platform_devices[i].flags & XF86_PDEV_UNOWNED))
             continue;
 
-        xf86_platform_devices[i].attribs->unowned = FALSE;
+        xf86_platform_devices[i].flags &= ~XF86_PDEV_UNOWNED;
         xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs);
     }
 }
diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h
index d764026..9a49260 100644
--- a/hw/xfree86/common/xf86platformBus.h
+++ b/hw/xfree86/common/xf86platformBus.h
@@ -30,8 +30,12 @@ struct xf86_platform_device {
     struct OdevAttributes *attribs;
     /* for PCI devices */
     struct pci_device *pdev;
+    int flags;
 };
 
+/* xf86_platform_device flags */
+#define XF86_PDEV_UNOWNED       0x01
+
 #ifdef XSERVER_PLATFORM_BUS
 int xf86platformProbe(void);
 int xf86platformProbeDev(DriverPtr drvp);
@@ -43,7 +47,7 @@ xf86_get_platform_attrib(int index, int attrib_id);
 extern int
 xf86_get_platform_int_attrib(int index, int attrib_id, int def);
 extern int
-xf86_add_platform_device(struct OdevAttributes *attribs);
+xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned);
 extern int
 xf86_remove_platform_device(int dev_index);
 extern Bool
diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 4317209..f4c4d12 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -44,7 +44,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
 
     /* for a delayed probe we've already added the device */
     if (delayed_index == -1) {
-            xf86_add_platform_device(attribs);
+            xf86_add_platform_device(attribs, FALSE);
             delayed_index = xf86_num_platform_devices - 1;
     }
 
@@ -142,8 +142,7 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
     if (!xf86VTOwner()) {
             /* if we don't currently own the VT then don't probe the device,
                just mark it as unowned for later use */
-            attribs->unowned = TRUE;
-            xf86_add_platform_device(attribs);
+            xf86_add_platform_device(attribs, TRUE);
             return;
     }
 
diff --git a/include/hotplug.h b/include/hotplug.h
index 6aa7d8d..70d80f8 100644
--- a/include/hotplug.h
+++ b/include/hotplug.h
@@ -46,7 +46,6 @@ struct OdevAttribute {
 
 struct OdevAttributes {
     struct xorg_list list;
-    Bool unowned;
 };
 
 struct OdevAttributes *
-- 
1.8.5.3



More information about the xorg-devel mailing list