Commit 47d4cb8a authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jani Nikula

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180503181706.22120-1-andriy.shevchenko@linux.intel.com
parent 74f94741
...@@ -766,13 +766,12 @@ display_crc_ctl_parse_object(const char *buf, enum intel_pipe_crc_object *o) ...@@ -766,13 +766,12 @@ display_crc_ctl_parse_object(const char *buf, enum intel_pipe_crc_object *o)
{ {
int i; int i;
for (i = 0; i < ARRAY_SIZE(pipe_crc_objects); i++) i = match_string(pipe_crc_objects, ARRAY_SIZE(pipe_crc_objects), buf);
if (!strcmp(buf, pipe_crc_objects[i])) { if (i < 0)
*o = i; return i;
return 0;
}
return -EINVAL; *o = i;
return 0;
} }
static int display_crc_ctl_parse_pipe(struct drm_i915_private *dev_priv, 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) ...@@ -798,13 +797,12 @@ display_crc_ctl_parse_source(const char *buf, enum intel_pipe_crc_source *s)
return 0; return 0;
} }
for (i = 0; i < ARRAY_SIZE(pipe_crc_sources); i++) i = match_string(pipe_crc_sources, ARRAY_SIZE(pipe_crc_sources), buf);
if (!strcmp(buf, pipe_crc_sources[i])) { if (i < 0)
*s = i; return i;
return 0;
}
return -EINVAL; *s = i;
return 0;
} }
static int display_crc_ctl_parse(struct drm_i915_private *dev_priv, static int display_crc_ctl_parse(struct drm_i915_private *dev_priv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment