Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Touch up a little. No functional change.
details: https://anonhg.NetBSD.org/src/rev/353259c2ea38
branches: trunk
changeset: 518633:353259c2ea38
user: augustss <augustss%NetBSD.org@localhost>
date: Sun Dec 02 20:29:55 2001 +0000
description:
Touch up a little. No functional change.
diffstat:
sys/dev/pci/oboe.c | 72 +++++++++++++++++++++++++++---------------------------
1 files changed, 36 insertions(+), 36 deletions(-)
diffs (160 lines):
diff -r ab6c7bd181a7 -r 353259c2ea38 sys/dev/pci/oboe.c
--- a/sys/dev/pci/oboe.c Sun Dec 02 20:12:03 2001 +0000
+++ b/sys/dev/pci/oboe.c Sun Dec 02 20:29:55 2001 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: oboe.c,v 1.1 2001/12/02 16:30:30 augustss Exp $ */
+/* $NetBSD: oboe.c,v 1.2 2001/12/02 20:29:55 augustss Exp $ */
/*-
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,9 @@
*/
/*
- * Toshiba OBOE SIR/FIR driver.
+ * Toshiba OBOE IrDA SIR/FIR driver.
+ *
+ * Based on information from the Linux driver, thus the magic hex numbers.
*/
#include <sys/param.h>
@@ -77,8 +79,6 @@
int oboe_get_turnarounds(void *h, int *times);
int oboe_poll(void *h, int events, struct proc *p);
-#define OBOE_DEBUG_XXX
-
#ifdef OBOE_DEBUG
#define DPRINTF(x) if (oboedebug) printf x
int oboedebug = 1;
@@ -255,7 +255,7 @@
break;
case DVACT_DEACTIVATE:
- if (sc->sc_child)
+ if (sc->sc_child != NULL)
error = config_deactivate(sc->sc_child);
else
error = 0;
@@ -270,6 +270,7 @@
#if 0
struct oboe_softc *sc = (struct oboe_softc *)self;
#endif
+ /* XXX needs reference counting for proper detach. */
DPRINTF(("%s: sc=%p\n", __FUNCTION__, sc));
return (0);
}
@@ -306,7 +307,7 @@
splx(s);
oboe_stopchip(sc);
- return error;
+ return (error);
}
int
@@ -343,21 +344,19 @@
slot = (sc->sc_rxs - sc->sc_saved + RX_SLOTS) % RX_SLOTS;
if (uio->uio_resid < sc->sc_lens[slot]) {
DPRINTF(("oboe_read: uio buffer smaller than frame size (%d < %d)\n", uio->uio_resid, sc->sc_lens[slot]));
- error= EIO;
+ error = EINVAL;
} else {
DPRINTF(("oboe_read: moving %d bytes from %p\n",
sc->sc_lens[slot],
sc->sc_recv_stores[slot]));
error = uiomove(sc->sc_recv_stores[slot],
sc->sc_lens[slot], uio);
- if (error)
- printf("uiomove failed: %d, slot=%d\n", error, slot);
}
}
sc->sc_saved--;
splx(s);
- return error;
+ return (error);
}
int
@@ -382,34 +381,35 @@
break;
}
}
- if (!error) {
- if (sc->sc_taskfile->xmit[sc->sc_txs].control) {
- DPRINTF(("oboe_write: slot overrun\n"));
-#if 0
- splx(s);
- return -EBUSY;
-#endif
- }
+ if (error)
+ goto err;
+ if (sc->sc_taskfile->xmit[sc->sc_txs].control) {
+ DPRINTF(("oboe_write: slot overrun\n"));
+ }
- sc->sc_taskfile->xmit[sc->sc_txs].len = uio->uio_resid;
- error = uiomove(sc->sc_xmit_bufs[sc->sc_txs],
- uio->uio_resid, uio);
- OUTB(sc, 0, OBOE_RST);
- OUTB(sc, 0x1e, OBOE_REG_11);
+ sc->sc_taskfile->xmit[sc->sc_txs].len = uio->uio_resid;
+ error = uiomove(sc->sc_xmit_bufs[sc->sc_txs],
+ uio->uio_resid, uio);
+ if (error)
+ goto err;
- sc->sc_taskfile->xmit[sc->sc_txs].control = 0x84;
+ OUTB(sc, 0, OBOE_RST);
+ OUTB(sc, 0x1e, OBOE_REG_11);
+
+ sc->sc_taskfile->xmit[sc->sc_txs].control = 0x84;
- /* Need delay here??? */
- delay(1000);
+ /* Need delay here??? */
+ delay(1000);
- sc->sc_txpending++;
- OUTB(sc, 0x80, OBOE_RST);
- OUTB(sc, 1, OBOE_REG_9);
- sc->sc_txs++;
- sc->sc_txs %= TX_SLOTS;
- }
+ sc->sc_txpending++;
+ OUTB(sc, 0x80, OBOE_RST);
+ OUTB(sc, 1, OBOE_REG_9);
+ sc->sc_txs++;
+ sc->sc_txs %= TX_SLOTS;
+
+ err:
splx(s);
- return error;
+ return (error);
}
int
@@ -506,7 +506,7 @@
uint8_t irqstat = INB(sc, OBOE_ISR);
if (!(irqstat & 0xf8))
- return 0; /* Not for me? */
+ return (0); /* Not for me? */
DPRINTF(("oboe_intr stat=0x%x\n", irqstat));
@@ -566,7 +566,7 @@
wakeup(&sc->sc_txs);
}
}
- return 1;
+ return (1);
}
Home |
Main Index |
Thread Index |
Old Index