LCOV - code coverage report
Current view: top level - drivers/video/fbdev/core - fb_cmdline.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 35 0.0 %
Date: 2022-12-09 01:23:36 Functions: 0 2 0.0 %

          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             :  *    Vetter <danie.vetter@ffwll.ch>
      16             :  */
      17             : #include <linux/init.h>
      18             : #include <linux/fb.h>
      19             : 
      20             : static char *video_options[FB_MAX] __read_mostly;
      21             : static int ofonly __read_mostly;
      22             : 
      23             : const char *fb_mode_option;
      24             : EXPORT_SYMBOL_GPL(fb_mode_option);
      25             : 
      26             : /**
      27             :  * fb_get_options - get kernel boot parameters
      28             :  * @name:   framebuffer name as it would appear in
      29             :  *          the boot parameter line
      30             :  *          (video=<name>:<options>)
      31             :  * @option: the option will be stored here
      32             :  *
      33             :  * NOTE: Needed to maintain backwards compatibility
      34             :  */
      35           0 : int fb_get_options(const char *name, char **option)
      36             : {
      37           0 :         char *opt, *options = NULL;
      38           0 :         int retval = 0;
      39           0 :         int name_len = strlen(name), i;
      40             : 
      41           0 :         if (name_len && ofonly && strncmp(name, "offb", 4))
      42           0 :                 retval = 1;
      43             : 
      44           0 :         if (name_len && !retval) {
      45           0 :                 for (i = 0; i < FB_MAX; i++) {
      46           0 :                         if (video_options[i] == NULL)
      47           0 :                                 continue;
      48           0 :                         if (!video_options[i][0])
      49           0 :                                 continue;
      50           0 :                         opt = video_options[i];
      51           0 :                         if (!strncmp(name, opt, name_len) &&
      52           0 :                             opt[name_len] == ':')
      53           0 :                                 options = opt + name_len + 1;
      54             :                 }
      55             :         }
      56             :         /* No match, pass global option */
      57           0 :         if (!options && option && fb_mode_option)
      58           0 :                 options = kstrdup(fb_mode_option, GFP_KERNEL);
      59           0 :         if (options && !strncmp(options, "off", 3))
      60           0 :                 retval = 1;
      61             : 
      62           0 :         if (option)
      63           0 :                 *option = options;
      64             : 
      65           0 :         return retval;
      66             : }
      67             : EXPORT_SYMBOL(fb_get_options);
      68             : 
      69             : /**
      70             :  *      video_setup - process command line options
      71             :  *      @options: string of options
      72             :  *
      73             :  *      Process command line options for frame buffer subsystem.
      74             :  *
      75             :  *      NOTE: This function is a __setup and __init function.
      76             :  *            It only stores the options.  Drivers have to call
      77             :  *            fb_get_options() as necessary.
      78             :  */
      79           0 : static int __init video_setup(char *options)
      80             : {
      81           0 :         if (!options || !*options)
      82             :                 goto out;
      83             : 
      84           0 :         if (!strncmp(options, "ofonly", 6)) {
      85           0 :                 ofonly = 1;
      86           0 :                 goto out;
      87             :         }
      88             : 
      89           0 :         if (strchr(options, ':')) {
      90             :                 /* named */
      91             :                 int i;
      92             : 
      93           0 :                 for (i = 0; i < FB_MAX; i++) {
      94           0 :                         if (video_options[i] == NULL) {
      95           0 :                                 video_options[i] = options;
      96           0 :                                 break;
      97             :                         }
      98             :                 }
      99             :         } else {
     100             :                 /* global */
     101           0 :                 fb_mode_option = options;
     102             :         }
     103             : 
     104             : out:
     105           0 :         return 1;
     106             : }
     107             : __setup("video=", video_setup);

Generated by: LCOV version 1.14