Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jani Nikula and committed by
Bartlomiej Zolnierkiewicz
a41458d7 72aed9e3

+10 -13
+10 -13
drivers/video/fbdev/core/fb_cmdline.c
··· 75 75 * NOTE: This function is a __setup and __init function. 76 76 * It only stores the options. Drivers have to call 77 77 * fb_get_options() as necessary. 78 - * 79 - * Returns zero. 80 - * 81 78 */ 82 79 static int __init video_setup(char *options) 83 80 { 84 - int i, global = 0; 85 - 86 81 if (!options || !*options) 87 - global = 1; 82 + goto out; 88 83 89 - if (!global && !strncmp(options, "ofonly", 6)) { 84 + if (!strncmp(options, "ofonly", 6)) { 90 85 ofonly = 1; 91 - global = 1; 86 + goto out; 92 87 } 93 88 94 - if (!global && !strchr(options, ':')) { 95 - fb_mode_option = options; 96 - global = 1; 97 - } 89 + if (strchr(options, ':')) { 90 + /* named */ 91 + int i; 98 92 99 - if (!global) { 100 93 for (i = 0; i < FB_MAX; i++) { 101 94 if (video_options[i] == NULL) { 102 95 video_options[i] = options; 103 96 break; 104 97 } 105 98 } 99 + } else { 100 + /* global */ 101 + fb_mode_option = options; 106 102 } 107 103 104 + out: 108 105 return 1; 109 106 } 110 107 __setup("video=", video_setup);