Platform-type device automatically creates analysis "go" of device nodes in the/dev directory

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/rockrockwu/article/details/7357648

System boot process platform device, the driver registration is complete, why in the/dev directory is automatically created a good device node?

The Automatically created device node in the/dev directory can be passed class_create () and then Device_create (). But in tracking

Kernel platform registration process can be found, in fact, there is no appeal two function, then platform registration

How do I create a device file node in the/dev directory?

[CPP]View PlainCopy
  1. int Device_add (struct device *dev)
  2. {
  3. ... ...
  4. if (MAJOR (dev->devt)) {
  5. Error = Device_create_file (dev, &devt_attr);
  6. if (Error)
  7. Goto Ueventattrerror;
  8. Error = Device_create_sys_dev_entry (dev);
  9. if (Error)
  10. Goto Devtattrerror;
  11. Devtmpfs_create_node (Dev);
  12. }
  13. ... ...
  14. }

In the process of Device_add can find the appeal code, first determine whether the dev in the device number, and some of the file creation

Finally, the device node is created in the/dev function through the function devtmpfs_dreate_node (dev).

Platform-type device automatically creates analysis "go" of device nodes in the/dev directory

Related Article

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.