aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-04-29 04:02:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:21 -0400
commitcdefa185dda6b2b267f088a7477e96d845bdc6c1 (patch)
tree95447a4c46352d6a353074873c11446e7c3c657f /drivers
parenta973909fc32be90884280b7a8cd2f2e093c97890 (diff)
usb: use non-racy method for proc entries creation
Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data be setup before gluing PDE to main tree. Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/at91_udc.c11
-rw-r--r--drivers/usb/gadget/omap_udc.c7
-rw-r--r--drivers/usb/host/sl811-hcd.c10
3 files changed, 5 insertions, 23 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 9b913afb2e6d..274c60a970cd 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -231,6 +231,7 @@ static int proc_udc_open(struct inode *inode, struct file *file)
231} 231}
232 232
233static const struct file_operations proc_ops = { 233static const struct file_operations proc_ops = {
234 .owner = THIS_MODULE,
234 .open = proc_udc_open, 235 .open = proc_udc_open,
235 .read = seq_read, 236 .read = seq_read,
236 .llseek = seq_lseek, 237 .llseek = seq_lseek,
@@ -239,15 +240,7 @@ static const struct file_operations proc_ops = {
239 240
240static void create_debug_file(struct at91_udc *udc) 241static void create_debug_file(struct at91_udc *udc)
241{ 242{
242 struct proc_dir_entry *pde; 243 udc->pde = proc_create_data(debug_filename, 0, NULL, &proc_ops, udc);
243
244 pde = create_proc_entry (debug_filename, 0, NULL);
245 udc->pde = pde;
246 if (pde == NULL)
247 return;
248
249 pde->proc_fops = &proc_ops;
250 pde->data = udc;
251} 244}
252 245
253static void remove_debug_file(struct at91_udc *udc) 246static void remove_debug_file(struct at91_udc *udc)
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 95f7662376f1..881d74c3d964 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2504,6 +2504,7 @@ static int proc_udc_open(struct inode *inode, struct file *file)
2504} 2504}
2505 2505
2506static const struct file_operations proc_ops = { 2506static const struct file_operations proc_ops = {
2507 .owner = THIS_MODULE,
2507 .open = proc_udc_open, 2508 .open = proc_udc_open,
2508 .read = seq_read, 2509 .read = seq_read,
2509 .llseek = seq_lseek, 2510 .llseek = seq_lseek,
@@ -2512,11 +2513,7 @@ static const struct file_operations proc_ops = {
2512 2513
2513static void create_proc_file(void) 2514static void create_proc_file(void)
2514{ 2515{
2515 struct proc_dir_entry *pde; 2516 proc_create(proc_filename, 0, NULL, &proc_ops);
2516
2517 pde = create_proc_entry (proc_filename, 0, NULL);
2518 if (pde)
2519 pde->proc_fops = &proc_ops;
2520} 2517}
2521 2518
2522static void remove_proc_file(void) 2519static void remove_proc_file(void)
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 3fd7a0c12078..426575247b23 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1506,15 +1506,7 @@ static const char proc_filename[] = "driver/sl811h";
1506 1506
1507static void create_debug_file(struct sl811 *sl811) 1507static void create_debug_file(struct sl811 *sl811)
1508{ 1508{
1509 struct proc_dir_entry *pde; 1509 sl811->pde = proc_create_data(proc_filename, 0, NULL, &proc_ops, sl811);
1510
1511 pde = create_proc_entry(proc_filename, 0, NULL);
1512 if (pde == NULL)
1513 return;
1514
1515 pde->proc_fops = &proc_ops;
1516 pde->data = sl811;
1517 sl811->pde = pde;
1518} 1510}
1519 1511
1520static void remove_debug_file(struct sl811 *sl811) 1512static void remove_debug_file(struct sl811 *sl811)