cxl: Fix typo in debug print
[linux/fpc-iii.git] / drivers / video / fbdev / core / fb_cmdline.c
blob39509ccd92f1ef011c2543cfb4dff1112d7f50fd
1 /*
2 * linux/drivers/video/fb_cmdline.c
4 * Copyright (C) 2014 Intel Corp
5 * Copyright (C) 1994 Martin Schaller
7 * 2001 - Documented with DocBook
8 * - Brad Douglas <brad@neruo.com>
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive
12 * for more details.
14 * Authors:
15 * Vetter <danie.vetter@ffwll.ch>
17 #include <linux/init.h>
18 #include <linux/fb.h>
20 static char *video_options[FB_MAX] __read_mostly;
21 static int ofonly __read_mostly;
23 const char *fb_mode_option;
24 EXPORT_SYMBOL_GPL(fb_mode_option);
26 /**
27 * fb_get_options - get kernel boot parameters
28 * @name: framebuffer name as it would appear in
29 * the boot parameter line
30 * (video=<name>:<options>)
31 * @option: the option will be stored here
33 * NOTE: Needed to maintain backwards compatibility
35 int fb_get_options(const char *name, char **option)
37 char *opt, *options = NULL;
38 int retval = 0;
39 int name_len = strlen(name), i;
41 if (name_len && ofonly && strncmp(name, "offb", 4))
42 retval = 1;
44 if (name_len && !retval) {
45 for (i = 0; i < FB_MAX; i++) {
46 if (video_options[i] == NULL)
47 continue;
48 if (!video_options[i][0])
49 continue;
50 opt = video_options[i];
51 if (!strncmp(name, opt, name_len) &&
52 opt[name_len] == ':')
53 options = opt + name_len + 1;
56 /* No match, pass global option */
57 if (!options && option && fb_mode_option)
58 options = kstrdup(fb_mode_option, GFP_KERNEL);
59 if (options && !strncmp(options, "off", 3))
60 retval = 1;
62 if (option)
63 *option = options;
65 return retval;
67 EXPORT_SYMBOL(fb_get_options);
69 /**
70 * video_setup - process command line options
71 * @options: string of options
73 * Process command line options for frame buffer subsystem.
75 * NOTE: This function is a __setup and __init function.
76 * It only stores the options. Drivers have to call
77 * fb_get_options() as necessary.
79 * Returns zero.
82 static int __init video_setup(char *options)
84 int i, global = 0;
86 if (!options || !*options)
87 global = 1;
89 if (!global && !strncmp(options, "ofonly", 6)) {
90 ofonly = 1;
91 global = 1;
94 if (!global && !strchr(options, ':')) {
95 fb_mode_option = options;
96 global = 1;
99 if (!global) {
100 for (i = 0; i < FB_MAX; i++) {
101 if (video_options[i] == NULL) {
102 video_options[i] = options;
103 break;
108 return 1;
110 __setup("video=", video_setup);