OdevAttribute: Remove unowned flag from OdevAttributes head

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@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Hans de Goede 2014-02-02 13:54:33 +01:00
parent bc9d17fb56
commit a8d802cb01
5 changed files with 15 additions and 10 deletions

View File

@ -80,7 +80,7 @@ typedef enum {
* mask is 0xFFFF0000. * mask is 0xFFFF0000.
*/ */
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #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_XINPUT_VERSION SET_ABI_VERSION(21, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(8, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(8, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)

View File

@ -55,7 +55,7 @@ int xf86_num_platform_devices;
static struct xf86_platform_device *xf86_platform_devices; static struct xf86_platform_device *xf86_platform_devices;
int int
xf86_add_platform_device(struct OdevAttributes *attribs) xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned)
{ {
xf86_platform_devices = xnfrealloc(xf86_platform_devices, xf86_platform_devices = xnfrealloc(xf86_platform_devices,
(sizeof(struct xf86_platform_device) (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].attribs = attribs;
xf86_platform_devices[xf86_num_platform_devices].pdev = NULL; 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++; xf86_num_platform_devices++;
return 0; return 0;
@ -122,7 +124,8 @@ xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int att
Bool Bool
xf86_get_platform_device_unowned(int index) 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; int i;
for (i = 0; i < xf86_num_platform_devices; 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; continue;
xf86_platform_devices[i].attribs->unowned = FALSE; xf86_platform_devices[i].flags &= ~XF86_PDEV_UNOWNED;
xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs); xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs);
} }
} }

View File

@ -30,8 +30,12 @@ struct xf86_platform_device {
struct OdevAttributes *attribs; struct OdevAttributes *attribs;
/* for PCI devices */ /* for PCI devices */
struct pci_device *pdev; struct pci_device *pdev;
int flags;
}; };
/* xf86_platform_device flags */
#define XF86_PDEV_UNOWNED 0x01
#ifdef XSERVER_PLATFORM_BUS #ifdef XSERVER_PLATFORM_BUS
int xf86platformProbe(void); int xf86platformProbe(void);
int xf86platformProbeDev(DriverPtr drvp); int xf86platformProbeDev(DriverPtr drvp);
@ -43,7 +47,7 @@ xf86_get_platform_attrib(int index, int attrib_id);
extern int extern int
xf86_get_platform_int_attrib(int index, int attrib_id, int def); xf86_get_platform_int_attrib(int index, int attrib_id, int def);
extern int extern int
xf86_add_platform_device(struct OdevAttributes *attribs); xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned);
extern int extern int
xf86_remove_platform_device(int dev_index); xf86_remove_platform_device(int dev_index);
extern Bool extern Bool

View File

@ -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 */ /* for a delayed probe we've already added the device */
if (delayed_index == -1) { if (delayed_index == -1) {
xf86_add_platform_device(attribs); xf86_add_platform_device(attribs, FALSE);
delayed_index = xf86_num_platform_devices - 1; delayed_index = xf86_num_platform_devices - 1;
} }
@ -142,8 +142,7 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
if (!xf86VTOwner()) { if (!xf86VTOwner()) {
/* if we don't currently own the VT then don't probe the device, /* if we don't currently own the VT then don't probe the device,
just mark it as unowned for later use */ just mark it as unowned for later use */
attribs->unowned = TRUE; xf86_add_platform_device(attribs, TRUE);
xf86_add_platform_device(attribs);
return; return;
} }

View File

@ -46,7 +46,6 @@ struct OdevAttribute {
struct OdevAttributes { struct OdevAttributes {
struct xorg_list list; struct xorg_list list;
Bool unowned;
}; };
struct OdevAttributes * struct OdevAttributes *