diff options
author | Rik Faith <faith@alephnull.com> | 2000-07-20 00:48:12 +0000 |
---|---|---|
committer | Rik Faith <faith@alephnull.com> | 2000-07-20 00:48:12 +0000 |
commit | c459c9ead3476a8edc1cd453fafa2b1c83c20e60 (patch) | |
tree | 7d77f5db4e08829d887d0de84ed7c8b249c458a6 /linux | |
parent | 1d3c4d2ed2d7dd9e91037cff9ef0044a8fc2a6bb (diff) |
Added support for building as modules or as part of monolithic kernel
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drmP.h | 8 | ||||
-rw-r--r-- | linux/gamma_drv.c | 43 | ||||
-rw-r--r-- | linux/i810_drv.c | 42 | ||||
-rw-r--r-- | linux/mga_drv.c | 38 | ||||
-rw-r--r-- | linux/r128_drv.c | 41 | ||||
-rw-r--r-- | linux/tdfx_drv.c | 41 |
6 files changed, 68 insertions, 145 deletions
diff --git a/linux/drmP.h b/linux/drmP.h index 9ad83bde..3362313e 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -129,6 +129,14 @@ typedef struct wait_queue *wait_queue_head_t; #define NOPAGE_OOM 0 #endif + /* module_init/module_exit added in 2.3.13 */ +#ifndef module_init +#define module_init(x) int init_module(void) { return x(); } +#endif +#ifndef module_exit +#define module_exit(x) void cleanup_module(void) { x(); } +#endif + /* Generic cmpxchg added in 2.3.x */ #ifndef __HAVE_ARCH_CMPXCHG /* Include this here so that driver can be diff --git a/linux/gamma_drv.c b/linux/gamma_drv.c index 03f1ee3b..0586b4cf 100644 --- a/linux/gamma_drv.c +++ b/linux/gamma_drv.c @@ -110,49 +110,34 @@ static drm_ioctl_desc_t gamma_ioctls[] = { #define GAMMA_IOCTL_COUNT DRM_ARRAY_SIZE(gamma_ioctls) #ifdef MODULE -int init_module(void); -void cleanup_module(void); static char *gamma = NULL; static int devices = 0; +#endif -MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas."); +MODULE_AUTHOR("VA Linux Systems, Inc."); MODULE_DESCRIPTION("3dlabs GMX 2000"); MODULE_PARM(gamma, "s"); MODULE_PARM(devices, "i"); -MODULE_PARM_DESC(devices, "devices=x, where x is the number of MX chips on your card\n"); - -/* init_module is called when insmod is used to load the module */ +MODULE_PARM_DESC(devices, + "devices=x, where x is the number of MX chips on card\n"); -int init_module(void) -{ - return gamma_init(); -} - -/* cleanup_module is called when rmmod is used to unload the module */ - -void cleanup_module(void) -{ - gamma_cleanup(); -} -#endif +module_init(gamma_init); +module_exit(gamma_cleanup); #ifndef MODULE -/* gamma_setup is called by the kernel to parse command-line options passed - * via the boot-loader (e.g., LILO). It calls the insmod option routine, - * drm_parse_options. - * - * This is not currently supported, since it requires changes to - * linux/init/main.c. */ +/* gamma_options is called by the kernel to parse command-line options + * passed via the boot-loader (e.g., LILO). It calls the insmod option + * routine, drm_parse_options. + */ -void __init gamma_setup(char *str, int *ints) +static int __init gamma_options(char *str, int *ints) { - if (ints[0] != 0) { - DRM_ERROR("Illegal command line format, ignored\n"); - return; - } drm_parse_options(str); + return 1; } + +__setup("gamma=", gamma_options); #endif static int gamma_setup(drm_device_t *dev) diff --git a/linux/i810_drv.c b/linux/i810_drv.c index cef33541..0067785c 100644 --- a/linux/i810_drv.c +++ b/linux/i810_drv.c @@ -123,47 +123,29 @@ static drm_ioctl_desc_t i810_ioctls[] = { #define I810_IOCTL_COUNT DRM_ARRAY_SIZE(i810_ioctls) #ifdef MODULE -int init_module(void); -void cleanup_module(void); static char *i810 = NULL; +#endif -MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas."); +MODULE_AUTHOR("VA Linux Systems, Inc."); MODULE_DESCRIPTION("Intel I810"); MODULE_PARM(i810, "s"); -/* init_module is called when insmod is used to load the module */ - -int init_module(void) -{ - DRM_DEBUG("doing i810_init()\n"); - return i810_init(); -} - -/* cleanup_module is called when rmmod is used to unload the module */ - -void cleanup_module(void) -{ - i810_cleanup(); -} -#endif +module_init(i810_init); +module_exit(i810_cleanup); #ifndef MODULE -/* i810_setup is called by the kernel to parse command-line options passed - * via the boot-loader (e.g., LILO). It calls the insmod option routine, - * drm_parse_drm. - * - * This is not currently supported, since it requires changes to - * linux/init/main.c. */ - +/* i810_options is called by the kernel to parse command-line options + * passed via the boot-loader (e.g., LILO). It calls the insmod option + * routine, drm_parse_drm. + */ -void __init i810_setup(char *str, int *ints) +static int __init i810_options(char *str, int *ints) { - if (ints[0] != 0) { - DRM_ERROR("Illegal command line format, ignored\n"); - return; - } drm_parse_options(str); + return 1; } + +__setup("i810=", i810_options); #endif static int i810_setup(drm_device_t *dev) diff --git a/linux/mga_drv.c b/linux/mga_drv.c index f8fee215..3e486d8f 100644 --- a/linux/mga_drv.c +++ b/linux/mga_drv.c @@ -122,47 +122,29 @@ static drm_ioctl_desc_t mga_ioctls[] = { #define MGA_IOCTL_COUNT DRM_ARRAY_SIZE(mga_ioctls) #ifdef MODULE -int init_module(void); -void cleanup_module(void); static char *mga = NULL; +#endif -MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas."); +MODULE_AUTHOR("VA Linux Systems, Inc."); MODULE_DESCRIPTION("Matrox g200/g400"); MODULE_PARM(mga, "s"); -/* init_module is called when insmod is used to load the module */ - -int init_module(void) -{ - DRM_DEBUG("doing mga_init()\n"); - return mga_init(); -} - -/* cleanup_module is called when rmmod is used to unload the module */ - -void cleanup_module(void) -{ - mga_cleanup(); -} -#endif +module_init(mga_init); +module_exit(mga_cleanup); #ifndef MODULE -/* mga_setup is called by the kernel to parse command-line options passed +/* mga_options is called by the kernel to parse command-line options passed * via the boot-loader (e.g., LILO). It calls the insmod option routine, * drm_parse_drm. - * - * This is not currently supported, since it requires changes to - * linux/init/main.c. */ - + */ -void __init mga_setup(char *str, int *ints) +static int __init mga_options(char *str, int *ints) { - if (ints[0] != 0) { - DRM_ERROR("Illegal command line format, ignored\n"); - return; - } drm_parse_options(str); + return 1; } + +__setup("mga=", mga_options); #endif static int mga_setup(drm_device_t *dev) diff --git a/linux/r128_drv.c b/linux/r128_drv.c index 3a3c4169..1103832c 100644 --- a/linux/r128_drv.c +++ b/linux/r128_drv.c @@ -118,46 +118,29 @@ static drm_ioctl_desc_t r128_ioctls[] = { #define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls) #ifdef MODULE -int init_module(void); -void cleanup_module(void); static char *r128 = NULL; +#endif -MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas."); +MODULE_AUTHOR("VA Linux Systems, Inc."); MODULE_DESCRIPTION("r128"); MODULE_PARM(r128, "s"); -/* init_module is called when insmod is used to load the module */ - -int init_module(void) -{ - return r128_init(); -} - -/* cleanup_module is called when rmmod is used to unload the module */ - -void cleanup_module(void) -{ - r128_cleanup(); -} -#endif +module_init(r128_init); +module_exit(r128_cleanup); #ifndef MODULE -/* r128_setup is called by the kernel to parse command-line options passed - * via the boot-loader (e.g., LILO). It calls the insmod option routine, - * drm_parse_drm. - * - * This is not currently supported, since it requires changes to - * linux/init/main.c. */ - +/* r128_options is called by the kernel to parse command-line options + * passed via the boot-loader (e.g., LILO). It calls the insmod option + * routine, drm_parse_drm. + */ -void __init r128_setup(char *str, int *ints) +static int __init r128_options(char *str, int *ints) { - if (ints[0] != 0) { - DRM_ERROR("Illegal command line format, ignored\n"); - return; - } drm_parse_options(str); + return 1; } + +__setup("r128=", r128_options); #endif static int r128_setup(drm_device_t *dev) diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c index 6c7c5f02..f102757b 100644 --- a/linux/tdfx_drv.c +++ b/linux/tdfx_drv.c @@ -106,46 +106,29 @@ static drm_ioctl_desc_t tdfx_ioctls[] = { #define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls) #ifdef MODULE -int init_module(void); -void cleanup_module(void); static char *tdfx = NULL; +#endif -MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas."); +MODULE_AUTHOR("VA Linux Systems, Inc."); MODULE_DESCRIPTION("tdfx"); MODULE_PARM(tdfx, "s"); -/* init_module is called when insmod is used to load the module */ - -int init_module(void) -{ - return tdfx_init(); -} - -/* cleanup_module is called when rmmod is used to unload the module */ - -void cleanup_module(void) -{ - tdfx_cleanup(); -} -#endif +module_init(tdfx_init); +module_exit(tdfx_cleanup); #ifndef MODULE -/* tdfx_setup is called by the kernel to parse command-line options passed - * via the boot-loader (e.g., LILO). It calls the insmod option routine, - * drm_parse_drm. - * - * This is not currently supported, since it requires changes to - * linux/init/main.c. */ - +/* tdfx_options is called by the kernel to parse command-line options + * passed via the boot-loader (e.g., LILO). It calls the insmod option + * routine, drm_parse_drm. + */ -void __init tdfx_setup(char *str, int *ints) +static int __init tdfx_options(char *str, int *ints) { - if (ints[0] != 0) { - DRM_ERROR("Illegal command line format, ignored\n"); - return; - } drm_parse_options(str); + return 1; } + +__setup("tdfx=", tdfx_options); #endif static int tdfx_setup(drm_device_t *dev) |