unregister_chrdev() call from [linux\fs.h] used to return 0 if successful and <0 other wise. But now, in newer kernel versions, the return value of the function has been changed to void so it no longer returns any thing.
Question: Is there any way to find out if the unregister_chrdev() call was successful or not?
Within the kernel, the dev_t type (defined in <linux/types. h>) is used to hold device numbers—both the major and minor parts. As of Version 2.6. 0 of the kernel, dev_t is a 32-bit quantity with 12 bits set aside for the major number and 20 for the minor number.
Character device drivers normally perform I/O in a byte stream. Examples of devices using character drivers include tape drives and serial ports. Character device drivers can also provide additional interfaces not present in block drivers, such as I/O control (ioctl) commands, memory mapping, and device polling.
The file_operations Structure. The file_operations structure is defined in linux/fs. h, and holds pointers to functions defined by the driver that perform various operations on the device. Each field of the structure corresponds to the address of some function defined by the driver to handle a requested operation.
The return of void was done by changeset: e53252d97e670a38b1d2e9723b48077bba11ddda
commit e53252d97e670a38b1d2e9723b48077bba11ddda
Author: Akinobu Mita
Date: Thu Jul 19 01:47:51 2007 -0700
unregister_chrdev() return void
unregister_chrdev() does not return meaningful value. This patch makes it
return void like most unregister_* functions.
In fact if you look at the code before (from 2.6.12-rc2 onwards) you can see it always returned 0 so this is a function that is always expected to succeed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With