소스 검색

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 <samu.p.onkalo@nokia.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Samu Onkalo 15 년 전
부모
커밋
fa1f68db6c
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      drivers/char/misc.c

+ 1 - 0
drivers/char/misc.c

@@ -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);