[11/12] drm/legacy: place all drm legacy members under DRM_LEGACY.

Submitted by Dave Airlie on April 23, 2019, 2 a.m.

Details

Message ID 20190423020041.32702-12-airlied@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Dave Airlie April 23, 2019, 2 a.m.
From: Dave Airlie <airlied@redhat.com>

This places a bunch of the legacy members of drm_device into
only being there when legacy is enabled.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_legacy.h | 20 ++++++++++++++++++++
 include/drm/drm_device.h     |  3 ++-
 2 files changed, 22 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
index 3c05452a7137..4200e6bd3778 100644
--- a/drivers/gpu/drm/drm_legacy.h
+++ b/drivers/gpu/drm/drm_legacy.h
@@ -72,6 +72,7 @@  int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
 
 #define DRM_MAP_HASH_OFFSET 0x10000000
 
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
 static inline int drm_legacy_create_map_hash(struct drm_device *dev)
 {
 	return drm_ht_create(&dev->map_hash, 12);
@@ -81,6 +82,14 @@  static inline void drm_legacy_remove_map_hash(struct drm_device *dev)
 {
 	drm_ht_remove(&dev->map_hash);
 }
+#else
+static inline int drm_legacy_create_map_hash(struct drm_device *dev)
+{
+	return 0;
+}
+
+static inline void drm_legacy_remove_map_hash(struct drm_device *dev) {}
+#endif
 
 
 #if IS_ENABLED(CONFIG_DRM_LEGACY)
@@ -174,6 +183,8 @@  int drm_legacy_sg_free(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv);
 #endif
 
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+
 static inline void drm_legacy_init_members(struct drm_device *dev)
 {
 	INIT_LIST_HEAD(&dev->ctxlist);
@@ -211,6 +222,15 @@  static inline void drm_legacy_dev_reinit(struct drm_device *dev)
 
 	DRM_DEBUG("lastclose completed\n");
 }
+#else
+static inline void drm_legacy_init_members(struct drm_device *dev) {}
+static inline void drm_legacy_destroy_members(struct drm_device *dev) {}
+static inline void drm_legacy_dev_reinit(struct drm_device *dev) {}
+#endif
 
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
 void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master);
+#else
+static inline void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master) {}
+#endif
 #endif /* __DRM_LEGACY_H__ */
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index d5e092dccf3e..7f9ef709b2b6 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -306,7 +306,7 @@  struct drm_device {
 
 	/* Everything below here is for legacy driver, never use! */
 	/* private: */
-
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
 	/* Context handle management - linked list of context handles */
 	struct list_head ctxlist;
 
@@ -353,6 +353,7 @@  struct drm_device {
 
 	/* Scatter gather memory */
 	struct drm_sg_mem *sg;
+#endif
 };
 
 #endif

Comments

On Tue, Apr 23, 2019 at 12:00:40PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This places a bunch of the legacy members of drm_device into
> only being there when legacy is enabled.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/drm_legacy.h | 20 ++++++++++++++++++++
>  include/drm/drm_device.h     |  3 ++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
> index 3c05452a7137..4200e6bd3778 100644
> --- a/drivers/gpu/drm/drm_legacy.h
> +++ b/drivers/gpu/drm/drm_legacy.h
> @@ -72,6 +72,7 @@ int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
>  
>  #define DRM_MAP_HASH_OFFSET 0x10000000
>  
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  static inline int drm_legacy_create_map_hash(struct drm_device *dev)
>  {
>  	return drm_ht_create(&dev->map_hash, 12);
> @@ -81,6 +82,14 @@ static inline void drm_legacy_remove_map_hash(struct drm_device *dev)
>  {
>  	drm_ht_remove(&dev->map_hash);
>  }
> +#else
> +static inline int drm_legacy_create_map_hash(struct drm_device *dev)
> +{
> +	return 0;
> +}
> +
> +static inline void drm_legacy_remove_map_hash(struct drm_device *dev) {}
> +#endif

Ah, now I get what you've done with the ht stuff ... This should actually
keep vmwgfx happy. I'll reply to the earlier patch and upgrade to r-b
there.


>  
>  
>  #if IS_ENABLED(CONFIG_DRM_LEGACY)
> @@ -174,6 +183,8 @@ int drm_legacy_sg_free(struct drm_device *dev, void *data,
>  		       struct drm_file *file_priv);
>  #endif
>  
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
> +
>  static inline void drm_legacy_init_members(struct drm_device *dev)
>  {
>  	INIT_LIST_HEAD(&dev->ctxlist);
> @@ -211,6 +222,15 @@ static inline void drm_legacy_dev_reinit(struct drm_device *dev)
>  
>  	DRM_DEBUG("lastclose completed\n");
>  }
> +#else
> +static inline void drm_legacy_init_members(struct drm_device *dev) {}
> +static inline void drm_legacy_destroy_members(struct drm_device *dev) {}
> +static inline void drm_legacy_dev_reinit(struct drm_device *dev) {}
> +#endif
>  
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master);
> +#else
> +static inline void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master) {}
> +#endif
>  #endif /* __DRM_LEGACY_H__ */
> diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> index d5e092dccf3e..7f9ef709b2b6 100644
> --- a/include/drm/drm_device.h
> +++ b/include/drm/drm_device.h
> @@ -306,7 +306,7 @@ struct drm_device {
>  
>  	/* Everything below here is for legacy driver, never use! */
>  	/* private: */
> -
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  	/* Context handle management - linked list of context handles */
>  	struct list_head ctxlist;
>  
> @@ -353,6 +353,7 @@ struct drm_device {
>  
>  	/* Scatter gather memory */
>  	struct drm_sg_mem *sg;
> +#endif

Nice!

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

>  };
>  
>  #endif
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel