| From | Yisheng Xie <> | Subject | [PATCH 24/33] drm: use match_string() helper | Date | Mon, 21 May 2018 19:58:01 +0800 |
| |
match_string() returns the index of an array for a matching string, which can be used intead of open coded variant.
Cc: Gustavo Padovan <gustavo@padovan.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Sean Paul <seanpaul@chromium.org> Cc: David Airlie <airlied@linux.ie> Cc: dri-devel@lists.freedesktop.org Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com> --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c index 902cc1a..3367c36 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -136,7 +136,6 @@ int drm_get_panel_orientation_quirk(int width, int height) const struct dmi_system_id *match; const struct drm_dmi_panel_orientation_data *data; const char *bios_date; - int i; for (match = dmi_first_match(orientation_data); match; @@ -154,10 +153,8 @@ int drm_get_panel_orientation_quirk(int width, int height) if (!bios_date) continue; - for (i = 0; data->bios_dates[i]; i++) { - if (!strcmp(data->bios_dates[i], bios_date)) - return data->orientation; - } + if (match_string(data->bios_dates, -1, bios_date) >= 0) + return data->orientation; } return DRM_MODE_PANEL_ORIENTATION_UNKNOWN; -- 1.7.12.4
|