디바이스 드라이버 질문

삼구의신의 이미지

linux app에서 read 함수를 이용해 디바이스에서 값을 읽어오려고 하고 있습니다.

디바이스가 잘 등록됐고 app을 실행시키면
open에서 error가 납니다.
dmseg 를 찍어보면 아래 모듈코드처럼 open, release 함수가 출력되는 것을 확인할 수있는데,
그럼 디바이스의 함수는 호출이 된건데.. 왜 app에서는 fail이 뜨는지 모르겠습니다.
아래 코드 올립니다.

//app 코드
 
dev = open("/dev/virtual_device", O_RDWR)
 
/// device 코드
 
int virtual_device_open(struct inode *inode, struct file *filp) {
    printk(KERN_ALERT "ice open function called\n");
    return 0;
}
 
int virtual_device_release(struct inode *inode, struct file *filp) {
    printk(KERN_ALERT "virtual device release function called\n");
    return 0;
}
 
//dmseg | tail -10 출력된 것
# dmesg | tail -10
[  223.155089] driver init successful
[  255.329758] virtual_device open function called
[  255.329824] virtual device release function called