[PATCH 6.1 171/634] resource: introduce is_type_match() helper and use it