Skip to content

Commit 47d4cb8

Browse files
andy-shevjnikula
authored andcommitted
i915: Convert to use match_string() helper
The new helper returns index of the matching string in an array. We are going to use it here. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 74f9474 commit 47d4cb8

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

drivers/gpu/drm/i915/intel_pipe_crc.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -766,13 +766,12 @@ display_crc_ctl_parse_object(const char *buf, enum intel_pipe_crc_object *o)
766766
{
767767
int i;
768768

769-
for (i = 0; i < ARRAY_SIZE(pipe_crc_objects); i++)
770-
if (!strcmp(buf, pipe_crc_objects[i])) {
771-
*o = i;
772-
return 0;
773-
}
769+
i = match_string(pipe_crc_objects, ARRAY_SIZE(pipe_crc_objects), buf);
770+
if (i < 0)
771+
return i;
774772

775-
return -EINVAL;
773+
*o = i;
774+
return 0;
776775
}
777776

778777
static int display_crc_ctl_parse_pipe(struct drm_i915_private *dev_priv,
@@ -798,13 +797,12 @@ display_crc_ctl_parse_source(const char *buf, enum intel_pipe_crc_source *s)
798797
return 0;
799798
}
800799

801-
for (i = 0; i < ARRAY_SIZE(pipe_crc_sources); i++)
802-
if (!strcmp(buf, pipe_crc_sources[i])) {
803-
*s = i;
804-
return 0;
805-
}
800+
i = match_string(pipe_crc_sources, ARRAY_SIZE(pipe_crc_sources), buf);
801+
if (i < 0)
802+
return i;
806803

807-
return -EINVAL;
804+
*s = i;
805+
return 0;
808806
}
809807

810808
static int display_crc_ctl_parse(struct drm_i915_private *dev_priv,

0 commit comments

Comments
 (0)