summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1998-08-26 07:09:58 +0000
committerimp <imp@FreeBSD.org>1998-08-26 07:09:58 +0000
commit222f7fba3a57219e91133a165007782da163b5e4 (patch)
tree317e7d789e418c5e89807a3bd855cbe96ec3a769
parentd076acdc11e6b4f80d5fb3a65c7f7b12982e2524 (diff)
downloadFreeBSD-src-222f7fba3a57219e91133a165007782da163b5e4.zip
FreeBSD-src-222f7fba3a57219e91133a165007782da163b5e4.tar.gz
o renable pccard_remove_driver (it was used in the skel.c driver)
o update skel.c to lots of stuff that has happened since the last time it was updated.
-rw-r--r--sys/pccard/pccard.c4
-rw-r--r--sys/pccard/skel.c40
2 files changed, 22 insertions, 22 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 3fd3caf..189b043 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pccard.c,v 1.62 1998/06/18 15:32:09 bde Exp $
+ * $Id: pccard.c,v 1.63 1998/08/16 01:21:52 bde Exp $
*/
#include "opt_devfs.h"
@@ -184,7 +184,6 @@ pccard_add_driver(struct pccard_device *drv)
drivers = drv;
}
-#ifdef unused
/*
* pccard_remove_driver - called to unlink driver
* from devices. Usually called when drivers are
@@ -217,7 +216,6 @@ pccard_remove_driver(struct pccard_device *drv)
break;
}
}
-#endif
/*
* pccard_remove_controller - Called when the slot
diff --git a/sys/pccard/skel.c b/sys/pccard/skel.c
index 64d2c89..b26c69a 100644
--- a/sys/pccard/skel.c
+++ b/sys/pccard/skel.c
@@ -37,18 +37,19 @@
#include <sys/exec.h>
#include <sys/lkm.h>
+#include <i386/isa/isa_device.h>
+
#include <sys/select.h>
+#include <sys/kernel.h>
#include <pccard/cardinfo.h>
#include <pccard/driver.h>
#include <pccard/slot.h>
-
/*
* This defines the lkm_misc module use by modload
* to define the module name.
*/
- MOD_MISC( "skel")
-
+MOD_MISC(skel);
static int skelinit(struct pccard_devinfo *); /* init device */
static void skelunload(struct pccard_devinfo *); /* Disable driver */
@@ -75,7 +76,7 @@ static int opened; /* Rather minimal device state... */
* called to deregister the driver before unloading.
*/
static int
-skel_handle( lkmtp, cmd)
+skel_handle(lkmtp, cmd)
struct lkm_table *lkmtp;
int cmd;
{
@@ -85,12 +86,6 @@ int cmd;
switch( cmd) {
case LKM_E_LOAD:
-
- /*
- * Don't load twice! (lkmexists() is exported by kern_lkm.c)
- */
- if( lkmexists( lkmtp))
- return( EEXIST);
/*
* Now register the driver
*/
@@ -115,7 +110,7 @@ int cmd;
/*
* External entry point; should generally match name of .o file. The
* arguments are always the same for all loaded modules. The "load",
- * "unload", and "stat" functions in "DISPATCH" will be called under
+ * "unload", and "stat" functions in "MOD_DISPATCH" will be called under
* their respective circumstances unless their value is "nosys". If
* called, they are called with the same arguments (cmd is included to
* allow the use of a single function, ver is included for version
@@ -132,12 +127,12 @@ int cmd;
* case it should return an errno from errno.h).
*/
int
-lkm_skel(lkmtp, cmd, ver)
+skel(lkmtp, cmd, ver)
struct lkm_table *lkmtp;
int cmd;
int ver;
{
- DISPATCH(lkmtp,cmd,ver,skel_handle,skel_handle,nosys)
+ MOD_DISPATCH(skel,lkmtp,cmd,ver,skel_handle,skel_handle,nosys)
}
/*
* Skeleton driver entry points for PCCARD configuration.
@@ -148,11 +143,16 @@ int ver;
static int
skelinit(struct pccard_devinfo *devi)
{
- if ((1 << devi->unit) & opened)
+ int unit = devi->isahd.id_unit;
+
+ if (opened & (1 << unit))
return(EBUSY);
- opened |= 1 << devi->unit;
- printf("skel%d: init\n", devi->unit);
- printf("iomem = 0x%x, iobase = 0x%x\n", devi->memory, devi->ioaddr);
+ opened |= 1 << unit;
+ printf("%s%d: init\n", devi->drv->name, unit);
+ printf("%s%d: irq %d iobase 0x%x maddr 0x%x memlen %d\n",
+ devi->drv->name, unit, devi->isahd.id_irq,
+ devi->isahd.id_iobase, devi->isahd.id_maddr,
+ devi->isahd.id_msize);
return(0);
}
/*
@@ -163,8 +163,10 @@ skelinit(struct pccard_devinfo *devi)
static void
skelunload(struct pccard_devinfo *devi)
{
- printf("skel%d: unload\n", devi->unit);
- opened &= ~(1 << devi->unit);
+ int unit = devi->isahd.id_unit;
+
+ printf("%s%d: unload\n", devi->drv->name, unit);
+ opened &= ~(1 << unit);
}
/*
* Interrupt handler.
OpenPOWER on IntegriCloud