Struct device * device_create (struct class * class, struct device * parent, dev_t devt, void * drvdata,

Source: Internet
Author: User

/**
* Device_create-creates a device and registers it with sysfs
* @ Class: pointer to the struct class that this device shoshould be registered
* @ Parent: pointer to the parent struct device of this new device, if any
* @ Devt: The dev_t for the char device to be added
* @ Drvdata: The data to be added to the device for callbacks
* @ FMT: string for the device's name
*
* This function can be used by char device classes. A struct 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 device is passed in, the newly created
* Struct device will be a child of that device in sysfs.
* The pointer to the struct device will be returned from the call.
* Any further sysfs files that might be required can be created using this
* Pointer.
*
* Returns & struct device pointer on success, or err_ptr () on error.
*
* Note: The struct class passed to this function must have previusly
* Been created with a call to class_create ().
*/
Struct device * device_create (struct class * class, struct device * parent,
Dev_t devt, void * drvdata, const char * FMT ,...)
{
Va_list vargs;
Struct device * dev;

Va_start (vargs, FMT );
Dev = device_create_vargs (class, parent, devt, drvdata, FMT, vargs );
Va_end (vargs );
Return dev;
}
Export_symbol_gpl (device_create );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.