svn commit: r234366 - head/sys/mips/atheros

Adrian Chadd adrian at FreeBSD.org
Tue Apr 17 01:34:50 UTC 2012


Author: adrian
Date: Tue Apr 17 01:34:49 2012
New Revision: 234366
URL: http://svn.freebsd.org/changeset/base/234366

Log:
  Style(9) and white space fixes.

Modified:
  head/sys/mips/atheros/ar71xx_pci.c

Modified: head/sys/mips/atheros/ar71xx_pci.c
==============================================================================
--- head/sys/mips/atheros/ar71xx_pci.c	Tue Apr 17 01:22:59 2012	(r234365)
+++ head/sys/mips/atheros/ar71xx_pci.c	Tue Apr 17 01:34:49 2012	(r234366)
@@ -67,11 +67,11 @@ __FBSDID("$FreeBSD$");
 #include <sys/firmware.h>
 #endif	/* AR71XX_ATH_EEPROM */
 
-#undef AR71XX_PCI_DEBUG
-#ifdef AR71XX_PCI_DEBUG
-#define dprintf printf
+#undef	AR71XX_PCI_DEBUG
+#ifdef	AR71XX_PCI_DEBUG
+#define	dprintf printf
 #else
-#define dprintf(x, arg...)
+#define	dprintf(x, arg...)
 #endif
 
 struct mtx ar71xx_pci_mtx;
@@ -97,7 +97,7 @@ static int ar71xx_pci_teardown_intr(devi
 		    void *);
 static int ar71xx_pci_intr(void *);
 
-static void 
+static void
 ar71xx_pci_mask_irq(void *source)
 {
 	uint32_t reg;
@@ -110,7 +110,7 @@ ar71xx_pci_mask_irq(void *source)
 	ATH_WRITE_REG(AR71XX_PCI_INTR_MASK, reg & ~(1 << irq));
 }
 
-static void 
+static void
 ar71xx_pci_unmask_irq(void *source)
 {
 	uint32_t reg;
@@ -123,15 +123,16 @@ ar71xx_pci_unmask_irq(void *source)
 	reg = ATH_READ_REG(AR71XX_PCI_INTR_MASK);
 }
 
-/* 
- * get bitmask for bytes of interest: 
- *   0 - we want this byte, 1 - ignore it. e.g: we read 1 byte 
+/*
+ * get bitmask for bytes of interest:
+ *   0 - we want this byte, 1 - ignore it. e.g: we read 1 byte
  *   from register 7. Bitmask would be: 0111
  */
 static uint32_t
 ar71xx_get_bytes_to_read(int reg, int bytes)
 {
 	uint32_t bytes_to_read = 0;
+
 	if ((bytes % 4) == 0)
 		bytes_to_read = 0;
 	else if ((bytes % 4) == 1)
@@ -144,7 +145,7 @@ ar71xx_get_bytes_to_read(int reg, int by
 	return (bytes_to_read);
 }
 
-static int 
+static int
 ar71xx_pci_check_bus_error(void)
 {
 	uint32_t error, addr, has_errors = 0;
@@ -185,20 +186,20 @@ ar71xx_pci_make_addr(int bus, int slot, 
 	if (bus == 0) {
 		return ((1 << slot) | (func << 8) | (reg & ~3));
 	} else {
-		return ((bus << 16) | (slot << 11) | (func << 8) 
+		return ((bus << 16) | (slot << 11) | (func << 8)
 		    | (reg  & ~3) | 1);
 	}
 }
 
 static int
-ar71xx_pci_conf_setup(int bus, int slot, int func, int reg, int bytes, 
+ar71xx_pci_conf_setup(int bus, int slot, int func, int reg, int bytes,
     uint32_t cmd)
 {
 	uint32_t addr = ar71xx_pci_make_addr(bus, slot, func, (reg & ~3));
-	cmd |= (ar71xx_get_bytes_to_read(reg, bytes) << 4);
 
 	mtx_assert(&ar71xx_pci_mtx, MA_OWNED);
 
+	cmd |= (ar71xx_get_bytes_to_read(reg, bytes) << 4);
 	ATH_WRITE_REG(AR71XX_PCI_CONF_ADDR, addr);
 	ATH_WRITE_REG(AR71XX_PCI_CONF_CMD, cmd);
 
@@ -209,7 +210,7 @@ ar71xx_pci_conf_setup(int bus, int slot,
 }
 
 static uint32_t
-ar71xx_pci_read_config(device_t dev, u_int bus, u_int slot, u_int func, 
+ar71xx_pci_read_config(device_t dev, u_int bus, u_int slot, u_int func,
     u_int reg, int bytes)
 {
 	uint32_t data;
@@ -240,7 +241,7 @@ ar71xx_pci_read_config(device_t dev, u_i
 	/* get request bytes from 32-bit word */
 	data = (data >> shift) & mask;
 
- 	dprintf("%s: read 0x%x\n", __func__, data);
+	dprintf("%s: read 0x%x\n", __func__, data);
 
 	return (data);
 }
@@ -253,7 +254,6 @@ ar71xx_pci_local_write(device_t dev, uin
 	dprintf("%s: local write reg %d(%d)\n", __func__, reg, bytes);
 
 	data = data << (8*(reg % 4));
-
 	cmd = PCI_LCONF_CMD_WRITE | (reg & ~3);
 	cmd |= (ar71xx_get_bytes_to_read(reg, bytes) << 20);
 	mtx_lock_spin(&ar71xx_pci_mtx);
@@ -271,7 +271,6 @@ ar71xx_pci_write_config(device_t dev, u_
 	    func, reg, bytes);
 
 	data = data << (8*(reg % 4));
-
 	mtx_lock_spin(&ar71xx_pci_mtx);
 	 if (ar71xx_pci_conf_setup(bus, slot, func, reg, bytes,
 	     PCI_CONF_CMD_WRITE) == 0)
@@ -453,7 +452,7 @@ ar71xx_pci_attach(device_t dev)
 
 	if ((bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC,
 			    ar71xx_pci_intr, NULL, sc, &sc->sc_ih))) {
-		device_printf(dev, 
+		device_printf(dev,
 		    "WARNING: unable to register interrupt handler\n");
 		return ENXIO;
 	}
@@ -501,7 +500,8 @@ ar71xx_pci_attach(device_t dev)
 }
 
 static int
-ar71xx_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
+ar71xx_pci_read_ivar(device_t dev, device_t child, int which,
+    uintptr_t *result)
 {
 	struct ar71xx_pci_softc *sc = device_get_softc(dev);
 
@@ -518,7 +518,8 @@ ar71xx_pci_read_ivar(device_t dev, devic
 }
 
 static int
-ar71xx_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t result)
+ar71xx_pci_write_ivar(device_t dev, device_t child, int which,
+    uintptr_t result)
 {
 	struct ar71xx_pci_softc * sc = device_get_softc(dev);
 
@@ -536,7 +537,7 @@ ar71xx_pci_alloc_resource(device_t bus, 
     u_long start, u_long end, u_long count, u_int flags)
 {
 
-	struct ar71xx_pci_softc *sc = device_get_softc(bus);	
+	struct ar71xx_pci_softc *sc = device_get_softc(bus);
 	struct resource *rv;
 	struct rman *rm;
 
@@ -563,13 +564,10 @@ ar71xx_pci_alloc_resource(device_t bus, 
 			rman_release_resource(rv);
 			return (NULL);
 		}
-	} 
-
-
+	}
 	return (rv);
 }
 
-
 static int
 ar71xx_pci_activate_resource(device_t bus, device_t child, int type, int rid,
     struct resource *r)
@@ -585,16 +583,13 @@ ar71xx_pci_activate_resource(device_t bu
 			break;
 		}
 	}
-
 	return (res);
 }
 
-
-
 static int
 ar71xx_pci_setup_intr(device_t bus, device_t child, struct resource *ires,
-		int flags, driver_filter_t *filt, driver_intr_t *handler,
-		void *arg, void **cookiep)
+	    int flags, driver_filter_t *filt, driver_intr_t *handler,
+	    void *arg, void **cookiep)
 {
 	struct ar71xx_pci_softc *sc = device_get_softc(bus);
 	struct intr_event *event;
@@ -617,7 +612,7 @@ ar71xx_pci_setup_intr(device_t bus, devi
 			    mips_intrcnt_create(event->ie_name);
 		}
 		else
-			return error;
+			return (error);
 	}
 
 	intr_event_add_handler(event, device_get_nameunit(child), filt,


More information about the svn-src-head mailing list