Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci support building as a module



details:   https://anonhg.NetBSD.org/src/rev/210221542208
branches:  trunk
changeset: 762352:210221542208
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Feb 20 03:56:45 2011 +0000

description:
support building as a module

diffstat:

 sys/dev/pci/if_ath_pci.c |  34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diffs (59 lines):

diff -r 48b1082228d7 -r 210221542208 sys/dev/pci/if_ath_pci.c
--- a/sys/dev/pci/if_ath_pci.c  Sun Feb 20 03:56:36 2011 +0000
+++ b/sys/dev/pci/if_ath_pci.c  Sun Feb 20 03:56:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ath_pci.c,v 1.39 2011/01/26 00:08:30 dyoung Exp $   */
+/*     $NetBSD: if_ath_pci.c,v 1.40 2011/02/20 03:56:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ath_pci.c,v 1.39 2011/01/26 00:08:30 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ath_pci.c,v 1.40 2011/02/20 03:56:45 jmcneill Exp $");
 
 /*
  * PCI/Cardbus front-end for the Atheros Wireless LAN controller driver.
@@ -48,6 +48,7 @@
 #include <sys/kernel.h>
 #include <sys/errno.h>
 #include <sys/device.h>
+#include <sys/module.h>
 
 #include <external/isc/atheros_hal/dist/ah.h>
 
@@ -274,3 +275,32 @@
        }
        return true;
 }
+
+MODULE(MODULE_CLASS_DRIVER, if_ath_pci, "ath");
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+if_ath_pci_modcmd(modcmd_t cmd, void *opaque)
+{
+       int error = 0;
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+#ifdef _MODULE
+               error = config_init_component(cfdriver_ioconf_if_ath_pci,
+                   cfattach_ioconf_if_ath_pci, cfdata_ioconf_if_ath_pci);
+#endif
+               return error;
+       case MODULE_CMD_FINI:
+#ifdef _MODULE
+               error = config_fini_component(cfdriver_ioconf_if_ath_pci,
+                   cfattach_ioconf_if_ath_pci, cfdata_ioconf_if_ath_pci);
+#endif
+               return error;
+       default:
+               return ENOTTY;
+       }
+}



Home | Main Index | Thread Index | Old Index