Commit f9e5de0f authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: xgifb: eliminate string comparison from mode search

Eliminate string comparison from the video mode search.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f47f12d6
...@@ -390,19 +390,26 @@ static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info) ...@@ -390,19 +390,26 @@ static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info)
static void XGIfb_search_mode(struct xgifb_video_info *xgifb_info, static void XGIfb_search_mode(struct xgifb_video_info *xgifb_info,
const char *name) const char *name)
{ {
int i = 0, j = 0, l; unsigned int xres;
unsigned int yres;
unsigned int bpp;
int i;
while (XGIbios_mode[i].mode_no != 0) { if (sscanf(name, "%ux%ux%u", &xres, &yres, &bpp) != 3)
l = min(strlen(name), strlen(XGIbios_mode[i].name)); goto invalid_mode;
if (!strncmp(name, XGIbios_mode[i].name, l)) {
if (bpp == 24)
bpp = 32; /* That's for people who mix up color and fb depth. */
for (i = 0; XGIbios_mode[i].mode_no != 0; i++)
if (XGIbios_mode[i].xres == xres &&
XGIbios_mode[i].yres == yres &&
XGIbios_mode[i].bpp == bpp) {
xgifb_info->mode_idx = i; xgifb_info->mode_idx = i;
j = 1; return;
break;
} }
i++; invalid_mode:
} pr_info("Invalid mode '%s'\n", name);
if (!j)
pr_info("Invalid mode '%s'\n", name);
} }
static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info, static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment