关于platform中的id_table
来源:互联网 发布:淘宝美工助理下载 编辑:程序博客网 时间:2024/06/08 01:30
转载 http://blog.csdn.net/mcgrady_tracy/article/details/38980991
内核版本:Linux-3.4.67
platform的match函数如下:
- /**
- * platform_match - bind platform device to platform driver.
- * @dev: device.
- * @drv: driver.
- *
- * Platform device IDs are assumed to be encoded like this:
- * "<name><instance>", where <name> is a short description of the type of
- * device, like "pci" or "floppy", and <instance> is the enumerated
- * instance of the device, like '0' or '42'. Driver IDs are simply
- * "<name>". So, extract the <name> from the platform_device structure,
- * and compare it against the name of the driver. Return whether they match
- * or not.
- */
- static int platform_match(struct device *dev, struct device_driver *drv)
- {
- struct platform_device *pdev = to_platform_device(dev);
- struct platform_driver *pdrv = to_platform_driver(drv);
- /* Attempt an OF style match first */
- if (of_driver_match_device(dev, drv))
- return 1;
- /* Then try to match against the id table */
- if (pdrv->id_table)
- return platform_match_id(pdrv->id_table, pdev) != NULL;
- /* fall-back to driver name match */
- return (strcmp(pdev->name, drv->name) == 0);
- }
- static struct platform_device_id s3c_rtc_driver_ids[] = {
- {
- .name = "s3c2410-rtc",
- .driver_data = TYPE_S3C2410,
- }, {
- .name = "s3c2416-rtc",
- .driver_data = TYPE_S3C2416,
- }, {
- .name = "s3c2443-rtc",
- .driver_data = TYPE_S3C2443,
- }, {
- .name = "s3c64xx-rtc",
- .driver_data = TYPE_S3C64XX,
- },
- { }
- };
- static struct platform_driver s3c_rtc_driver = {
- .probe = s3c_rtc_probe,
- .remove = __devexit_p(s3c_rtc_remove),
- .suspend = s3c_rtc_suspend,
- .resume = s3c_rtc_resume,
- .id_table = s3c_rtc_driver_ids,
- .driver = {
- .name = "s3c-rtc",
- .owner = THIS_MODULE,
- .of_match_table = s3c_rtc_dt_match,
- },
- };
2410的platfrom_device定义如下:
- struct platform_device s3c_device_rtc = {
- .name = "s3c2410-rtc",
- .id = -1,
- .num_resources = ARRAY_SIZE(s3c_rtc_resource),
- .resource = s3c_rtc_resource,
- };
0 0
- 关于platform中的id_table
- 关于platform中的id_table
- id_match_table和id_table
- linux id_table与of_match_table
- 关于 platform的文章
- MIDlet中的platform函数
- Linux驱动中的platform
- Linux驱动中的platform
- Linux驱动中的platform
- Linux中的platform
- Linux驱动中的platform
- Linux驱动中的platform
- linux中的platform设备
- Linux驱动中的platform
- Linux驱动中的platform
- ASoC架构中的Platform
- Linux驱动中的platform
- Linux中的platform
- Tomcat中部署web应用 ---- Dubbo服务消费者Web应用war包的部署
- mpi4py在MPICH2上的安装
- [ZooKeeper]ZooKeeper的会话状态
- 谈谈数据结构课后作业......尴尬不已...《图》 后面的迷宫问题
- android学习笔记-Activity之间传值的3种方法
- 关于platform中的id_table
- Dubbo监控中心的介绍与简易监控中心的安装
- Android开源组件一:Viwflow
- iOS Provisioning Profile(Certificate)与Code Signing详解
- [知其然不知其所以然-26] Why shouldn't you use IS_ERR_VALUE
- 写好软件的诀窍
- 多线程加强之死锁
- 完全数的判断
- Asp.net MVC使用KindEditor 4.X无法取到textarea的值