char dev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am writing a module to Create a char device region through following program.



#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/fs.h>

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("CHAR DEV1");
MODULE_AUTHOR("RAJA");

#define NAME "chardev1"

static int __init init_module4(void);
static void __exit exit_module4(void);

dev_t start = 255;
unsigned int count = 10;
static int __init init_module4()
{
   printk("Hello World 4 \n");
int ret_val = register_chrdev_region(start,count,NAME); if(ret_val)
     printk("Error Occured In Registering Char Devices\n");
   else
     printk("SUCCESS: created Char Devices\n");
   return 0;
}

static void __exit exit_module4()
{
   printk("Cruel World ! Bye\n");
   unregister_chrdev_region(start,count);
}

module_init(init_module4);
module_exit(exit_module4);


but
after insmod i am seeing /proc/devices for the devices that are created but there is only one entry with name
chardev1 with major number 254

and when i use rmmod
in the kernel log it is comming as bad EIP
and when i try to see /proc/devices by
vi /proc/devices it is comming segmentation fault.

Would you please tell me why its comming like that?


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux