brintos

brintos / linux-shallow public Read only

0
0
Text · 1.4 KiB · 4d1634c Raw
62 lines · c
1/*2 *  linux/drivers/video/fb_cmdline.c3 *4 *  Copyright (C) 2014 Intel Corp5 *  Copyright (C) 1994 Martin Schaller6 *7 *	2001 - Documented with DocBook8 *	- Brad Douglas <brad@neruo.com>9 *10 * This file is subject to the terms and conditions of the GNU General Public11 * License.  See the file COPYING in the main directory of this archive12 * for more details.13 *14 * Authors:15 *    Daniel Vetter <daniel.vetter@ffwll.ch>16 */17 18#include <linux/export.h>19#include <linux/fb.h>20#include <linux/string.h>21 22#include <video/cmdline.h>23 24/**25 * fb_get_options - get kernel boot parameters26 * @name:   framebuffer name as it would appear in27 *          the boot parameter line28 *          (video=<name>:<options>)29 * @option: the option will be stored here30 *31 * The caller owns the string returned in @option and is32 * responsible for releasing the memory.33 *34 * NOTE: Needed to maintain backwards compatibility35 */36int fb_get_options(const char *name, char **option)37{38	const char *options = NULL;39	bool is_of = false;40	bool enabled;41 42	if (name)43		is_of = strncmp(name, "offb", 4);44 45	enabled = __video_get_options(name, &options, is_of);46 47	if (options) {48		if (!strncmp(options, "off", 3))49			enabled = false;50	}51 52	if (option) {53		if (options)54			*option = kstrdup(options, GFP_KERNEL);55		else56			*option = NULL;57	}58 59	return enabled ? 0 : 1; // 0 on success, 1 otherwise60}61EXPORT_SYMBOL(fb_get_options);62