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文件。

相关