diff options
author | gallatin <gallatin@FreeBSD.org> | 2004-06-21 13:02:25 +0000 |
---|---|---|
committer | gallatin <gallatin@FreeBSD.org> | 2004-06-21 13:02:25 +0000 |
commit | ae2a2c5a14cfdb36af5430d18d9599b9a6ed3708 (patch) | |
tree | a737038708dca786a51144f0b14283094ff9d8e4 /sys/dev/rp/rp_pci.c | |
parent | 9c97a4d517868b0d384e8ecb927940d8e470fb92 (diff) | |
download | FreeBSD-src-ae2a2c5a14cfdb36af5430d18d9599b9a6ed3708.zip FreeBSD-src-ae2a2c5a14cfdb36af5430d18d9599b9a6ed3708.tar.gz |
Prevent the rp driver from panic'ing on first access and make at
least the pci device unloadable
- Use ttymalloc() rather than a plain malloc to allocate the
rp->rp_tty ttys. This is now required due to the recent locking
changes to ttys and prevents a panic due to locking an unitialized
t_mtx.
- Allow the pci driver to be unloaded. This involved moving
the call rp_releaseresource() to the end of rp_pcireleaseresource(),
since rp_pcireleaseresource() uses ctlp->dev, which is freed
by rp_releaseresource().
- Allow the generic part of the driver to be unattached by providing
a hook to cancel timeouts.
Glanced at by: obrien
Diffstat (limited to 'sys/dev/rp/rp_pci.c')
-rw-r--r-- | sys/dev/rp/rp_pci.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/dev/rp/rp_pci.c b/sys/dev/rp/rp_pci.c index ca7494b..70aaa5b 100644 --- a/sys/dev/rp/rp_pci.c +++ b/sys/dev/rp/rp_pci.c @@ -208,7 +208,6 @@ nogo: return (retval); } -#if notdef static int rp_pcidetach(device_t dev) { @@ -238,20 +237,22 @@ rp_pcishutdown(device_t dev) return (0); } -#endif /* notdef */ static void rp_pcireleaseresource(CONTROLLER_t *ctlp) { - rp_releaseresource(ctlp); - + rp_untimeout(); if (ctlp->io != NULL) { if (ctlp->io[0] != NULL) bus_release_resource(ctlp->dev, SYS_RES_IOPORT, ctlp->io_rid[0], ctlp->io[0]); free(ctlp->io, M_DEVBUF); + ctlp->io = NULL; } - if (ctlp->io_rid != NULL) + if (ctlp->io_rid != NULL) { free(ctlp->io_rid, M_DEVBUF); + ctlp->io = NULL; + } + rp_releaseresource(ctlp); } static int @@ -351,10 +352,8 @@ static device_method_t rp_pcimethods[] = { /* Device interface */ DEVMETHOD(device_probe, rp_pciprobe), DEVMETHOD(device_attach, rp_pciattach), -#if notdef DEVMETHOD(device_detach, rp_pcidetach), DEVMETHOD(device_shutdown, rp_pcishutdown), -#endif /* notdef */ { 0, 0 } }; |