Skip to contentSkip to conversation

drm: panel-orientation-quirks: Convert to use match_string() helper

PATCH Applied Andy Shevchenko 3 participants 4 messages May 3, 2018 – May 10, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: panel-orientation-quirks: 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.

---
 drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +3 -4
index caebddda8bce..fe9c6c731e87 100644
@@ -172,10 +172,9 @@ 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;
-		}
+		i = match_string(data->bios_dates, -1, bios_date);
+		if (i >= 0)
+			return data->orientation;
 	}
 
 	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andy Shevchenko

The new helper returns index of the matching string in an array. We are going to use it here.

Quoted 25 lines
---
 drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +3 -4
index caebddda8bce..fe9c6c731e87 100644
@@ -172,10 +172,9 @@ 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;
-		}
+		i = match_string(data->bios_dates, -1, bios_date);
+		if (i >= 0)
+			return data->orientation;
 	}
 
 	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
Signature · 1 line
2.17.0
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#2 lore raw
In reply to Andy Shevchenko

Hi,

Quoted 4 lines · Andy Shevchenko

The new helper returns index of the matching string in an array. We are going to use it here.

Thanks, LGTM:

Regards,

Hans

Quoted 13 lines
---
  drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +0 -0
index caebddda8bce..fe9c6c731e87 100644
@@ -172,10 +172,9 @@ int drm_get_panel_orientation_quirk(int width, int height)
  		if (!bios_date)
  			continue;
 

drivers/gpu/drm/drm_panel_orientation_quirks.c int drm_get_panel_orientation_quirk(int width, int height) · line 180

Quoted 10 lines
drivers/gpu/drm/drm_panel_orientation_quirks.c +3 -4
-		for (i = 0; data->bios_dates[i]; i++) {
-			if (!strcmp(data->bios_dates[i], bios_date))
-				return data->orientation;
-		}
+		i = match_string(data->bios_dates, -1, bios_date);
+		if (i >= 0)
+			return data->orientation;
  	}
 
  	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Applied
#3 lore raw
Quoted 11 lines · Hans de Goede

Hi,

Quoted 4 lines · Andy Shevchenko

The new helper returns index of the matching string in an array. We are going to use it here.

Thanks, LGTM:

Applied to drm-misc-next with Hans' Ack.

Thanks for the patch!

Sean

Quoted 28 lines

Regards,

Hans

Quoted 21 lines
---
  drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +3 -4
index caebddda8bce..fe9c6c731e87 100644
@@ -172,10 +172,9 @@ 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;
-		}
+		i = match_string(data->bios_dates, -1, bios_date);
+		if (i >= 0)
+			return data->orientation;
  	}
  	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
 
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel