Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys get rid of #ifdef __FreeBSD__ sections
details: https://anonhg.NetBSD.org/src/rev/d98068b511a3
branches: trunk
changeset: 762245:d98068b511a3
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Feb 18 02:00:36 2011 +0000
description:
get rid of #ifdef __FreeBSD__ sections
use ioconf & add a module dependency on "drm"
diffstat:
sys/external/bsd/drm/dist/bsd-core/via_drv.c | 120 ++++----------------------
sys/modules/viadrm/Makefile | 3 +-
sys/modules/viadrm/viadrm.ioconf | 9 ++
3 files changed, 29 insertions(+), 103 deletions(-)
diffs (188 lines):
diff -r c125c5056bd9 -r d98068b511a3 sys/external/bsd/drm/dist/bsd-core/via_drv.c
--- a/sys/external/bsd/drm/dist/bsd-core/via_drv.c Fri Feb 18 01:07:20 2011 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/via_drv.c Fri Feb 18 02:00:36 2011 +0000
@@ -39,12 +39,13 @@
viadrv_PCI_IDS
};
-static void via_configure(struct drm_device *dev)
+static void
+via_configure(struct drm_device *dev)
{
dev->driver->driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ;
- dev->driver->buf_priv_size = 1;
+ dev->driver->buf_priv_size = sizeof(drm_via_private_t);
dev->driver->load = via_driver_load;
dev->driver->unload = via_driver_unload;
dev->driver->context_ctor = via_init_context;
@@ -69,60 +70,6 @@
dev->driver->patchlevel = VIA_DRM_DRIVER_PATCHLEVEL;
}
-#if defined(__FreeBSD__)
-static int
-via_probe(device_t kdev)
-{
- return drm_probe(kdev, via_pciidlist);
-}
-
-static int
-via_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- via_configure(dev);
-
- return drm_attach(kdev, via_pciidlist);
-}
-
-static int
-via_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t via_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, via_probe),
- DEVMETHOD(device_attach, via_attach),
- DEVMETHOD(device_detach, via_detach),
-
- { 0, 0 }
-};
-
-static driver_t via_driver = {
- "drm",
- via_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-DRIVER_MODULE(via, pci, via_driver, drm_devclass, 0, 0);
-MODULE_DEPEND(via, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__)
-
static int
viadrm_probe(device_t parent, cfdata_t match, void *aux)
{
@@ -158,62 +105,31 @@
CFATTACH_DECL_NEW(viadrm, sizeof(struct drm_device),
viadrm_probe, viadrm_attach, viadrm_detach, NULL);
-#ifdef _MODULE
-
-MODULE(MODULE_CLASS_DRIVER, viadrm, NULL);
+MODULE(MODULE_CLASS_DRIVER, viadrm, "drm");
-CFDRIVER_DECL(viadrm, DV_DULL, NULL);
-extern struct cfattach viadrm_ca;
-static int drmloc[] = { -1 };
-static struct cfparent drmparent = {
- "drm", "vga", DVUNIT_ANY
-};
-static struct cfdata viadrm_cfdata[] = {
- {
- .cf_name = "viadrm",
- .cf_atname = "viadrm",
- .cf_unit = 0,
- .cf_fstate = FSTATE_STAR,
- .cf_loc = drmloc,
- .cf_flags = 0,
- .cf_pspec = &drmparent,
- },
- { NULL }
-};
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
static int
viadrm_modcmd(modcmd_t cmd, void *arg)
{
- int err;
+ int err = 0;
switch (cmd) {
case MODULE_CMD_INIT:
- err = config_cfdriver_attach(&viadrm_cd);
- if (err)
- return err;
- err = config_cfattach_attach("viadrm", &viadrm_ca);
- if (err) {
- config_cfdriver_detach(&viadrm_cd);
- return err;
- }
- err = config_cfdata_attach(viadrm_cfdata, 1);
- if (err) {
- config_cfattach_detach("viadrm", &viadrm_ca);
- config_cfdriver_detach(&viadrm_cd);
- return err;
- }
- return 0;
+#ifdef _MODULE
+ err = config_init_component(cfdriver_ioconf_viadrm,
+ cfattach_ioconf_viadrm, cfdata_ioconf_viadrm);
+#endif
+ return err;
case MODULE_CMD_FINI:
- err = config_cfdata_detach(viadrm_cfdata);
- if (err)
- return err;
- config_cfattach_detach("viadrm", &viadrm_ca);
- config_cfdriver_detach(&viadrm_cd);
- return 0;
+#ifdef _MODULE
+ err = config_fini_component(cfdriver_ioconf_viadrm,
+ cfattach_ioconf_viadrm, cfdata_ioconf_viadrm);
+#endif
+ return err;
default:
return ENOTTY;
}
}
-#endif /* _MODULE */
-
-#endif
diff -r c125c5056bd9 -r d98068b511a3 sys/modules/viadrm/Makefile
--- a/sys/modules/viadrm/Makefile Fri Feb 18 01:07:20 2011 +0000
+++ b/sys/modules/viadrm/Makefile Fri Feb 18 02:00:36 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2009/09/27 12:44:05 jmcneill Exp $
+# $NetBSD: Makefile,v 1.2 2011/02/18 02:00:36 jmcneill Exp $
.include "../Makefile.inc"
@@ -6,6 +6,7 @@
.PATH: ${S}/external/bsd/drm/dist/shared-core
KMOD= viadrm
+IOCONF= viadrm.ioconf
SRCS= via_drv.c
SRCS+= via_dma.c
diff -r c125c5056bd9 -r d98068b511a3 sys/modules/viadrm/viadrm.ioconf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/viadrm/viadrm.ioconf Fri Feb 18 02:00:36 2011 +0000
@@ -0,0 +1,9 @@
+# $NetBSD: viadrm.ioconf,v 1.1 2011/02/18 02:00:36 jmcneill Exp $
+
+ioconf viadrm
+
+include "conf/files"
+
+pseudo-root drm*
+
+viadrm* at drm?
Home |
Main Index |
Thread Index |
Old Index