Skip to content

Commit

Permalink
drivers: misc: pass miscdevice pointer via file private data
Browse files Browse the repository at this point in the history
For misc devices, inode->i_cdev doesn't point to the device drivers own
data.  Link between file operations and device driver internal data is
lost.  Pass pointer to misc device struct via file private data for driver
open function use.

Signed-off-by: Samu Onkalo <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Samu Onkalo authored and torvalds committed May 25, 2010
1 parent 6c5e303 commit fa1f68d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/char/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int misc_open(struct inode * inode, struct file * file)
old_fops = file->f_op;
file->f_op = new_fops;
if (file->f_op->open) {
file->private_data = c;
err=file->f_op->open(inode,file);
if (err) {
fops_put(file->f_op);
Expand Down

0 comments on commit fa1f68d

Please sign in to comment.