Switch linux-core over to 2.6 parameter model to enable debug use

drm_debug=1
This commit is contained in:
Jon Smirl 2004-10-15 02:59:35 +00:00
parent 5e8838fd11
commit fa50e2b513
4 changed files with 7 additions and 120 deletions

View file

@ -188,7 +188,7 @@
#if DRM_DEBUG_CODE
#define DRM_DEBUG(fmt, arg...) \
do { \
if ( drm_flags & DRM_FLAG_DEBUG ) \
if ( drm_debug ) \
printk(KERN_DEBUG \
"[" DRM_NAME ":%s] " fmt , \
__FUNCTION__ , ##arg); \
@ -726,8 +726,6 @@ static inline int drm_core_has_MTRR(struct drm_device *dev)
/*@{*/
/* Misc. support (drm_init.h) */
extern int drm_flags;
extern void drm_parse_options(char *s);
extern int drm_cpu_valid(void);
/* Driver support (drm_drv.h) */
@ -919,6 +917,7 @@ extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
extern int drm_put_dev(drm_device_t * dev);
extern int drm_get_head(drm_device_t * dev, drm_head_t *head);
extern int drm_put_head(drm_head_t * head);
extern unsigned int drm_debug; /* 1 to enable debug output */
extern unsigned int cards_limit;
extern drm_head_t **drm_heads;
extern struct drm_sysfs_class *drm_class;

View file

@ -55,25 +55,6 @@
#include "drm_core.h"
static void __exit drm_cleanup(drm_device_t * dev);
#ifndef MODULE
/** Use an additional macro to avoid preprocessor troubles */
#define DRM_OPTIONS_FUNC drm_options
/**
* Called by the kernel to parse command-line options passed via the
* boot-loader (e.g., LILO). It calls the insmod option routine,
* parse_options().
*/
static int __init drm_options(char *str)
{
drm_parse_options(str);
return 1;
}
__setup(DRIVER_NAME "=", DRM_OPTIONS_FUNC);
#undef DRM_OPTIONS_FUNC
#endif
int drm_fb_loaded = 0;
/** Ioctl table */
@ -289,11 +270,6 @@ void __exit drm_cleanup_pci(struct pci_dev *pdev)
}
EXPORT_SYMBOL(drm_cleanup_pci);
#ifdef MODULE
static char *drm_opts = NULL;
#endif
MODULE_PARM(drm_opts, "s");
/**
* Module initialization. Called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported).
@ -316,10 +292,6 @@ int drm_init(struct drm_driver *driver,
DRM_DEBUG("\n");
#ifdef MODULE
drm_parse_options(drm_opts);
#endif
drm_mem_init();
for (i = 0; (pciidlist[i].vendor != 0) && !drm_fb_loaded; i++) {

View file

@ -35,91 +35,6 @@
#include "drmP.h"
/** Debug flags. Set by parse_option(). */
#if 0
int drm_flags = DRM_FLAG_DEBUG;
#else
int drm_flags = 0;
#endif
EXPORT_SYMBOL(drm_flags);
/**
* Parse a single option.
*
* \param s option string.
*
* \sa See parse_options() for details.
*/
static void drm_parse_option(char *s)
{
char *c, *r;
DRM_DEBUG("\"%s\"\n", s);
if (!s || !*s)
return;
for (c = s; *c && *c != ':'; c++) ; /* find : or \0 */
if (*c)
r = c + 1;
else
r = NULL; /* remember remainder */
*c = '\0'; /* terminate */
if (!strcmp(s, "debug")) {
drm_flags |= DRM_FLAG_DEBUG;
DRM_INFO("Debug messages ON\n");
return;
}
DRM_ERROR("\"%s\" is not a valid option\n", s);
return;
}
/**
* Parse the insmod "drm_opts=" options, or the command-line
* options passed to the kernel via LILO.
*
* \param s contains option_list without the 'drm_opts=' part.
*
* The grammar of the format is as
* follows:
*
* \code
* drm ::= 'drm_opts=' option_list
* option_list ::= option [ ';' option_list ]
* option ::= 'device:' major
* | 'debug'
* | 'noctx'
* major ::= INTEGER
* \endcode
*
* - device=major,minor specifies the device number used for /dev/drm
* - if major == 0 then the misc device is used
* - if major == 0 and minor == 0 then dynamic misc allocation is used
* - debug=on specifies that debugging messages will be printk'd
* - debug=trace specifies that each function call will be logged via printk
* - debug=off turns off all debugging options
*
* \todo Actually only the \e presence of the 'debug' option is currently
* checked.
*/
void drm_parse_options(char *s)
{
char *h, *t, *n;
DRM_DEBUG("\"%s\"\n", s ? : "");
if (!s || !*s)
return;
for (h = t = n = s; h && *h; h = n) {
for (; *t && *t != ';'; t++) ; /* find ; or \0 */
if (*t)
n = t + 1;
else
n = NULL; /* remember next */
*t = '\0'; /* terminate */
drm_parse_option(h); /* parse */
}
}
/**
* Check whether DRI will run on this CPU.
*

View file

@ -37,16 +37,17 @@
#include "drm_core.h"
unsigned int cards_limit = 16; /* Enough for one machine */
unsigned int debug = 0; /* 1 to enable debug output */
unsigned int drm_debug = 0; /* 1 to enable debug output */
EXPORT_SYMBOL(drm_debug);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL and additional rights");
MODULE_PARM_DESC(cards_limit, "Maximum number of graphics cards");
MODULE_PARM_DESC(debug, "Enable debug output");
MODULE_PARM_DESC(drm_debug, "Enable debug output");
module_param(cards_limit, int, 0444);
module_param(debug, int, 0666);
module_param(cards_limit, int, S_IRUGO);
module_param(drm_debug, int, S_IRUGO|S_IWUGO);
drm_head_t **drm_heads;
struct drm_sysfs_class *drm_class;