mirror of
https://github.com/sysprog21/lkmpg.git
synced 2024-11-22 21:07:34 +08:00
commit
81a1e88c64
|
@ -869,7 +869,7 @@ You do this by using the \cpp|register_chrdev| function, defined by \src{include
|
||||||
int register_chrdev(unsigned int major, const char *name, struct file_operations *fops);
|
int register_chrdev(unsigned int major, const char *name, struct file_operations *fops);
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
where unsigned int major is the major number you want to request, \cpp|const char *name| is the name of the device as it will appear in \verb|/proc/devices| and \cpp|struct file_operations *fops| is a pointer to the \cpp|file_operations| table for your driver.
|
Where unsigned int major is the major number you want to request, \cpp|const char *name| is the name of the device as it will appear in \verb|/proc/devices| and \cpp|struct file_operations *fops| is a pointer to the \cpp|file_operations| table for your driver.
|
||||||
A negative return value means the registration failed. Note that we didn't pass the minor number to \cpp|register_chrdev|.
|
A negative return value means the registration failed. Note that we didn't pass the minor number to \cpp|register_chrdev|.
|
||||||
That is because the kernel doesn't care about the minor number; only our driver uses it.
|
That is because the kernel doesn't care about the minor number; only our driver uses it.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user