Skip to content

Commit 6d09dfe

Browse files
andy-shevbzolnier
authored andcommitted
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. Signed-off-by: Andy Shevchenko <[email protected]> Cc: Arvind Yadav <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
1 parent 598041f commit 6d09dfe

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/video/fbdev/pxafb.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ static void pxafb_check_options(struct device *dev, struct pxafb_mach_info *inf)
20992099

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

@@ -2115,12 +2115,10 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
21152115
if (ret)
21162116
s = "color-tft";
21172117

2118-
for (i = 0; lcd_types[i]; i++)
2119-
if (!strcmp(s, lcd_types[i]))
2120-
break;
2121-
if (!i || !lcd_types[i]) {
2118+
i = match_string(lcd_types, -1, s);
2119+
if (i < 0) {
21222120
dev_err(dev, "lcd-type %s is unknown\n", s);
2123-
return -EINVAL;
2121+
return i;
21242122
}
21252123
info->lcd_conn |= LCD_CONN_TYPE(i);
21262124
info->lcd_conn |= LCD_CONN_WIDTH(bus_width);

0 commit comments

Comments
 (0)