其他分享
首页 > 其他分享> > u-boot driver_check_compatible函数

u-boot driver_check_compatible函数

作者:互联网

/**
 * driver_check_compatible() - Check if a driver matches a compatible string
 *
 * @param of_match:    List of compatible strings to match
 * @param of_idp:    Returns the match that was found
 * @param compat:    The compatible string to search for
 * @return 0 if there is a match, -ENOENT if no match
 */
static int driver_check_compatible(const struct udevice_id *of_match,
                   const struct udevice_id **of_idp,
                   const char *compat)
{
    if (!of_match)
        return -ENOENT;

    while (of_match->compatible) {
        if (!strcmp(of_match->compatible, compat)) {
            *of_idp = of_match;
            return 0;
        }
        of_match++;
    }

    return -ENOENT;
}

函数位于driver/core/list.c文件。

 

标签:compat,return,driver,boot,compatible,check,match
来源: https://www.cnblogs.com/liujunhuasd/p/15914838.html