PERFORCE change 119429 for review

Bruce M Simpson bms at FreeBSD.org
Mon May 7 16:46:32 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=119429

Change 119429 by bms at bms_anglepoise on 2007/05/07 16:46:01

	style(9)

Affected files ...

.. //depot/projects/mips2/src/sys/mips/mips/nexus.c#5 edit

Differences ...

==== //depot/projects/mips2/src/sys/mips/mips/nexus.c#5 (text+ko) ====

@@ -12,7 +12,7 @@
  * no representations about the suitability of this software for any
  * purpose.  It is provided "as is" without express or implied
  * warranty.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
@@ -70,19 +70,20 @@
 
 static struct rman irq_rman;
 
-static	int nexus_probe(device_t);
-static	int nexus_attach(device_t);
-static	int nexus_print_child(device_t, device_t);
-static	device_t nexus_add_child(device_t, int, const char *, int);
-static	struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
-	u_long, u_long, u_long, u_int);
-static	int nexus_activate_resource(device_t, device_t, int, int,
-	struct resource *);
-static int
-nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
-        driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep);
-static int
-nexus_teardown_intr(device_t, device_t, struct resource *, void *);
+static int	nexus_probe(device_t);
+static int	nexus_attach(device_t);
+static int	nexus_print_child(device_t, device_t);
+static device_t	nexus_add_child(device_t, int, const char *, int);
+static struct resource *
+		nexus_alloc_resource(device_t, device_t, int, int *, u_long,
+		    u_long, u_long, u_int);
+static int	nexus_activate_resource(device_t, device_t, int, int,
+		    struct resource *);
+static int	nexus_setup_intr(device_t dev, device_t child,
+		    struct resource *res, int flags, driver_filter_t *filt,
+		    driver_intr_t *intr, void *arg, void **cookiep);
+static int	nexus_teardown_intr(device_t, device_t, struct resource *,
+		    void *);
 
 static device_method_t nexus_methods[] = {
 	/* Device interface */
@@ -108,17 +109,18 @@
 static int
 nexus_probe(device_t dev)
 {
-	device_quiet(dev);	/* suppress attach message for neatness */
-		
+
+	device_quiet(dev);      /* suppress attach message for neatness */
+
 	irq_rman.rm_start = 0;
 	irq_rman.rm_end = 5;
 	irq_rman.rm_type = RMAN_ARRAY;
 	irq_rman.rm_descr = "Hardware IRQs";
-	if (rman_init(&irq_rman)
-		|| rman_manage_region(&irq_rman, 0, 5))
+	if (rman_init(&irq_rman) != 0 ||
+	    rman_manage_region(&irq_rman, 0, 5) != 0) {
 		panic("nexus_probe irq_rman");
+	}
 
-		
 	return (0);
 }
 
@@ -130,18 +132,20 @@
 
 	register_t sr = intr_disable();
 	irq = rman_get_start(res);
-	if(irq > 5)
-		return(0);
-	
-	cpu_establish_hardintr(device_get_nameunit(child), filt, intr, arg, 
+	if (irq > 5)
+		return (0);
+
+	cpu_establish_hardintr(device_get_nameunit(child), filt, intr, arg,
 	    irq, flags, cookiep);
 	intr_restore(sr);
+
 	return (0);
 }
 
 static int
 nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
 {
+
 	printf("Unimplemented %s at %s:%d\n", __func__, __FILE__, __LINE__);
 	return (0);
 }
@@ -149,24 +153,21 @@
 static int
 nexus_attach(device_t dev)
 {
-	/*
-	 * First, deal with the children we know about already
-	 */
+
 	bus_generic_probe(dev);
 	bus_generic_attach(dev);
-	
-	return 0;
+
+	return (0);
 }
 
-
 static int
 nexus_print_child(device_t bus, device_t child)
 {
 	int retval = 0;
-	
+
 	retval += bus_print_child_header(bus, child);
 	retval += printf(" on motherboard\n");	/* XXX "motherboard", ick */
-	
+
 	return (retval);
 }
 
@@ -177,21 +178,19 @@
 	device_t	child;
 	struct nexus_device *ndev;
 
-	
 	ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
 	if (!ndev)
-		return(0);
+		return (0);
 	resource_list_init(&ndev->nx_resources);
 
 	child = device_add_child_ordered(bus, order, name, unit);
-	
+
 	/* should we free this in nexus_child_detached? */
 	device_set_ivars(child, ndev);
-	
-	return(child);
+
+	return (child);
 }
 
-
 /*
  * Allocate a resource on behalf of child.  NB: child is usually going to be a
  * child of one of our descendants, not a direct child of nexus0.
@@ -209,32 +208,33 @@
 	case SYS_RES_IRQ:
 		rm = &irq_rman;
 		break;
-		
+
 	default:
-		return 0;
+		return (0);
 	}
 
 	rv = rman_reserve_resource(rm, start, end, count, flags, child);
 	if (rv == 0)
-		return 0;
+		return (0);
 
 	rman_set_rid(rv, *rid);
-	
+
 	if (needactivate) {
 		if (bus_activate_resource(child, type, *rid, rv)) {
 			rman_release_resource(rv);
-			return 0;
+			return (0);
 		}
 	}
-	
-	return rv;
+
+	return (rv);
 }
 
 
 static int
 nexus_activate_resource(device_t bus, device_t child, int type, int rid,
-	struct resource *r)
+    struct resource *r)
 {
+
 	return (rman_activate_resource(r));
 }
 


More information about the p4-projects mailing list