Arm-Linux S3C2440 UART analysis (4)

Source: Internet
Author: User

==== This article is the original site. You are welcome to reprint it! Reprinted please indicate the source: http://blog.csdn.net/yyplc====

After the registration is complete, how is the device connected to the driver? It turns out that the device has been connected in driver_register () registration.

The serial port is a platform device. The device registration is completed in the system framework setup_arch (), and the device registration is prior to the driver registration. Finally, the connection between the serial port device and the driver is in driver_register () --> bus_add_driver.

Int bus_add_driver (struct device_driver * DRV) {intret; structdevice_driver * Other ;... If (DRV-> bus-> P-> drivers_autoprobe) {// platfrom_but_type = 1 automatic platfrom device error = driver_attach (DRV); If (error) goto out_unregister ;} ....}

Finally, driver_attach () --> bus_for_each_dev () to connect the serial device to the driver.

Int bus_for_each_dev (struct bus_type * bus, struct device * Start, void * data, INT (* fN) (struct device *, void *) {structklist_iter I; structdevice * dev; interror = 0; If (! Bus) Return-einval; klist_iter_init_node (& bus-> P-> klist_devices, & I, (start? & START-> P-> knode_bus: NULL); While (Dev = next_device (& I ))&&! Error) // traverse all corresponding devices. Error = FN (Dev, data); klist_iter_exit (& I); Return Error ;}

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.