File: fb_cmdline.c

package info (click to toggle)
linux 6.16.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,724,628 kB
  • sloc: ansic: 26,562,645; asm: 271,329; sh: 144,039; python: 72,469; makefile: 57,135; perl: 36,821; xml: 19,553; cpp: 5,820; yacc: 4,915; lex: 2,955; awk: 1,667; sed: 28; ruby: 25
file content (61 lines) | stat: -rw-r--r-- 1,397 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 *  linux/drivers/video/fb_cmdline.c
 *
 *  Copyright (C) 2014 Intel Corp
 *  Copyright (C) 1994 Martin Schaller
 *
 *	2001 - Documented with DocBook
 *	- Brad Douglas <brad@neruo.com>
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive
 * for more details.
 *
 * Authors:
 *    Daniel Vetter <daniel.vetter@ffwll.ch>
 */

#include <linux/export.h>
#include <linux/fb.h>
#include <linux/string.h>

#include <video/cmdline.h>

/**
 * fb_get_options - get kernel boot parameters
 * @name:   framebuffer name as it would appear in
 *          the boot parameter line
 *          (video=<name>:<options>)
 * @option: the option will be stored here
 *
 * The caller owns the string returned in @option and is
 * responsible for releasing the memory.
 *
 * NOTE: Needed to maintain backwards compatibility
 */
int fb_get_options(const char *name, char **option)
{
	const char *options = NULL;
	bool is_of = false;
	bool enabled;

	if (name)
		is_of = strncmp(name, "offb", 4);

	enabled = __video_get_options(name, &options, is_of);

	if (options) {
		if (!strncmp(options, "off", 3))
			enabled = false;
	}

	if (option) {
		if (options)
			*option = kstrdup(options, GFP_KERNEL);
		else
			*option = NULL;
	}

	return enabled ? 0 : 1; // 0 on success, 1 otherwise
}
EXPORT_SYMBOL(fb_get_options);