Working of character driver :see diagram & also see some queries of character driver.
This image has been resized to fit in the page. Click to enlarge.
The above diagram show how the character driver works in linux , user space to kernel space .
but when we implementing the driver there are many issues are find from inserting a driver to Removing the driver.
some are following:
why we use use sculldev because only cdev work as device of application ?
why we use container_of function if it,s only use of access the cdev address then what is its internal operations and how it work ?
we use kmalloc for providing the memory to sculldev if we want to print the value of sculldev which is garbage then that show errors : the variable is struct sculldev but we print value with %c ,there have no effect if we use type casting , what is solution ?
we use memset for fill the null values in sculldev how we can check sculldev filled with null ?
In cleanup function we use kfree ,that means free the memory of sculldev ,how we can check memory is totally free ,i mean how we can see that ?
The return type of unregister_chrdev_region is void ,if we want check our device is unregistered sucessfully using printk statement.
what is motive of using cdev_del function because we already use rmmod,unregister function and after that cdev_del function ,what main purpose of this function ,we can see the output of this function.
what fundamentals of struct file and why we make the struct file_operations because that is already included in header file which is fs.h and cdev.h .
Cdev is used for attachment of kernel to driver as an interface so that driver module may run with running module while sculldev will act as a virtual device....in which we perform write or read..