Skip to contentSkip to conversation

drm: use proc_create_data()

PATCH In review Alexey Dobriyan 2 participants 2 messages Aug 28, 2009 – Aug 30, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: use proc_create_data()

---

 drivers/gpu/drm/drm_proc.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_proc.c +2 -3
@@ -106,7 +106,8 @@ int drm_proc_create_files(struct drm_info_list *files, int count,
 			continue;
 
 		tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
-		ent = create_proc_entry(files[i].name, S_IFREG | S_IRUGO, root);
+		ent = proc_create_data(files[i].name, S_IRUGO, root,
+				       &drm_proc_fops, tmp);
 		if (!ent) {
 			DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
 				  name, files[i].name);
@@ -115,8 +116,6 @@ int drm_proc_create_files(struct drm_info_list *files, int count,
 			goto fail;
 		}
 
-		ent->proc_fops = &drm_proc_fops;
-		ent->data = tmp;
 		tmp->minor = minor;
 		tmp->info_ent = &files[i];
 		list_add(&(tmp->list), &(minor->proc_nodes.list));
#1 lore raw
Quoted 2 lines

I pushed a slightly modified version to drm-next, it moves the filling out of tmp before the data create.

Thanks,
Dave.

Quoted 28 lines

---

 drivers/gpu/drm/drm_proc.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_proc.c +2 -3
@@ -106,7 +106,8 @@ int drm_proc_create_files(struct drm_info_list *files, int count,
 			continue;
 
 		tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
-		ent = create_proc_entry(files[i].name, S_IFREG | S_IRUGO, root);
+		ent = proc_create_data(files[i].name, S_IRUGO, root,
+				       &drm_proc_fops, tmp);
 		if (!ent) {
 			DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
 				  name, files[i].name);
@@ -115,8 +116,6 @@ int drm_proc_create_files(struct drm_info_list *files, int count,
 			goto fail;
 		}
 
-		ent->proc_fops = &drm_proc_fops;
-		ent->data = tmp;
 		tmp->minor = minor;
 		tmp->info_ent = &files[i];
 		list_add(&(tmp->list), &(minor->proc_nodes.list));