diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-08-28 14:58:07 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-08-30 19:37:22 -0400 |
commit | 3b51096f95633e6ab47675984e8e38fc37b09eeb (patch) | |
tree | bc47fe5890b7d1419943645071b19e45719e5fb5 /drivers/gpu/drm/drm_proc.c | |
parent | 882f0219518196a94cd2772004e87b178467139a (diff) |
drm: use proc_create_data()
airlied: fixup race against drm info by filling out
tmp before adding it to proc.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_proc.c')
-rw-r--r-- | drivers/gpu/drm/drm_proc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c index dc967af7a33c..d379c4f2892f 100644 --- a/drivers/gpu/drm/drm_proc.c +++ b/drivers/gpu/drm/drm_proc.c | |||
@@ -110,20 +110,21 @@ int drm_proc_create_files(struct drm_info_list *files, int count, | |||
110 | ret = -1; | 110 | ret = -1; |
111 | goto fail; | 111 | goto fail; |
112 | } | 112 | } |
113 | ent = create_proc_entry(files[i].name, S_IFREG | S_IRUGO, root); | 113 | tmp->minor = minor; |
114 | tmp->info_ent = &files[i]; | ||
115 | list_add(&tmp->list, &minor->proc_nodes.list); | ||
116 | |||
117 | ent = proc_create_data(files[i].name, S_IRUGO, root, | ||
118 | &drm_proc_fops, tmp); | ||
114 | if (!ent) { | 119 | if (!ent) { |
115 | DRM_ERROR("Cannot create /proc/dri/%s/%s\n", | 120 | DRM_ERROR("Cannot create /proc/dri/%s/%s\n", |
116 | name, files[i].name); | 121 | name, files[i].name); |
122 | list_del(&tmp->list); | ||
117 | kfree(tmp); | 123 | kfree(tmp); |
118 | ret = -1; | 124 | ret = -1; |
119 | goto fail; | 125 | goto fail; |
120 | } | 126 | } |
121 | 127 | ||
122 | ent->proc_fops = &drm_proc_fops; | ||
123 | ent->data = tmp; | ||
124 | tmp->minor = minor; | ||
125 | tmp->info_ent = &files[i]; | ||
126 | list_add(&(tmp->list), &(minor->proc_nodes.list)); | ||
127 | } | 128 | } |
128 | return 0; | 129 | return 0; |
129 | 130 | ||