video/fbdev: refactor video= cmdline parsing

Make the video_setup() function slightly easier to read by removing the
repeated checks for !global. Remove the misleading return value comment
while at it.

I'm slightly hesitant to change any of this, but here goes anyway, with
hopes that the next person to have to look at this has it a wee bit
easier.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
This commit is contained in:
Jani Nikula 2019-02-08 19:24:47 +01:00 committed by Bartlomiej Zolnierkiewicz
parent 72aed9e313
commit a41458d74c
1 changed files with 10 additions and 13 deletions

View File

@ -75,36 +75,33 @@ EXPORT_SYMBOL(fb_get_options);
* NOTE: This function is a __setup and __init function. * NOTE: This function is a __setup and __init function.
* It only stores the options. Drivers have to call * It only stores the options. Drivers have to call
* fb_get_options() as necessary. * fb_get_options() as necessary.
*
* Returns zero.
*
*/ */
static int __init video_setup(char *options) static int __init video_setup(char *options)
{ {
int i, global = 0;
if (!options || !*options) if (!options || !*options)
global = 1; goto out;
if (!global && !strncmp(options, "ofonly", 6)) { if (!strncmp(options, "ofonly", 6)) {
ofonly = 1; ofonly = 1;
global = 1; goto out;
} }
if (!global && !strchr(options, ':')) { if (strchr(options, ':')) {
fb_mode_option = options; /* named */
global = 1; int i;
}
if (!global) {
for (i = 0; i < FB_MAX; i++) { for (i = 0; i < FB_MAX; i++) {
if (video_options[i] == NULL) { if (video_options[i] == NULL) {
video_options[i] = options; video_options[i] = options;
break; break;
} }
} }
} else {
/* global */
fb_mode_option = options;
} }
out:
return 1; return 1;
} }
__setup("video=", video_setup); __setup("video=", video_setup);