+static bool
+ver_in_range(int ver, int min_ver, int max_ver)
+{
+ return ((min_ver == 0 || ver >= min_ver) &&
+ (max_ver == 0 || ver <= max_ver));
+}
+
+static bool
+skip_if_ver_mismatch(struct parser_context *ctx, int min_ver, int max_ver)
+{
+ if (!ctx->parse_skip_depth && !ver_in_range(ctx->devinfo->ver,
+ min_ver, max_ver)) {
+ assert(ctx->parse_depth != 0);
+ ctx->parse_skip_depth = ctx->parse_depth;
+ }
+
+ return ctx->parse_skip_depth;
+}
+