Support building as a module.
This commit is contained in:
parent
4db90e1f38
commit
235a59361f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: i915_drv.c,v 1.3 2008/02/27 18:01:49 drochner Exp $ */
|
||||
/* $NetBSD: i915_drv.c,v 1.4 2008/05/18 20:02:34 jmcneill Exp $ */
|
||||
|
||||
/* i915_drv.c -- ATI Radeon driver -*- linux-c -*-
|
||||
* Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
|
||||
|
@ -32,11 +32,15 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.3 2008/02/27 18:01:49 drochner Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.4 2008/05/18 20:02:34 jmcneill Exp $");
|
||||
/*
|
||||
__FBSDID("$FreeBSD: src/sys/dev/drm/i915_drv.c,v 1.5 2006/05/17 06:36:28 anholt Exp $");
|
||||
*/
|
||||
|
||||
#ifdef _MODULE
|
||||
#include <sys/module.h>
|
||||
#endif
|
||||
|
||||
#include <dev/drm/drmP.h>
|
||||
#include <dev/drm/drm.h>
|
||||
#include "i915_drm.h"
|
||||
|
@ -147,4 +151,63 @@ i915drm_attach(struct device *parent, struct device *self, void *aux)
|
|||
CFATTACH_DECL(i915drm, sizeof(drm_device_t), i915drm_probe, i915drm_attach,
|
||||
drm_detach, drm_activate);
|
||||
|
||||
#ifdef _MODULE
|
||||
|
||||
MODULE(MODULE_CLASS_DRIVER, i915drm, NULL);
|
||||
|
||||
CFDRIVER_DECL(i915drm, DV_DULL, NULL);
|
||||
extern struct cfattach i915drm_ca;
|
||||
static int drmloc[] = { -1 };
|
||||
static struct cfparent drmparent = {
|
||||
"drm", "vga", DVUNIT_ANY
|
||||
};
|
||||
static struct cfdata i915drm_cfdata[] = {
|
||||
{
|
||||
.cf_name = "i915drm",
|
||||
.cf_atname = "i915drm",
|
||||
.cf_unit = 0,
|
||||
.cf_fstate = FSTATE_STAR,
|
||||
.cf_loc = drmloc,
|
||||
.cf_flags = 0,
|
||||
.cf_pspec = &drmparent,
|
||||
},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static int
|
||||
i915drm_modcmd(modcmd_t cmd, void *arg)
|
||||
{
|
||||
int err;
|
||||
|
||||
switch (cmd) {
|
||||
case MODULE_CMD_INIT:
|
||||
err = config_cfdriver_attach(&i915drm_cd);
|
||||
if (err)
|
||||
return err;
|
||||
err = config_cfattach_attach("i915drm", &i915drm_ca);
|
||||
if (err) {
|
||||
config_cfdriver_detach(&i915drm_cd);
|
||||
return err;
|
||||
}
|
||||
err = config_cfdata_attach(i915drm_cfdata, 1);
|
||||
if (err) {
|
||||
config_cfattach_detach("i915drm", &i915drm_ca);
|
||||
config_cfdriver_detach(&i915drm_cd);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
case MODULE_CMD_FINI:
|
||||
err = config_cfdriver_detach(&i915drm_cd);
|
||||
if (err)
|
||||
return err;
|
||||
config_cfattach_detach("i915drm", &i915drm_ca);
|
||||
config_cfdriver_detach(&i915drm_cd);
|
||||
return 0;
|
||||
default:
|
||||
return ENOTTY;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue