diff mbox series

[06/12] drm/legacy: move map_hash create/destroy into inlines

Message ID 20190423020041.32702-7-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series [01/12] drm/nouveau: add kconfig option to turn off nouveau legacy contexts. (v2) | expand

Commit Message

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

This allows them to be removed later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_drv.c    |  7 +++----
 drivers/gpu/drm/drm_legacy.h | 10 ++++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

Comments

Daniel Vetter April 23, 2019, 6:45 p.m. UTC | #1
On Tue, Apr 23, 2019 at 12:00:35PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This allows them to be removed later.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>

vmwgfx still uses these? Is the plan to burn that down :-)

Probably easier to add a todo.rst item to clean that up than do it
yourself.
-Daniel

> ---
>  drivers/gpu/drm/drm_drv.c    |  7 +++----
>  drivers/gpu/drm/drm_legacy.h | 10 ++++++++++
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 15b0fd5adaaf..18f45f9a955c 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -692,10 +692,9 @@ int drm_dev_init(struct drm_device *dev,
>  	if (ret)
>  		goto err_minors;
>  
> -	ret = drm_ht_create(&dev->map_hash, 12);
> +	ret = drm_legacy_create_map_hash(dev);
>  	if (ret)
>  		goto err_minors;
> -
>  	drm_legacy_ctxbitmap_init(dev);
>  
>  	if (drm_core_check_feature(dev, DRIVER_GEM)) {
> @@ -717,7 +716,7 @@ int drm_dev_init(struct drm_device *dev,
>  		drm_gem_destroy(dev);
>  err_ctxbitmap:
>  	drm_legacy_ctxbitmap_cleanup(dev);
> -	drm_ht_remove(&dev->map_hash);
> +	drm_legacy_remove_map_hash(dev);
>  err_minors:
>  	drm_minor_free(dev, DRM_MINOR_PRIMARY);
>  	drm_minor_free(dev, DRM_MINOR_RENDER);
> @@ -792,7 +791,7 @@ void drm_dev_fini(struct drm_device *dev)
>  		drm_gem_destroy(dev);
>  
>  	drm_legacy_ctxbitmap_cleanup(dev);
> -	drm_ht_remove(&dev->map_hash);
> +	drm_legacy_remove_map_hash(dev);
>  	drm_fs_inode_free(dev->anon_inode);
>  
>  	drm_minor_free(dev, DRM_MINOR_PRIMARY);
> diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
> index 974c2be6bcd5..ef419d500e51 100644
> --- a/drivers/gpu/drm/drm_legacy.h
> +++ b/drivers/gpu/drm/drm_legacy.h
> @@ -63,6 +63,16 @@ int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
>  
>  #define DRM_MAP_HASH_OFFSET 0x10000000
>  
> +static inline int drm_legacy_create_map_hash(struct drm_device *dev)
> +{
> +	return drm_ht_create(&dev->map_hash, 12);
> +}
> +
> +static inline void drm_legacy_remove_map_hash(struct drm_device *dev)
> +{
> +	drm_ht_remove(&dev->map_hash);
> +}
> +
>  int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
>  			    struct drm_file *file_priv);
>  int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter April 23, 2019, 6:58 p.m. UTC | #2
On Tue, Apr 23, 2019 at 08:45:11PM +0200, Daniel Vetter wrote:
> On Tue, Apr 23, 2019 at 12:00:35PM +1000, Dave Airlie wrote:
> > From: Dave Airlie <airlied@redhat.com>
> > 
> > This allows them to be removed later.
> > 
> > Signed-off-by: Dave Airlie <airlied@redhat.com>
> 
> vmwgfx still uses these? Is the plan to burn that down :-)
> 
> Probably easier to add a todo.rst item to clean that up than do it
> yourself.

With the insight of later patches telling me what you plan to do:

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

> -Daniel
> 
> > ---
> >  drivers/gpu/drm/drm_drv.c    |  7 +++----
> >  drivers/gpu/drm/drm_legacy.h | 10 ++++++++++
> >  2 files changed, 13 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index 15b0fd5adaaf..18f45f9a955c 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -692,10 +692,9 @@ int drm_dev_init(struct drm_device *dev,
> >  	if (ret)
> >  		goto err_minors;
> >  
> > -	ret = drm_ht_create(&dev->map_hash, 12);
> > +	ret = drm_legacy_create_map_hash(dev);
> >  	if (ret)
> >  		goto err_minors;
> > -
> >  	drm_legacy_ctxbitmap_init(dev);
> >  
> >  	if (drm_core_check_feature(dev, DRIVER_GEM)) {
> > @@ -717,7 +716,7 @@ int drm_dev_init(struct drm_device *dev,
> >  		drm_gem_destroy(dev);
> >  err_ctxbitmap:
> >  	drm_legacy_ctxbitmap_cleanup(dev);
> > -	drm_ht_remove(&dev->map_hash);
> > +	drm_legacy_remove_map_hash(dev);
> >  err_minors:
> >  	drm_minor_free(dev, DRM_MINOR_PRIMARY);
> >  	drm_minor_free(dev, DRM_MINOR_RENDER);
> > @@ -792,7 +791,7 @@ void drm_dev_fini(struct drm_device *dev)
> >  		drm_gem_destroy(dev);
> >  
> >  	drm_legacy_ctxbitmap_cleanup(dev);
> > -	drm_ht_remove(&dev->map_hash);
> > +	drm_legacy_remove_map_hash(dev);
> >  	drm_fs_inode_free(dev->anon_inode);
> >  
> >  	drm_minor_free(dev, DRM_MINOR_PRIMARY);
> > diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
> > index 974c2be6bcd5..ef419d500e51 100644
> > --- a/drivers/gpu/drm/drm_legacy.h
> > +++ b/drivers/gpu/drm/drm_legacy.h
> > @@ -63,6 +63,16 @@ int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
> >  
> >  #define DRM_MAP_HASH_OFFSET 0x10000000
> >  
> > +static inline int drm_legacy_create_map_hash(struct drm_device *dev)
> > +{
> > +	return drm_ht_create(&dev->map_hash, 12);
> > +}
> > +
> > +static inline void drm_legacy_remove_map_hash(struct drm_device *dev)
> > +{
> > +	drm_ht_remove(&dev->map_hash);
> > +}
> > +
> >  int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
> >  			    struct drm_file *file_priv);
> >  int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
> > -- 
> > 2.20.1
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
Sam Ravnborg April 23, 2019, 7:48 p.m. UTC | #3
Hi Dave.

Micro nit..

On Tue, Apr 23, 2019 at 12:00:35PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This allows them to be removed later.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/drm_drv.c    |  7 +++----
>  drivers/gpu/drm/drm_legacy.h | 10 ++++++++++
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 15b0fd5adaaf..18f45f9a955c 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -692,10 +692,9 @@ int drm_dev_init(struct drm_device *dev,
>  	if (ret)
>  		goto err_minors;
>  
> -	ret = drm_ht_create(&dev->map_hash, 12);
> +	ret = drm_legacy_create_map_hash(dev);
>  	if (ret)
>  		goto err_minors;
> -
>  	drm_legacy_ctxbitmap_init(dev);
Removal of empty line does not make code easier to read, and
an unrelated change.
As I said - micro nit.

	Sam
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 15b0fd5adaaf..18f45f9a955c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -692,10 +692,9 @@  int drm_dev_init(struct drm_device *dev,
 	if (ret)
 		goto err_minors;
 
-	ret = drm_ht_create(&dev->map_hash, 12);
+	ret = drm_legacy_create_map_hash(dev);
 	if (ret)
 		goto err_minors;
-
 	drm_legacy_ctxbitmap_init(dev);
 
 	if (drm_core_check_feature(dev, DRIVER_GEM)) {
@@ -717,7 +716,7 @@  int drm_dev_init(struct drm_device *dev,
 		drm_gem_destroy(dev);
 err_ctxbitmap:
 	drm_legacy_ctxbitmap_cleanup(dev);
-	drm_ht_remove(&dev->map_hash);
+	drm_legacy_remove_map_hash(dev);
 err_minors:
 	drm_minor_free(dev, DRM_MINOR_PRIMARY);
 	drm_minor_free(dev, DRM_MINOR_RENDER);
@@ -792,7 +791,7 @@  void drm_dev_fini(struct drm_device *dev)
 		drm_gem_destroy(dev);
 
 	drm_legacy_ctxbitmap_cleanup(dev);
-	drm_ht_remove(&dev->map_hash);
+	drm_legacy_remove_map_hash(dev);
 	drm_fs_inode_free(dev->anon_inode);
 
 	drm_minor_free(dev, DRM_MINOR_PRIMARY);
diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
index 974c2be6bcd5..ef419d500e51 100644
--- a/drivers/gpu/drm/drm_legacy.h
+++ b/drivers/gpu/drm/drm_legacy.h
@@ -63,6 +63,16 @@  int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
 
 #define DRM_MAP_HASH_OFFSET 0x10000000
 
+static inline int drm_legacy_create_map_hash(struct drm_device *dev)
+{
+	return drm_ht_create(&dev->map_hash, 12);
+}
+
+static inline void drm_legacy_remove_map_hash(struct drm_device *dev)
+{
+	drm_ht_remove(&dev->map_hash);
+}
+
 int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
 			    struct drm_file *file_priv);
 int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);