1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/video/fbdev/core/fb_cmdline.c
Thomas Zimmermann 93604a5ade fbdev: Handle video= parameter in video/cmdline.c
Handle the command-line parameter video= in video/cmdline.c. Implement
the fbdev helper fb_get_options() on top. Will allows to handle the
kernel parameter in DRM without fbdev dependencies.

Note that __video_get_options() has the meaning of its return value
inverted compared to fb_get_options(). The new helper returns true if
the adapter has been enabled, and false otherwise.

There is the ofonly parameter, which disables output for non-OF-based
framebuffers. It is only for offb and looks like a workaround. The actual
purpose it not clear to me. Use 'video=off' or 'nomodeset' instead.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230209135509.7786-9-tzimmermann@suse.de
2023-02-20 14:56:48 +01:00

61 lines
1.4 KiB
C

/*
* 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);