From 5f4d50b5447dec6905b2f0a68e872a80ccee9fca Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Thu, 29 Mar 2001 19:11:45 +0000 Subject: [PATCH] Fix a couple style nits, no code changes. Turn one magic number into a #defined constant, wrap a few long lines, etc... Also remove stupid 'all your base are belong to us' joke from comment that I don't really care to see immortalized in the source tree. --- sys/dev/wi/if_wi.c | 31 +++++++++++++++++-------------- sys/dev/wi/if_wireg.h | 11 ++++++----- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 7ebe871dfb4b..cbe3fc2c74f7 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -254,10 +254,11 @@ wi_pci_probe(dev) struct wi_softc *sc; sc = device_get_softc(dev); - if ((pci_get_vendor(dev) == WI_PCI_VENDOR_Eumitcom) && + if ((pci_get_vendor(dev) == WI_PCI_VENDOR_EUMITCOM) && (pci_get_device(dev) == WI_PCI_DEVICE_PRISM2STA)) { sc->wi_prism2 = 1; - device_set_desc(dev, "PRISM2STA PCI WaveLAN/IEEE 802.11"); + device_set_desc(dev, + "PRISM2STA PCI WaveLAN/IEEE 802.11"); return (0); } return(ENXIO); @@ -362,7 +363,7 @@ wi_pci_attach(device_t dev) CSR_WRITE_2(sc, WI_INT_EN, 0); CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF); - sc->mem_rid = 0x18; + sc->mem_rid = WI_PCI_MEMRES; sc->mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mem_rid, 0, ~0, 1, RF_ACTIVE); if (sc->mem == NULL) { @@ -376,17 +377,16 @@ wi_pci_attach(device_t dev) /* * From Linux driver: * Write COR to enable PC card - * (FOR GREAT JUSTICE) */ CSM_WRITE_1(sc, WI_COR_OFFSET, WI_COR_VALUE); reg = CSM_READ_1(sc, WI_COR_OFFSET); - CSR_WRITE_2(sc, WI_HFA384x_SWSUPPORT0_OFF, WI_PRISM2STA_MAGIC); - reg = CSR_READ_2(sc, WI_HFA384x_SWSUPPORT0_OFF); + CSR_WRITE_2(sc, WI_HFA384X_SWSUPPORT0_OFF, WI_PRISM2STA_MAGIC); + reg = CSR_READ_2(sc, WI_HFA384X_SWSUPPORT0_OFF); if (reg != WI_PRISM2STA_MAGIC) { device_printf(dev, - "CSR_READ_2(WI_HFA384x_SWSUPPORT0_OFF) wanted %d, got %d\n", - WI_PRISM2STA_MAGIC, reg); + "CSR_READ_2(WI_HFA384X_SWSUPPORT0_OFF) " + "wanted %d, got %d\n", WI_PRISM2STA_MAGIC, reg); wi_free(dev); return (ENXIO); } @@ -411,7 +411,7 @@ wi_generic_attach(device_t dev) ifp = &sc->arpcom.ac_if; error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, - wi_intr, sc, &sc->wi_intrhand); + wi_intr, sc, &sc->wi_intrhand); if (error) { device_printf(dev, "bus_setup_intr() failed! (%d)\n", error); @@ -961,11 +961,14 @@ static int wi_write_record(sc, ltv) { int error; struct wi_ltv_str ws; - struct wi_ltv_keys *wk = (struct wi_ltv_keys *)ltv; + struct wi_ltv_keys *wk = + (struct wi_ltv_keys *)ltv; + for (i = 0; i < 4; i++) { ws.wi_len = 4; ws.wi_type = WI_RID_P2_CRYPT_KEY0 + i; - memcpy(ws.wi_str, &wk->wi_keys[i].wi_keydat, 5); + memcpy(ws.wi_str, + &wk->wi_keys[i].wi_keydat, 5); ws.wi_str[5] = '\0'; error = wi_write_record(sc, (struct wi_ltv_gen *)&ws); @@ -1089,8 +1092,7 @@ again: return(EIO); if (CSR_READ_2(sc, WI_DATA0) != 0x1234 || - CSR_READ_2(sc, WI_DATA0) != 0x5678) - { + CSR_READ_2(sc, WI_DATA0) != 0x5678) { if (--retries >= 0) goto again; device_printf(sc->dev, "wi_write_data device timeout\n"); @@ -1113,7 +1115,8 @@ static int wi_alloc_nicmem(sc, len, id) int i; if (wi_cmd(sc, WI_CMD_ALLOC_MEM, len)) { - device_printf(sc->dev, "failed to allocate %d bytes on NIC\n", len); + device_printf(sc->dev, + "failed to allocate %d bytes on NIC\n", len); return(ENOMEM); } diff --git a/sys/dev/wi/if_wireg.h b/sys/dev/wi/if_wireg.h index 1f2af453ed04..7166391e3d77 100644 --- a/sys/dev/wi/if_wireg.h +++ b/sys/dev/wi/if_wireg.h @@ -146,12 +146,13 @@ struct wi_softc { #define WI_PORT4 4 #define WI_PORT5 5 -#define WI_PCI_IORES 0x1c +#define WI_PCI_MEMRES 0x18 +#define WI_PCI_IORES 0x1C -#define WI_PCI_VENDOR_Eumitcom 0x1638 -#define WI_PCI_DEVICE_PRISM2STA 0x1100 -#define WI_HFA384x_SWSUPPORT0_OFF 0x28 -#define WI_PRISM2STA_MAGIC 0x4a2d +#define WI_PCI_VENDOR_EUMITCOM 0x1638 +#define WI_PCI_DEVICE_PRISM2STA 0x1100 +#define WI_HFA384X_SWSUPPORT0_OFF 0x28 +#define WI_PRISM2STA_MAGIC 0x4A2D /* Default port: 0 (only 0 exists on stations) */ #define WI_DEFAULT_PORT (WI_PORT0 << 8)