diff mbox

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

Message ID 20180503184119.22355-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Shevchenko May 3, 2018, 6:41 p.m. UTC
The new helper returns index of the matching string in an array.
We are going to use it here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Hans de Goede May 7, 2018, 8:12 a.m. UTC | #1
Hi,

On 03-05-18 20:41, Andy Shevchenko wrote:
> The new helper returns index of the matching string in an array.
> We are going to use it here.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, LGTM:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>   drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
> index caebddda8bce..fe9c6c731e87 100644
> --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
> +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
> @@ -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;
>
Sean Paul May 10, 2018, 7:03 p.m. UTC | #2
On Mon, May 07, 2018 at 10:12:47AM +0200, Hans de Goede wrote:
> Hi,
> 
> On 03-05-18 20:41, Andy Shevchenko wrote:
> > The new helper returns index of the matching string in an array.
> > We are going to use it here.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Thanks, LGTM:
> 
> Acked-by: Hans de Goede <hdegoede@redhat.com>

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

Thanks for the patch!

Sean

> 
> Regards,
> 
> Hans
> 
> 
> 
> > ---
> >   drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++----
> >   1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
> > index caebddda8bce..fe9c6c731e87 100644
> > --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
> > +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
> > @@ -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;
> >
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
index caebddda8bce..fe9c6c731e87 100644
--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
@@ -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;