Commit c7642688 authored by Jani Nikula's avatar Jani Nikula

drm: un-inline drm_legacy_findmap()

Un-inline drm_legacy_findmap() to not depend on struct drm_device
definition within drm_legacy.h, so that a forward declaration suffices.

Also include drm_hashtab.h in drm_legacy.h to make it more
self-contained. Make it easier to drop drmP.h includes.

v2: avoid including drm_device.h by un-inlining (Daniel)

[Updated commit message per Laurent's review while applying.]

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181228130446.22141-1-jani.nikula@intel.com
parent b4bf44d2
...@@ -377,6 +377,17 @@ int drm_legacy_addmap(struct drm_device *dev, resource_size_t offset, ...@@ -377,6 +377,17 @@ int drm_legacy_addmap(struct drm_device *dev, resource_size_t offset,
} }
EXPORT_SYMBOL(drm_legacy_addmap); EXPORT_SYMBOL(drm_legacy_addmap);
struct drm_local_map *drm_legacy_findmap(struct drm_device *dev,
unsigned int token)
{
struct drm_map_list *_entry;
list_for_each_entry(_entry, &dev->maplist, head)
if (_entry->user_token == token)
return _entry->map;
return NULL;
}
EXPORT_SYMBOL(drm_legacy_findmap);
/** /**
* Ioctl to specify a range of memory that is available for mapping by a * Ioctl to specify a range of memory that is available for mapping by a
* non-root process. * non-root process.
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#define __DRM_DRM_LEGACY_H__ #define __DRM_DRM_LEGACY_H__
#include <drm/drm_auth.h> #include <drm/drm_auth.h>
#include <drm/drm_hashtab.h>
struct drm_device;
/* /*
* Legacy driver interfaces for the Direct Rendering Manager * Legacy driver interfaces for the Direct Rendering Manager
...@@ -156,6 +159,7 @@ struct drm_map_list { ...@@ -156,6 +159,7 @@ struct drm_map_list {
int drm_legacy_addmap(struct drm_device *d, resource_size_t offset, int drm_legacy_addmap(struct drm_device *d, resource_size_t offset,
unsigned int size, enum drm_map_type type, unsigned int size, enum drm_map_type type,
enum drm_map_flags flags, struct drm_local_map **map_p); enum drm_map_flags flags, struct drm_local_map **map_p);
struct drm_local_map *drm_legacy_findmap(struct drm_device *dev, unsigned int token);
void drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map); void drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map);
int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map); int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map);
void drm_legacy_master_rmmaps(struct drm_device *dev, void drm_legacy_master_rmmaps(struct drm_device *dev,
...@@ -194,14 +198,4 @@ void drm_legacy_ioremap(struct drm_local_map *map, struct drm_device *dev); ...@@ -194,14 +198,4 @@ void drm_legacy_ioremap(struct drm_local_map *map, struct drm_device *dev);
void drm_legacy_ioremap_wc(struct drm_local_map *map, struct drm_device *dev); void drm_legacy_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev); void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
static inline struct drm_local_map *drm_legacy_findmap(struct drm_device *dev,
unsigned int token)
{
struct drm_map_list *_entry;
list_for_each_entry(_entry, &dev->maplist, head)
if (_entry->user_token == token)
return _entry->map;
return NULL;
}
#endif /* __DRM_DRM_LEGACY_H__ */ #endif /* __DRM_DRM_LEGACY_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment