static int platform_match(struct device*dev,struct device *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;
/*the n tye ACPI style match */
if (acpi_driver_match_device(dev,drv))
renturn 1;
/*then try to match against the id table */
if (pdrv->id_table)
return platform_match_id (pdrv->id_table,pdev)!=NULL;
/*fall-bach to driver name match*/
return (strcmp(pdev->name,drv->name)==0);
platform_device 和platform_driver 有四种匹配可能。
1.基于设备数风格的匹配
2. 基于ACPI风格的匹配
3.基于ID表的(即platform_device 设备名是否出现在platform_driver的ID表内)
4.基于platform_device 设备名何驱动的名字。