Skip to contentSkip to conversation

video: fbdev: pxafb: Convert to use match_string() helper

PATCH In review Andy Shevchenko 2 participants 8 messages May 3, 2018 – May 15, 2018 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: fbdev: pxafb: 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/video/fbdev/pxafb.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/video/fbdev/pxafb.c +4 -6
index c3d49e13643c..0c013f1efe81 100644
@@ -2099,7 +2099,7 @@ static void pxafb_check_options(struct device *dev, struct pxafb_mach_info *inf)
 
 #if defined(CONFIG_OF)
 static const char * const lcd_types[] = {
-	"unknown", "mono-stn", "mono-dstn", "color-stn", "color-dstn",
+	"mono-stn", "mono-dstn", "color-stn", "color-dstn",
 	"color-tft", "smart-panel", NULL
 };
 
@@ -2115,12 +2115,10 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
 	if (ret)
 		s = "color-tft";
 
-	for (i = 0; lcd_types[i]; i++)
-		if (!strcmp(s, lcd_types[i]))
-			break;
-	if (!i || !lcd_types[i]) {
+	i = match_string(lcd_types, -1, s);
+	if (i < 0) {
 		dev_err(dev, "lcd-type %s is unknown\n", s);
-		return -EINVAL;
+		return i;
 	}
 	info->lcd_conn |= LCD_CONN_TYPE(i);
 	info->lcd_conn |= LCD_CONN_WIDTH(bus_width);
Signature · 1 line
2.17.0
#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.

Patch queued for 4.18, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

#3 lore raw
In reply to Andy Shevchenko
Quoted 11 lines · Andy Shevchenko
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines · Andy Shevchenko

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

Patch queued for 4.18, thanks.

I went through it again and found a bug, the type "unknown" should be left untouched.

Indeed, could you provide incremental fix?

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

#4 lore raw
In reply to Andy Shevchenko
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines · Andy Shevchenko

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

m>

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Patch queued for 4.18, thanks.

I went through it again and found a bug, the type "unknown" should be
left untouched.

Indeed, could you provide incremental fix?

Is it late enough to drop patch completely? If so, I do a fix asap.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#5 lore raw
In reply to Andy Shevchenko
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Andy Shevchenko
Quoted 8 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines · Andy Shevchenko

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

m>

Patch queued for 4.18, thanks.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I went through it again and found a bug, the type "unknown" should be
left untouched.

Indeed, could you provide incremental fix?

Is it late enough to drop patch completely? If so, I do a fix asap.

It is already merged in publicly available tree (which is not being rebased) so it is too late to drop it completely.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

#6 lore raw
In reply to Andy Shevchenko
Quoted 17 lines · Bartlomiej Zolnierkiewicz
Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · Bartlomiej Zolnierkiewicz
Quoted 13 lines · Andy Shevchenko
Quoted 8 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines · Andy Shevchenko

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

m>

Patch queued for 4.18, thanks.

I went through it again and found a bug, the type "unknown" should be
left untouched.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Indeed, could you provide incremental fix?

Is it late enough to drop patch completely? If so, I do a fix asap.

It is already merged in publicly available tree (which is not being rebased) so it is too late to drop it completely.

OK, I fixed it myself with the patch below.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] video: fbdev: pxafb: match_string() conversion fixup

"unknown" lcd_types[] entry is needed for proper operation of the driver, add it back.

Fixes 6d09dfe70f8f ("video: fbdev: pxafb: Convert to use match_string() helper")
Cc Arvind Yadav <[email protected]>
---
 drivers/video/fbdev/pxafb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/video/fbdev/pxafb.c
=================================--- a/drivers/video/fbdev/pxafb.c 2018-05-15 17:41:00.922315366 +0200
+++ b/drivers/video/fbdev/pxafb.c 2018-05-15 17:42:27.474317546 +0200
@@ -2099,7 +2099,7 @@ static void pxafb_check_options(struct d

#if defined(CONFIG_OF)
static const char * const lcd_types[] = {
- "mono-stn", "mono-dstn", "color-stn", "color-dstn",
+ "unknown", "mono-stn", "mono-dstn", "color-stn", "color-dstn",
"color-tft", "smart-panel", NULL
};

#7 lore raw
In reply to Andy Shevchenko
Quoted 5 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines · Bartlomiej Zolnierkiewicz

On Tuesday, May 15, 2018 02:59:20 PM Andy Shevchenko wrote:

It is already merged in publicly available tree (which is not being rebased) so it is too late to drop it completely.

Oh, sorry for that.

Quoted 8 lines

OK, I fixed it myself with the patch below.

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] video: fbdev: pxafb: match_string() conversion fixup

"unknown" lcd_types[] entry is needed for proper operation of the driver, add it back.

Yes, that's correct now.

I was thinking that we perhaps add a comment that the list of these names should be in sync with definitions in the header.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy