Add the detach method, will be used by the LKM.

This commit is contained in:
xtraeme 2007-09-09 05:17:17 +00:00
parent c2d7d8aaf3
commit 3efc7cfcb3
1 changed files with 13 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: smsc.c,v 1.2 2007/07/01 07:37:20 xtraeme Exp $ */
/* $NetBSD: smsc.c,v 1.3 2007/09/09 05:17:17 xtraeme Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.2 2007/07/01 07:37:20 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.3 2007/09/09 05:17:17 xtraeme Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -77,6 +77,7 @@ __KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.2 2007/07/01 07:37:20 xtraeme Exp $");
int smsc_probe(struct device *, struct cfdata *, void *);
void smsc_attach(struct device *, struct device *, void *);
int smsc_detach(struct device *, int);
static uint8_t smsc_readreg(struct smsc_softc *, int);
/*static void smsc_writereg(struct smsc_softc *, int, int);*/
void smsc_setup(struct smsc_softc *);
@ -84,7 +85,7 @@ void smsc_setup(struct smsc_softc *);
static int smsc_gtredata(struct sysmon_envsys *, envsys_data_t *);
CFATTACH_DECL(smsc, sizeof(struct smsc_softc),
smsc_probe, smsc_attach, NULL, NULL);
smsc_probe, smsc_attach, smsc_detach, NULL);
struct smsc_sysmon {
struct sysmon_envsys sme;
@ -207,6 +208,15 @@ smsc_attach(struct device *parent, struct device *self, void *aux)
smsc_setup(smsc_sc);
}
int
smsc_detach(struct device *self, int flags)
{
struct smsc_softc *sc = device_private(self);
sysmon_envsys_unregister(sc->smsc_sysmon);
bus_space_unmap(sc->smsc_iot, sc->smsc_ioh, 2);
return 0;
}
/*
* Read the value of the given register