linux-zen-desktop/drivers/video/fbdev/core/fb_cmdline.c

62 lines
1.4 KiB
C
Raw Permalink Normal View History

2023-08-30 17:31:07 +02:00
/*
* 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:
2023-10-24 12:59:35 +02:00
* Daniel Vetter <daniel.vetter@ffwll.ch>
2023-08-30 17:31:07 +02:00
*/
2023-10-24 12:59:35 +02:00
#include <linux/export.h>
#include <linux/fb.h>
#include <linux/string.h>
2023-08-30 17:31:07 +02:00
2023-10-24 12:59:35 +02:00
#include <video/cmdline.h>
2023-08-30 17:31:07 +02:00
/**
* 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
*
2023-10-24 12:59:35 +02:00
* The caller owns the string returned in @option and is
* responsible for releasing the memory.
*
2023-08-30 17:31:07 +02:00
* NOTE: Needed to maintain backwards compatibility
*/
int fb_get_options(const char *name, char **option)
{
2023-10-24 12:59:35 +02:00
const char *options = NULL;
bool is_of = false;
bool enabled;
2023-08-30 17:31:07 +02:00
2023-10-24 12:59:35 +02:00
if (name)
is_of = strncmp(name, "offb", 4);
2023-08-30 17:31:07 +02:00
2023-10-24 12:59:35 +02:00
enabled = __video_get_options(name, &options, is_of);
2023-08-30 17:31:07 +02:00
2023-10-24 12:59:35 +02:00
if (options) {
if (!strncmp(options, "off", 3))
enabled = false;
2023-08-30 17:31:07 +02:00
}
2023-10-24 12:59:35 +02:00
if (option) {
if (options)
*option = kstrdup(options, GFP_KERNEL);
else
*option = NULL;
2023-08-30 17:31:07 +02:00
}
2023-10-24 12:59:35 +02:00
return enabled ? 0 : 1; // 0 on success, 1 otherwise
2023-08-30 17:31:07 +02:00
}
2023-10-24 12:59:35 +02:00
EXPORT_SYMBOL(fb_get_options);