The serial port is a platform device. The device registration is completed in the system framework setup_arch(), and the device registration precedes the driver registration. Finally, the connection between the serial port device and the driver is completed in driver_register() --> bus_add_driver().
- int bus_add_driver(struct device_driver *drv)
- {
- enter;
- structdevice_driver *other;
- …
- if(drv->bus->p->drivers_autoprobe) { //platfrom_but_type == 1 automatically detects platfrom device
- error= driver_attach(drv);
- if(error)
- goto out_unregister;
- }
- ….
- }
Finally, driver_attach()-->bus_for_each_dev() completes the connection between the serial port device and 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-SINGLE SELECT;
- 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;
- }
Previous article:ARM-Linux s3c2440 UART Analysis (V)
Next article:ARM-Linux s3c2440 UART Analysis (Part 3)
Recommended ReadingLatest update time:2024-11-16 15:28
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- GD32E231 DIY Contest (5) - Complete the driver and settings of DS1302 and the recognition of long and short keys
- Share the troubleshooting of using bq34z100 chip
- The salary and development path of hardware engineers
- Here are some questions about the differential signal amplifier circuit
- How to Meet the Testing Challenges of Multi-Antenna Systems
- A beginner was trapped by the garbage code of the development board for a whole night
- SinlinxA33 development board Linux platform bus device driver
- MSP430 MCU application of timer, PWM, comparator
- I need help. I am using AD17 to learn how to draw a 4-layer board. Is there any good teaching guide?
- Also on the G-question of the electronic competition