[PATCH 24/33] drm: use match_string() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
Cc: Sean Paul <seanpaul@xxxxxxxxxxxx>
Cc: David Airlie <airlied@xxxxxxxx>
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Yisheng Xie <xieyisheng1@xxxxxxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux