Line data Source code
1 : /* 2 : * linux/drivers/video/fb_cmdline.c 3 : * 4 : * Copyright (C) 2014 Intel Corp 5 : * Copyright (C) 1994 Martin Schaller 6 : * 7 : * 2001 - Documented with DocBook 8 : * - Brad Douglas <brad@neruo.com> 9 : * 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. 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 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 30 : * 31 : * The caller owns the string returned in @option and is 32 : * responsible for releasing the memory. 33 : * 34 : * NOTE: Needed to maintain backwards compatibility 35 : */ 36 0 : int fb_get_options(const char *name, char **option) 37 : { 38 0 : const char *options = NULL; 39 0 : bool is_of = false; 40 : bool enabled; 41 : 42 0 : if (name) 43 0 : is_of = strncmp(name, "offb", 4); 44 : 45 0 : enabled = __video_get_options(name, &options, is_of); 46 : 47 0 : if (options) { 48 0 : if (!strncmp(options, "off", 3)) 49 0 : enabled = false; 50 : } 51 : 52 0 : if (option) { 53 0 : if (options) 54 0 : *option = kstrdup(options, GFP_KERNEL); 55 : else 56 0 : *option = NULL; 57 : } 58 : 59 0 : return enabled ? 0 : 1; // 0 on success, 1 otherwise 60 : } 61 : EXPORT_SYMBOL(fb_get_options);