XE_RTP_RULES(OR),
},
{
- .name = "or-anything",
- .expected_match = false,
+ .name = "or-yes",
+ .expected_match = true,
.expected_err = -EINVAL,
XE_RTP_RULES(OR, FUNC(match_yes)),
},
+ {
+ .name = "or-no",
+ .expected_match = false,
+ .expected_err = -EINVAL,
+ XE_RTP_RULES(OR, FUNC(match_no)),
+ },
+ {
+ .name = "yes-or",
+ .expected_match = true,
+ /* FIXME: The parser should raise an error here. */
+ .expected_err = 0,
+ XE_RTP_RULES(FUNC(match_yes), OR),
+ },
+ {
+ .name = "no-or",
+ .expected_match = false,
+ .expected_err = -EINVAL,
+ XE_RTP_RULES(FUNC(match_no), OR),
+ },
+ {
+ .name = "no-or-or-yes",
+ .expected_match = true,
+ .expected_err = -EINVAL,
+ XE_RTP_RULES(FUNC(match_no), OR, OR, FUNC(match_yes)),
+ },
+ {
+ .name = "yes-or-or-no",
+ .expected_match = true,
+ /* FIXME: The parser should raise an error here. */
+ .expected_err = 0,
+ XE_RTP_RULES(FUNC(match_yes), OR, OR, FUNC(match_no)),
+ },
+ {
+ .name = "no-or-or-no",
+ .expected_match = false,
+ .expected_err = -EINVAL,
+ XE_RTP_RULES(FUNC(match_no), OR, OR, FUNC(match_no)),
+ },
};
static void xe_rtp_rules_tests(struct kunit *test)
for (r = rules, i = 0; i < n_rules; r = &rules[++i]) {
switch (r->match_type) {
case XE_RTP_MATCH_OR:
+ if (drm_WARN_ON(&xe->drm, !rcount)) {
+ if (err)
+ *err = -EINVAL;
+ continue;
+ }
+
/*
- * This is only reached if a complete set of
- * rules passed or none were evaluated. For both cases,
- * shortcut the other rules and return the proper value.
+ * This is only reached if a complete conjunction of
+ * rules passed, in which case we shortcut the other
+ * rules and return true.
*/
- goto done;
+ return true;
case XE_RTP_MATCH_PLATFORM:
match = xe->info.platform == r->platform;
break;
}
}
-done:
if (drm_WARN_ON(&xe->drm, !rcount))
goto error;