From 87bed52180cd2abd80ef6b58384f9fd9c9968f7b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 11 Feb 2012 20:54:18 +0000 Subject: Include a local copy of list.h In 1.11.903, the list.h was renamed to xorg-list.h with a corresponding change to all structures. As we carried local fixes to list.h and extended functionality, just create our own list.h with a bit of handwaving to protect us for the brief existence of xorg/include/list.h. Reported-by: Armin K Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45938 Signed-off-by: Chris Wilson --- src/intel.h | 90 +------------------------------------------------------------ 1 file changed, 1 insertion(+), 89 deletions(-) (limited to 'src/intel.h') diff --git a/src/intel.h b/src/intel.h index 7593731b..8104bfed 100644 --- a/src/intel.h +++ b/src/intel.h @@ -68,100 +68,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i915_drm.h" #include "intel_driver.h" +#include "intel_list.h" #if HAVE_UDEV #include #endif -/* XXX - * The X server gained an *almost* identical implementation in 1.9. - * - * Remove this duplicate code either in 2.16 (when we can depend upon 1.9) - * or the drivers are merged back into the xserver tree, whichever happens - * earlier. - */ - -#ifndef _LIST_H_ -/* classic doubly-link circular list */ -struct list { - struct list *next, *prev; -}; - -static void -list_init(struct list *list) -{ - list->next = list->prev = list; -} - -static inline void -__list_add(struct list *entry, - struct list *prev, - struct list *next) -{ - next->prev = entry; - entry->next = next; - entry->prev = prev; - prev->next = entry; -} - -static inline void -list_add(struct list *entry, struct list *head) -{ - __list_add(entry, head, head->next); -} - -static inline void -__list_del(struct list *prev, struct list *next) -{ - next->prev = prev; - prev->next = next; -} - -static inline void -list_del(struct list *entry) -{ - __list_del(entry->prev, entry->next); - list_init(entry); -} - -static inline Bool -list_is_empty(struct list *head) -{ - return head->next == head; -} -#endif - -/* XXX work around a broken define in list.h currently [ickle 20100713] */ -#undef container_of - -#ifndef container_of -#define container_of(ptr, type, member) \ - ((type *)((char *)(ptr) - (char *) &((type *)0)->member)) -#endif - -#ifndef list_entry -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) -#endif - -#ifndef list_first_entry -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) -#endif - -#ifndef list_foreach -#define list_foreach(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) -#endif - -/* XXX list.h from xserver-1.9 uses a GCC-ism to avoid having to pass type */ -#ifndef list_foreach_entry -#define list_foreach_entry(pos, type, head, member) \ - for (pos = list_entry((head)->next, type, member);\ - &pos->member != (head); \ - pos = list_entry(pos->member.next, type, member)) -#endif - /* remain compatible to xorg-server 1.6 */ #ifndef MONITOR_EDID_COMPLETE_RAWDATA #define MONITOR_EDID_COMPLETE_RAWDATA EDID_COMPLETE_RAWDATA -- cgit v1.2.3