style fixes

This commit is contained in:
fjoe 2002-08-05 17:20:17 +00:00
parent 61e34cfa22
commit d8fc8f4943
3 changed files with 30 additions and 26 deletions

View File

@ -329,8 +329,8 @@ sbni_intr(void *arg)
handle_channel(sc); handle_channel(sc);
repeat = 1; repeat = 1;
} }
if (sc->slave_sc /* second channel present */ if (sc->slave_sc && /* second channel present */
&& (sbni_inb(sc->slave_sc, CSR0) & (RC_RDY | TR_RDY))) { (sbni_inb(sc->slave_sc, CSR0) & (RC_RDY | TR_RDY))) {
handle_channel(sc->slave_sc); handle_channel(sc->slave_sc);
repeat = 1; repeat = 1;
} }
@ -368,9 +368,10 @@ handle_channel(struct sbni_softc *sc)
/* if state & FL_NEED_RESEND != 0 then tx_frameno != 0 */ /* if state & FL_NEED_RESEND != 0 then tx_frameno != 0 */
if (req_ans || sc->tx_frameno != 0) if (req_ans || sc->tx_frameno != 0)
send_frame(sc); send_frame(sc);
else else {
/* send the marker without any data */ /* send the marker without any data */
sbni_outb(sc, CSR0, sbni_inb(sc, CSR0) & ~TR_REQ); sbni_outb(sc, CSR0, sbni_inb(sc, CSR0) & ~TR_REQ);
}
} }
sbni_outb(sc, CSR0, sbni_inb(sc, CSR0) | EN_INT); sbni_outb(sc, CSR0, sbni_inb(sc, CSR0) | EN_INT);
@ -391,9 +392,9 @@ recv_frame(struct sbni_softc *sc)
crc = CRC32_INITIAL; crc = CRC32_INITIAL;
if (check_fhdr(sc, &framelen, &frameno, &ack, &is_first, &crc)) { if (check_fhdr(sc, &framelen, &frameno, &ack, &is_first, &crc)) {
frame_ok = framelen > 4 frame_ok = framelen > 4 ?
? upload_data(sc, framelen, frameno, is_first, crc) upload_data(sc, framelen, frameno, is_first, crc) :
: skip_tail(sc, framelen, crc); skip_tail(sc, framelen, crc);
if (frame_ok) if (frame_ok)
interpret_ack(sc, ack); interpret_ack(sc, ack);
} else } else
@ -498,8 +499,9 @@ do_copy:
if (data_len -= slice) if (data_len -= slice)
data_p += slice; data_p += slice;
else { else {
do m = m->m_next; do {
while (m != NULL && m->m_len == 0); m = m->m_next;
} while (m != NULL && m->m_len == 0);
if (m) { if (m) {
data_len = m->m_len; data_len = m->m_len;
@ -582,10 +584,10 @@ interpret_ack(struct sbni_softc *sc, u_int ack)
if (sc->state & FL_WAIT_ACK) { if (sc->state & FL_WAIT_ACK) {
sc->outpos += sc->framelen; sc->outpos += sc->framelen;
if (--sc->tx_frameno) if (--sc->tx_frameno) {
sc->framelen = min(sc->maxframe, sc->framelen = min(
sc->pktlen - sc->outpos); sc->maxframe, sc->pktlen - sc->outpos);
else { } else {
send_complete(sc); send_complete(sc);
prepare_to_send(sc); prepare_to_send(sc);
} }
@ -1059,8 +1061,8 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
switch (command) { switch (command) {
case SIOCSIFADDR: case SIOCSIFADDR:
case SIOCGIFADDR: case SIOCGIFADDR:
ether_ioctl(ifp, command, data); ether_ioctl(ifp, command, data);
break; break;
case SIOCSIFFLAGS: case SIOCSIFFLAGS:
/* /*

View File

@ -115,18 +115,19 @@ sbni_attach_isa(device_t dev)
sc = device_get_softc(dev); sc = device_get_softc(dev);
printf("sbni%d: <Granch SBNI12/ISA adapter> port 0x%x", printf("sbni%d: <Granch SBNI12/ISA adapter> port 0x%x",
next_sbni_unit, sc->base_addr); next_sbni_unit, rman_get_start(sc->io_res));
sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irq_rid, sc->irq_res = bus_alloc_resource(
0ul, ~0ul, 1, RF_ACTIVE); dev, SYS_RES_IRQ, &sc->irq_rid, 0ul, ~0ul, 1, RF_ACTIVE);
if (sc->irq_res) { if (sc->irq_res) {
printf(" irq %ld\n", rman_get_start(sc->irq_res)); printf(" irq %ld\n", rman_get_start(sc->irq_res));
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, error = bus_setup_intr(
sbni_intr, sc, &sc->irq_handle); dev, sc->irq_res, INTR_TYPE_NET,
sbni_intr, sc, &sc->irq_handle);
if (error) { if (error) {
printf("sbni%d: bus_setup_intr\n", next_sbni_unit); printf("sbni%d: bus_setup_intr\n", next_sbni_unit);
bus_release_resource(dev, SYS_RES_IOPORT, bus_release_resource(
sc->io_rid, sc->io_res); dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res);
return (error); return (error);
} }
@ -149,12 +150,13 @@ sbni_attach_isa(device_t dev)
if ((master = connect_to_master(sc)) == 0) { if ((master = connect_to_master(sc)) == 0) {
printf("\nsbni%d: failed to alloc irq\n", printf("\nsbni%d: failed to alloc irq\n",
next_sbni_unit); next_sbni_unit);
bus_release_resource(dev, SYS_RES_IOPORT, bus_release_resource(
sc->io_rid, sc->io_res); dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res);
return (ENXIO); return (ENXIO);
} else } else {
printf(" shared irq with sbni%d\n", printf(" shared irq with sbni%d\n",
master->arpcom.ac_if.if_unit); master->arpcom.ac_if.if_unit);
}
} }
#endif /* SBNI_DUAL_COMPOUND */ #endif /* SBNI_DUAL_COMPOUND */

View File

@ -78,8 +78,8 @@ sbni_pci_probe(device_t dev)
u_int32_t ports; u_int32_t ports;
ports = SBNI_PORTS; ports = SBNI_PORTS;
if (pci_get_vendor(dev) != SBNI_PCI_VENDOR if (pci_get_vendor(dev) != SBNI_PCI_VENDOR ||
|| pci_get_device(dev) != SBNI_PCI_DEVICE) pci_get_device(dev) != SBNI_PCI_DEVICE)
return (ENXIO); return (ENXIO);
sc = device_get_softc(dev); sc = device_get_softc(dev);