match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.

Cc: Gustavo Padovan <gust...@padovan.org>
Cc: Maarten Lankhorst <maarten.lankho...@linux.intel.com>
Cc: Sean Paul <seanp...@chromium.org>
Cc: David Airlie <airl...@linux.ie>
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Yisheng Xie <xieyishe...@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

Reply via email to