Linux driver module_platform_driver macro learning
It is common to see this macro module_platform_driver on Linux devices. The following figure shows a character device driver. Today we’re going to learn about this macro.
2, the macro is in kernel/include/Linux/platform_device. H defined inside. We find that this calls another macro, module_driver.
. So where is the module_driver macro defined?For once, the macro is in kernel/include/Linux/device. The definition of h.
The macro module_platform_driver can be used to write much less code. The purpose of the macro is to define the platform driver registration function and the platform driver unregistration function with the specified name, and to register and unregister the platform driver within the function body with the functions platform_driver_register() and Platform_driver_unregister (), respectively.
static int x_init(void)
{
return platform_driver_register(& xxx);
}
module_init(xxx_init);
static void __exit xxx_init(void)
{
return platform_driver_unregister(& xxx);
}
module_exit(xxx_exit);
Read More:
- Failed to initialize nvml driver / library version mismatch due to automatic update of NVIDIA driver
- java.lang.ClassNotFoundException : com.mysql.jdbc . driver project cannot connect to database, exception, lack of MySQL driver
- make modules_ Install compiles the kernel driver as a module, and the location of. Ko file in the root file
- Wireless network solution of deepin Linux network card driver (manual) installation
- Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb
- Solution to the error of ODBC driver in windows installation of Postgres database
- Failed to determine a suitable driver class error in mybatis
- How to uninstall CUDA driver and toolkit in Mac OS X?
- [Solved] org.mongodb.driver.cluster – Exception in monitor thread while connecting to server node1:27017
- NVIDIA NVML Driver/library version mismatch
- Solution to “initializing the Oracle asmlib driver: [failed]”
- Used by: Java. Lang. classnotfoundexception: org. PostgreSQL. Driver
- MySQL driver compiling method of QT under windows and solutions to abnormal errors
- Attempt to reset the display driver and recover from timeout failed
- Failed to install realtek HD audio driver Code:0xE0000247
- [springboot] problem failed to determine a suitable driver class
- Mybatis exception error setting driver on unpoleddatasource. Cause: java.lang.ClassNotFoundException :
- Failed to determine a suitable driver class
- The NPF driver isn’t running. You may have trouble capturing or listing interfaces
- Nvidia-smi has failed because it could’t communicate with the NVIDIA driver