class_device_create — creates a class device and registers it with sysfs
struct class_device * class_device_create ( | struct class * | cls, |
struct class_device * | parent, | |
dev_t | devt, | |
struct device * | device, | |
const char * | fmt, | |
...) ; |
cls
pointer to the struct class that this device should be registered to.
parent
pointer to the parent struct class_device of this new device, if any.
devt
the dev_t for the char device to be added.
device
a pointer to a struct device that is assiociated with this class device.
fmt
string for the class device's name
...
variable arguments
This function can be used by char device classes. A struct class_device will be created in sysfs, registered to the specified class. A “dev” file will be created, showing the dev_t for the device, if the dev_t is not 0,0. If a pointer to a parent struct class_device is passed in, the newly created struct class_device will be a child of that device in sysfs. The pointer to the struct class_device will be returned from the call. Any further sysfs files that might be required can be created using this pointer.