> int skull_open(struct inode * inode, struct file * filp) > { > int i; > loff_t *bil; > Dev *dev; > const char *buf; > printk("Major Number =>%d\n",inode->i_rdev >> 8); > printk("Minor Number =>%d\n",inode->i_rdev & 0xff); > > filp->f_op = &f_ops; > > sema_init(&dev->sem, 1); > there is nothing in filp->private_data at this point. So you are pointing your dev pointer off into nowhere. You should probably do something like: dev = kmalloc( sizeof( struct Dev ), GFP_KERNEL ); filp->private_data = ( Dev * )( dev ); And then continue on. > dev = (Dev *)filp->private_data; > > /* the problem is below */ > > if((filp->f_flags & O_ACCMODE) == O_WRONLY) { > down_interruptible(&dev->sem); > up(&dev->sem); > > } > MOD_INC_USE_COUNT; > return 0; > > } -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/