On Tue, Apr 23, 2019 at 12:00:36PM +1000, Dave Airlie wrote: > From: Dave Airlie <airlied@xxxxxxxxxx> > > This will allow easier removal later. > > Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx> > --- > drivers/gpu/drm/drm_drv.c | 10 +++------- > drivers/gpu/drm/drm_legacy.h | 14 ++++++++++++++ > 2 files changed, 17 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c > index 18f45f9a955c..e4f36c5ccfcd 100644 > --- a/drivers/gpu/drm/drm_drv.c > +++ b/drivers/gpu/drm/drm_drv.c > @@ -659,20 +659,16 @@ int drm_dev_init(struct drm_device *dev, > /* no per-device feature limits by default */ > dev->driver_features = ~0u; > > + drm_legacy_init_members(dev); > INIT_LIST_HEAD(&dev->filelist); > INIT_LIST_HEAD(&dev->filelist_internal); > INIT_LIST_HEAD(&dev->clientlist); > - INIT_LIST_HEAD(&dev->ctxlist); > - INIT_LIST_HEAD(&dev->vmalist); > - INIT_LIST_HEAD(&dev->maplist); > INIT_LIST_HEAD(&dev->vblank_event_list); > > - spin_lock_init(&dev->buf_lock); > spin_lock_init(&dev->event_lock); > mutex_init(&dev->struct_mutex); > mutex_init(&dev->filelist_mutex); > mutex_init(&dev->clientlist_mutex); > - mutex_init(&dev->ctxlist_mutex); > mutex_init(&dev->master_mutex); > > dev->anon_inode = drm_fs_inode_new(); > @@ -724,7 +720,7 @@ int drm_dev_init(struct drm_device *dev, > err_free: > put_device(dev->dev); > mutex_destroy(&dev->master_mutex); > - mutex_destroy(&dev->ctxlist_mutex); > + drm_legacy_destroy_members(dev); > mutex_destroy(&dev->clientlist_mutex); > mutex_destroy(&dev->filelist_mutex); > mutex_destroy(&dev->struct_mutex); > @@ -800,7 +796,7 @@ void drm_dev_fini(struct drm_device *dev) > put_device(dev->dev); > > mutex_destroy(&dev->master_mutex); > - mutex_destroy(&dev->ctxlist_mutex); > + drm_legacy_destroy_members(dev); > mutex_destroy(&dev->clientlist_mutex); > mutex_destroy(&dev->filelist_mutex); > mutex_destroy(&dev->struct_mutex); > diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h > index ef419d500e51..20c4befc476b 100644 > --- a/drivers/gpu/drm/drm_legacy.h > +++ b/drivers/gpu/drm/drm_legacy.h > @@ -136,5 +136,19 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data, > int drm_legacy_sg_free(struct drm_device *dev, void *data, > struct drm_file *file_priv); > > +static inline void drm_legacy_init_members(struct drm_device *dev) > +{ > + INIT_LIST_HEAD(&dev->ctxlist); > + INIT_LIST_HEAD(&dev->vmalist); > + INIT_LIST_HEAD(&dev->maplist); > + spin_lock_init(&dev->buf_lock); > + mutex_init(&dev->ctxlist_mutex); > +} > + > +static inline void drm_legacy_destroy_members(struct drm_device *dev) > +{ > + mutex_destroy(&dev->ctxlist_mutex); > +} I think with the other inline functions you stuff into drm_legacy.h it'd justification enough to create a drm_legacy_misc.c. Not drm_legacy.c because then you can't include other files into drm_legacy.ko because Kbuild is silly :-) With that: Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx> > + > void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master); > #endif /* __DRM_LEGACY_H__ */ > -- > 2.20.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel