Skip to content

Commit fa1f68d

Browse files
Samu Onkalotorvalds
authored andcommitted
drivers: misc: pass miscdevice pointer via file private data
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]>
1 parent 6c5e303 commit fa1f68d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/char/misc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ static int misc_open(struct inode * inode, struct file * file)
144144
old_fops = file->f_op;
145145
file->f_op = new_fops;
146146
if (file->f_op->open) {
147+
file->private_data = c;
147148
err=file->f_op->open(inode,file);
148149
if (err) {
149150
fops_put(file->f_op);

0 commit comments

Comments
 (0)