diff mbox

[04/20] drm: move "struct drm_magic_entry" to drm_auth.c

Message ID 1409307166-12396-5-git-send-email-dh.herrmann@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Herrmann Aug. 29, 2014, 10:12 a.m. UTC
In drm_release(), we currently call drm_remove_magic() if the drm_file
has a drm-magic attached. Therefore, once drm_master_release() is called,
the magic-list _must_ be empty.

By dropping the no-op cleanup, we can move "struct drm_magic_entry" to
drm_auth.c and avoid exposing it to all of DRM.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 drivers/gpu/drm/drm_auth.c | 6 ++++++
 drivers/gpu/drm/drm_drv.c  | 7 -------
 include/drm/drmP.h         | 6 ------
 3 files changed, 6 insertions(+), 13 deletions(-)

Comments

Thierry Reding Aug. 29, 2014, 11:39 a.m. UTC | #1
On Fri, Aug 29, 2014 at 12:12:30PM +0200, David Herrmann wrote:
> In drm_release(), we currently call drm_remove_magic() if the drm_file
> has a drm-magic attached. Therefore, once drm_master_release() is called,
> the magic-list _must_ be empty.
> 
> By dropping the no-op cleanup, we can move "struct drm_magic_entry" to
> drm_auth.c and avoid exposing it to all of DRM.
> 
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> ---
>  drivers/gpu/drm/drm_auth.c | 6 ++++++
>  drivers/gpu/drm/drm_drv.c  | 7 -------
>  include/drm/drmP.h         | 6 ------
>  3 files changed, 6 insertions(+), 13 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 3cedae1..708a204 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -35,6 +35,12 @@ 
 
 #include <drm/drmP.h>
 
+struct drm_magic_entry {
+	struct list_head head;
+	struct drm_hash_item hash_item;
+	struct drm_file *priv;
+};
+
 /**
  * Find the file with the given magic number.
  *
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b1587e2..6645669 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -133,7 +133,6 @@  EXPORT_SYMBOL(drm_master_get);
 static void drm_master_destroy(struct kref *kref)
 {
 	struct drm_master *master = container_of(kref, struct drm_master, refcount);
-	struct drm_magic_entry *pt, *next;
 	struct drm_device *dev = master->minor->dev;
 	struct drm_map_list *r_list, *list_temp;
 
@@ -154,12 +153,6 @@  static void drm_master_destroy(struct kref *kref)
 		master->unique_len = 0;
 	}
 
-	list_for_each_entry_safe(pt, next, &master->magicfree, head) {
-		list_del(&pt->head);
-		drm_ht_remove_item(&master->magiclist, &pt->hash_item);
-		kfree(pt);
-	}
-
 	drm_ht_remove(&master->magiclist);
 
 	mutex_unlock(&dev->struct_mutex);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 11c3575..0fdd813 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -290,12 +290,6 @@  struct drm_ioctl_desc {
 #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)			\
 	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
 
-struct drm_magic_entry {
-	struct list_head head;
-	struct drm_hash_item hash_item;
-	struct drm_file *priv;
-};
-
 /**
  * DMA buffer.
  */