cdev_device_add — add a char device and it's corresponding struct device, linkink
int cdev_device_add ( | struct cdev * cdev, |
struct device * dev) ; |
cdev_device_add
adds the char device represented by cdev
to the system,
just as cdev_add does. It then adds dev
to the system using device_add
The dev_t for the char device will be taken from the struct device which
needs to be initialized first. This helper function correctly takes a
reference to the parent device so the parent will not get released until
all references to the cdev are released.
This helper uses dev->devt for the device number. If it is not set it will not add the cdev and it will be equivalent to device_add.
This function should be used whenever the struct cdev and the struct device are members of the same structure whose lifetime is managed by the struct device.