register_chrdev, unregister_chrdev - register a driver major
int register_chrdev(unsigned int major, const char*name,
int unregister_chrdev(unsigned int major, const char *name));
The register_chrdev function associates a character major
number with set of driver entry points. The file_operations
structure contains pointers to functions that the the driver
uses to implement the kernel interface to the driver.
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.
On success, register_chrdev returns 0 if major is a number
other then 0, otherwise Linux will choose a major number and
return the chosen value.
If there is an error, one of the following codes is returned
The specified number is not valid (> MAX_CHRDEV)
The major number is busy
The unregister_chrdev function will return 0 if successful,
or -EINVAL if the major number is not registered with the
Stephen Williams (email@example.com)