Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / video / fbdev / core / fb_cmdline.c
blob4d1634c492ec4db7f8e4786bb0190e752fac77c4
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 * Daniel Vetter <daniel.vetter@ffwll.ch>
18 #include <linux/export.h>
19 #include <linux/fb.h>
20 #include <linux/string.h>
22 #include <video/cmdline.h>
24 /**
25 * fb_get_options - get kernel boot parameters
26 * @name: framebuffer name as it would appear in
27 * the boot parameter line
28 * (video=<name>:<options>)
29 * @option: the option will be stored here
31 * The caller owns the string returned in @option and is
32 * responsible for releasing the memory.
34 * NOTE: Needed to maintain backwards compatibility
36 int fb_get_options(const char *name, char **option)
38 const char *options = NULL;
39 bool is_of = false;
40 bool enabled;
42 if (name)
43 is_of = strncmp(name, "offb", 4);
45 enabled = __video_get_options(name, &options, is_of);
47 if (options) {
48 if (!strncmp(options, "off", 3))
49 enabled = false;
52 if (option) {
53 if (options)
54 *option = kstrdup(options, GFP_KERNEL);
55 else
56 *option = NULL;
59 return enabled ? 0 : 1; // 0 on success, 1 otherwise
61 EXPORT_SYMBOL(fb_get_options);