int register_chrdev(unsigned int major, const char*name,
struct file_operations*ops);
int unregister_chrdev(unsigned int major, const char *name);
The paramter major is the character major number assigned to the device driver and to be mapped to the function table. The name parameter is a short name for the device and is displayed in the The /proc/devices list. It also must exactly match the name passed to unregister_chrdev function when releasing the functions.
A device driver module may register as many different major numbers as it supports, though this is not typically done.
The unregister_chrdev function releases the major number, and is normally called in the module_cleanup function to remove the driver from the kernel.
If there is an error, one of the following codes is returned instead:
The unregister_chrdev function will return 0 if successful, or -EINVAL if the major number is not registered with the matching name.