[PATCH v2] drm: un-inline drm_legacy_findmap()

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sun Dec 30 18:57:10 UTC 2018


Hi Jani,

Thank you for the patch.

On Friday, 28 December 2018 15:04:46 EET Jani Nikula wrote:
> Also include drm_hashtab.h and add struct drm_device forward declaration
> 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)

It would be nice to explain why you de-inline the function (I assume because 
it's a bit too large).

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> Cc: Sam Ravnborg <sam at ravnborg.org>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/drm_bufs.c | 11 +++++++++++
>  include/drm/drm_legacy.h   | 14 ++++----------
>  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, }
>  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
>   * 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 @@
>  #define __DRM_DRM_LEGACY_H__
> 
>  #include <drm/drm_auth.h>
> +#include <drm/drm_hashtab.h>
> +
> +struct drm_device;
> 
>  /*
>   * Legacy driver interfaces for the Direct Rendering Manager
> @@ -156,6 +159,7 @@ struct drm_map_list {
>  int drm_legacy_addmap(struct drm_device *d, resource_size_t offset,
>  		      unsigned int size, enum drm_map_type type,
>  		      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); int drm_legacy_rmmap_locked(struct drm_device *d,
> struct drm_local_map *map); 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); 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);
> 
> -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__ */


-- 
Regards,

Laurent Pinchart





More information about the dri-devel mailing list