Remove all the mutex stuff - suggested by jhb

Tidy up includes, credit Slawa Olhovchenkov, John Prince and Eric Hernes
for their efforts and add a couple of missing parenthesis around return
expressions.
This commit is contained in:
Brian Somers 2001-05-08 07:55:33 +00:00
parent 9ccb939ef0
commit f80704eff1
4 changed files with 12 additions and 49 deletions

View File

@ -1,6 +1,8 @@
/*- /*-
* Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>
* based on work by Slawa Olhovchenkov * based on work by Slawa Olhovchenkov
* John Prince <johnp@knight-trosoft.com>
* Eric Hernes
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -36,46 +38,25 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/reboot.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/dkstat.h>
#include <sys/file.h>
#include <sys/linker.h> #include <sys/linker.h>
#include <sys/uio.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/mbuf.h> #include <sys/mbuf.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/tty.h> #include <sys/tty.h>
#include <sys/syslog.h> #include <sys/syslog.h>
#include <sys/types.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/bus.h> #include <sys/bus.h>
#include <machine/clock.h>
#include <sys/bus.h> #include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h> #include <machine/resource.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <pci/pcireg.h>
#include <pci/pcivar.h>
#include <dev/digi/digireg.h> #include <dev/digi/digireg.h>
#include <dev/digi/digiio.h> #include <dev/digi/digiio.h>
#include <dev/digi/digi.h> #include <dev/digi/digi.h>
#include <dev/digi/digi_mod.h> #include <dev/digi/digi_mod.h>
#include <dev/digi/digi_pci.h> #include <dev/digi/digi_pci.h>
#include <machine/ipl.h>
#define CDEV_MAJOR 162 #define CDEV_MAJOR 162
#define CTRL_DEV 0x800000 #define CTRL_DEV 0x800000
@ -674,9 +655,6 @@ digi_init(struct digi_softc *sc)
} }
sc->hidewin(sc); sc->hidewin(sc);
#ifdef DIGI_LOCK_INTR
mtx_init(sc->intr_mutex, "digi interrupt mutex", MTX_DEF);
#endif
sc->inttest = timeout(digi_int_test, sc, hz); sc->inttest = timeout(digi_int_test, sc, hz);
/* fepcmd_w(&sc->ports[0], 0xff, 0, 0); */ /* fepcmd_w(&sc->ports[0], 0xff, 0, 0); */
sc->status = DIGI_STATUS_ENABLED; sc->status = DIGI_STATUS_ENABLED;
@ -1457,10 +1435,6 @@ digi_intr(void *vp)
return; return;
} }
#ifdef DIGI_LOCK_INTR
mtx_lock(sc->intr_mutex);
#endif
#ifdef DIGI_INTERRUPT #ifdef DIGI_INTERRUPT
microtime(&sc->intr_timestamp); microtime(&sc->intr_timestamp);
#endif #endif
@ -1660,9 +1634,6 @@ digi_intr(void *vp)
sc->towin(sc, 0); sc->towin(sc, 0);
if (window != 0) if (window != 0)
sc->towin(sc, window); sc->towin(sc, window);
#ifdef DIGI_LOCK_INTR
mtx_unlock(sc->intr_mutex);
#endif
} }
static void static void
@ -1868,9 +1839,6 @@ digi_free_state(struct digi_softc *sc)
callout_handle_init(&sc->inttest); callout_handle_init(&sc->inttest);
bus_teardown_intr(sc->dev, sc->res.irq, sc->res.irqHandler); bus_teardown_intr(sc->dev, sc->res.irq, sc->res.irqHandler);
#ifdef DIGI_LOCK_INTR
mtx_destroy(sc->intr_mutex);
#endif
#ifdef DIGI_INTERRUPT #ifdef DIGI_INTERRUPT
if (sc->res.irq != NULL) { if (sc->res.irq != NULL) {
bus_release_resource(dev, SYS_RES_IRQ, sc->res.irqrid, bus_release_resource(dev, SYS_RES_IRQ, sc->res.irqrid,

View File

@ -37,10 +37,6 @@
#define CE_NTYPES 3 #define CE_NTYPES 3
#define CE_RECORD(com, errnum) (++(com)->delta_error_counts[errnum]) #define CE_RECORD(com, errnum) (++(com)->delta_error_counts[errnum])
#ifdef SMP
#define DIGI_LOCK_INTR
#endif
/*#define DIGI_INTERRUPT*/ /*#define DIGI_INTERRUPT*/
#ifndef DEBUG #ifndef DEBUG
@ -196,9 +192,6 @@ struct digi_softc {
u_char *(*setwin)(struct digi_softc *_sc, unsigned _addr); u_char *(*setwin)(struct digi_softc *_sc, unsigned _addr);
void (*hidewin)(struct digi_softc *_sc); void (*hidewin)(struct digi_softc *_sc);
void (*towin)(struct digi_softc *_sc, int _win); void (*towin)(struct digi_softc *_sc, int _win);
#ifdef DIGI_LOCK_INTR
struct mtx intr_mutex[1];
#endif
#ifdef DEBUG #ifdef DEBUG
int intr_count; int intr_count;
#endif #endif

View File

@ -1,5 +1,8 @@
/*- /*-
* Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>
* based on work by Slawa Olhovchenkov
* John Prince <johnp@knight-trosoft.com>
* Eric Hernes
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -37,11 +40,9 @@
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/tty.h> #include <sys/tty.h>
#include <sys/syslog.h>
#include <sys/bus.h> #include <sys/bus.h>
#include <machine/bus.h> #include <machine/bus.h>
#include <sys/rman.h> #include <sys/rman.h>
#include <sys/mutex.h>
#include <machine/resource.h> #include <machine/resource.h>
#include <vm/vm.h> #include <vm/vm.h>
#include <vm/pmap.h> #include <vm/pmap.h>

View File

@ -1,5 +1,8 @@
/*- /*-
* Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>
* based on work by Slawa Olhovchenkov
* John Prince <johnp@knight-trosoft.com>
* Eric Hernes
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -31,7 +34,6 @@
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/tty.h> #include <sys/tty.h>
#include <sys/syslog.h>
#include <sys/bus.h> #include <sys/bus.h>
#include <machine/bus.h> #include <machine/bus.h>
#include <sys/rman.h> #include <sys/rman.h>
@ -39,7 +41,6 @@
#include <vm/vm.h> #include <vm/vm.h>
#include <vm/pmap.h> #include <vm/pmap.h>
#include <pci/pcivar.h> #include <pci/pcivar.h>
#include <sys/mutex.h>
#include <digi/digireg.h> #include <digi/digireg.h>
#include <digi/digiio.h> #include <digi/digiio.h>
@ -88,10 +89,10 @@ digi_pci_probe(device_t dev)
case PCI_DEVICE_920_4: case PCI_DEVICE_920_4:
case PCI_DEVICE_920_8: case PCI_DEVICE_920_8:
case PCI_DEVICE_920_2: case PCI_DEVICE_920_2:
return 0; return (0);
} }
return ENXIO; return (ENXIO);
} }
static int static int
@ -184,7 +185,7 @@ digi_pci_attach(device_t dev)
0, ~0, 1, RF_SHAREABLE | RF_ACTIVE); 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE);
if (sc->res.irq == NULL) { if (sc->res.irq == NULL) {
device_printf(dev, "couldn't map interrupt\n"); device_printf(dev, "couldn't map interrupt\n");
return ENXIO; return (ENXIO);
} }
retVal = bus_setup_intr(dev, sc->res.irq, INTR_TYPE_TTY, retVal = bus_setup_intr(dev, sc->res.irq, INTR_TYPE_TTY,
digiintr, sc, &sc->res.irqHandler); digiintr, sc, &sc->res.irqHandler);