Merge branch 'fbdev-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / drivers / gpu / drm / drm_bufs.c
index 3e257a5..61e1ef9 100644 (file)
@@ -46,10 +46,11 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
        list_for_each_entry(entry, &dev->maplist, head) {
                /*
                 * Because the kernel-userspace ABI is fixed at a 32-bit offset
-                * while PCI resources may live above that, we ignore the map
-                * offset for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS.
-                * It is assumed that each driver will have only one resource of
-                * each type.
+                * while PCI resources may live above that, we only compare the
+                * lower 32 bits of the map offset for maps of type
+                * _DRM_FRAMEBUFFER or _DRM_REGISTERS.
+                * It is assumed that if a driver have more than one resource
+                * of each type, the lower 32 bits are different.
                 */
                if (!entry->map ||
                    map->type != entry->map->type ||
@@ -59,9 +60,12 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
                case _DRM_SHM:
                        if (map->flags != _DRM_CONTAINS_LOCK)
                                break;
+                       return entry;
                case _DRM_REGISTERS:
                case _DRM_FRAME_BUFFER:
-                       return entry;
+                       if ((entry->map->offset & 0xffffffff) ==
+                           (map->offset & 0xffffffff))
+                               return entry;
                default: /* Make gcc happy */
                        ;
                }
@@ -182,9 +186,6 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
                        kfree(map);
                        return -EINVAL;
                }
-#endif
-#ifdef __alpha__
-               map->offset += dev->hose->mem_space->start;
 #endif
                /* Some drivers preinitialize some maps, without the X Server
                 * needing to be aware of it.  Therefore, we just return success