this code is used to initialize the attribute .and creating the file. struct device_attribute * attr; if(i=device_register(dev)) return i; attr=(struct device_attribute*)kmalloc(sizeof(struct device_attribute),GFP_KERNEL); if(NULL ==attr) { printk(KERN_ERR"Out of memory at %s",__FUNCTION__); device_unregister(dev); return FALSE; } memset(attr,0,sizeof(struct device_attribute)); attr->attr.name="add_target"; attr->attr.mode= S_IRUGO | S_IWUSR; attr->attr.owner=THIS_MODULE; attr->show=add_target_show; attr->store=add_target_store; to_vt_host_info(dev)->add_target=attr; device_create_file(dev ,to_vt_host_info(dev)->add_target); /* ... */ the show function is : static ssize_t add_target_show(struct device * dev, char * buf) { struct vt_host_info *vthost=to_vt_host_info(dev); return(sprintf(buf, "%d\n", vthost->no_target)); } When ever i cat the add_target file in/sys directory it doesnt displays anything. After this when i remove the module kernel panics:(.If i dont cat the add_target_file it doesnot gives me a panic on rmmod. Can anybody give me any pointers? thank you -- play the game -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/