summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2018-12-28 08:04:46 -0500
committerJani Nikula <jani.nikula@intel.com>2019-01-02 04:37:11 -0500
commitc76426883c8f44bc7d2aee123e28867c67b87384 (patch)
tree3e97f5eec0d4e3ab914b5c19d46bd668adac1606
parentb4bf44d2dcbd6c35d9651bc6286e4940b8b3df95 (diff)
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: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181228130446.22141-1-jani.nikula@intel.com
-rw-r--r--drivers/gpu/drm/drm_bufs.c11
-rw-r--r--include/drm/drm_legacy.h14
2 files changed, 15 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index d7d10cabb9bb..a39ab2193bfe 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -377,6 +377,17 @@ int drm_legacy_addmap(struct drm_device *dev, resource_size_t offset,
377} 377}
378EXPORT_SYMBOL(drm_legacy_addmap); 378EXPORT_SYMBOL(drm_legacy_addmap);
379 379
380struct drm_local_map *drm_legacy_findmap(struct drm_device *dev,
381 unsigned int token)
382{
383 struct drm_map_list *_entry;
384 list_for_each_entry(_entry, &dev->maplist, head)
385 if (_entry->user_token == token)
386 return _entry->map;
387 return NULL;
388}
389EXPORT_SYMBOL(drm_legacy_findmap);
390
380/** 391/**
381 * Ioctl to specify a range of memory that is available for mapping by a 392 * Ioctl to specify a range of memory that is available for mapping by a
382 * non-root process. 393 * non-root process.
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h
index 8fad66f88e4f..3e99ab69c122 100644
--- a/include/drm/drm_legacy.h
+++ b/include/drm/drm_legacy.h
@@ -2,6 +2,9 @@
2#define __DRM_DRM_LEGACY_H__ 2#define __DRM_DRM_LEGACY_H__
3 3
4#include <drm/drm_auth.h> 4#include <drm/drm_auth.h>
5#include <drm/drm_hashtab.h>
6
7struct drm_device;
5 8
6/* 9/*
7 * Legacy driver interfaces for the Direct Rendering Manager 10 * Legacy driver interfaces for the Direct Rendering Manager
@@ -156,6 +159,7 @@ struct drm_map_list {
156int drm_legacy_addmap(struct drm_device *d, resource_size_t offset, 159int drm_legacy_addmap(struct drm_device *d, resource_size_t offset,
157 unsigned int size, enum drm_map_type type, 160 unsigned int size, enum drm_map_type type,
158 enum drm_map_flags flags, struct drm_local_map **map_p); 161 enum drm_map_flags flags, struct drm_local_map **map_p);
162struct drm_local_map *drm_legacy_findmap(struct drm_device *dev, unsigned int token);
159void drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map); 163void drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map);
160int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map); 164int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map);
161void drm_legacy_master_rmmaps(struct drm_device *dev, 165void 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);
194void drm_legacy_ioremap_wc(struct drm_local_map *map, struct drm_device *dev); 198void drm_legacy_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
195void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev); 199void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
196 200
197static inline struct drm_local_map *drm_legacy_findmap(struct drm_device *dev,
198 unsigned int token)
199{
200 struct drm_map_list *_entry;
201 list_for_each_entry(_entry, &dev->maplist, head)
202 if (_entry->user_token == token)
203 return _entry->map;
204 return NULL;
205}
206
207#endif /* __DRM_DRM_LEGACY_H__ */ 201#endif /* __DRM_DRM_LEGACY_H__ */