diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h index de39d6fc0..190762017 100644 --- a/hw/xfree86/common/xf86platformBus.h +++ b/hw/xfree86/common/xf86platformBus.h @@ -33,12 +33,6 @@ struct xf86_platform_device { int flags; }; -_X_EXPORT char * -_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0]); - -_X_EXPORT int -_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0]); - extern _X_EXPORT Bool xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid); diff --git a/hw/xfree86/common/xf86platformBus_priv.h b/hw/xfree86/common/xf86platformBus_priv.h index 0be91977a..619e15789 100644 --- a/hw/xfree86/common/xf86platformBus_priv.h +++ b/hw/xfree86/common/xf86platformBus_priv.h @@ -79,6 +79,24 @@ xf86_platform_odev_attributes(int index) #define _ODEV_ATTRIB_STRING_CHECK(x) ((int (*)[_ODEV_ATTRIB_IS_STRING(x)-1]) 0) +static inline char * +_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0]) +{ + switch (attrib) { + case ODEV_ATTRIB_PATH: + return xf86_platform_device_odev_attributes(device)->path; + case ODEV_ATTRIB_SYSPATH: + return xf86_platform_device_odev_attributes(device)->syspath; + case ODEV_ATTRIB_BUSID: + return xf86_platform_device_odev_attributes(device)->busid; + case ODEV_ATTRIB_DRIVER: + return xf86_platform_device_odev_attributes(device)->driver; + default: + assert(FALSE); + return NULL; + } +} + #define xf86_get_platform_device_attrib(device, attrib) _xf86_get_platform_device_attrib(device,attrib,_ODEV_ATTRIB_STRING_CHECK(attrib)) #define _ODEV_ATTRIB_IS_INT(x) ((x) == ODEV_ATTRIB_FD || (x) == ODEV_ATTRIB_MAJOR || (x) == ODEV_ATTRIB_MINOR) @@ -86,6 +104,22 @@ xf86_platform_odev_attributes(int index) #define _ODEV_ATTRIB_DEFAULT_CHECK(x,def) (_ODEV_ATTRIB_INT_DEFAULT(x) == (def)) #define _ODEV_ATTRIB_INT_CHECK(x,def) ((int (*)[_ODEV_ATTRIB_IS_INT(x)*_ODEV_ATTRIB_DEFAULT_CHECK(x,def)-1]) 0) +static inline int +_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0]) +{ + switch (attrib) { + case ODEV_ATTRIB_FD: + return xf86_platform_device_odev_attributes(device)->fd; + case ODEV_ATTRIB_MAJOR: + return xf86_platform_device_odev_attributes(device)->major; + case ODEV_ATTRIB_MINOR: + return xf86_platform_device_odev_attributes(device)->minor; + default: + assert(FALSE); + return 0; + } +} + #define xf86_get_platform_device_int_attrib(device, attrib, def) _xf86_get_platform_device_int_attrib(device,attrib,_ODEV_ATTRIB_INT_CHECK(attrib,def)) #endif /* _XORG_CONFIG_H_ */