aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/misc.c')
-rw-r--r--drivers/char/misc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 5bb3a2109ab7..9fd5a91e0d81 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -140,12 +140,17 @@ static int misc_open(struct inode * inode, struct file * file)
140 goto fail; 140 goto fail;
141 } 141 }
142 142
143 /*
144 * Place the miscdevice in the file's
145 * private_data so it can be used by the
146 * file operations, including f_op->open below
147 */
148 file->private_data = c;
149
143 err = 0; 150 err = 0;
144 replace_fops(file, new_fops); 151 replace_fops(file, new_fops);
145 if (file->f_op->open) { 152 if (file->f_op->open)
146 file->private_data = c;
147 err = file->f_op->open(inode,file); 153 err = file->f_op->open(inode,file);
148 }
149fail: 154fail:
150 mutex_unlock(&misc_mtx); 155 mutex_unlock(&misc_mtx);
151 return err; 156 return err;