Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jun 2009 00:05:38 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r194138 - head/sys/dev/ofw
Message-ID:  <200906140005.n5E05cXu028241@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sun Jun 14 00:05:38 2009
New Revision: 194138
URL: http://svn.freebsd.org/changeset/base/194138

Log:
  Fix style.

Modified:
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/dev/ofw/ofw_bus_subr.h
  head/sys/dev/ofw/ofw_disk.c
  head/sys/dev/ofw/ofw_if.m
  head/sys/dev/ofw/ofw_iicbus.c
  head/sys/dev/ofw/ofw_standard.c
  head/sys/dev/ofw/ofwvar.h
  head/sys/dev/ofw/openfirm.c
  head/sys/dev/ofw/openfirm.h
  head/sys/dev/ofw/openfirmio.c

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==============================================================================
--- head/sys/dev/ofw/ofw_bus_subr.c	Sat Jun 13 23:44:56 2009	(r194137)
+++ head/sys/dev/ofw/ofw_bus_subr.c	Sun Jun 14 00:05:38 2009	(r194138)
@@ -74,10 +74,11 @@ ofw_bus_gen_destroy_devinfo(struct ofw_b
 		free(obd->obd_type, M_OFWPROP);
 }
 
-int 
+int
 ofw_bus_gen_child_pnpinfo_str(device_t cbdev, device_t child, char *buf,
     size_t buflen)
 {
+
 	if (ofw_bus_get_name(child) != NULL) {
 		strlcat(buf, "name=", buflen);
 		strlcat(buf, ofw_bus_get_name(child), buflen);
@@ -87,7 +88,6 @@ ofw_bus_gen_child_pnpinfo_str(device_t c
 		strlcat(buf, " compat=", buflen);
 		strlcat(buf, ofw_bus_get_compat(child), buflen);
 	}
-
 	return (0);
 };
 
@@ -95,19 +95,19 @@ const char *
 ofw_bus_gen_get_compat(device_t bus, device_t dev)
 {
 	const struct ofw_bus_devinfo *obd;
- 
- 	obd = OFW_BUS_GET_DEVINFO(bus, dev);
+
+	obd = OFW_BUS_GET_DEVINFO(bus, dev);
 	if (obd == NULL)
 		return (NULL);
 	return (obd->obd_compat);
 }
- 
+
 const char *
 ofw_bus_gen_get_model(device_t bus, device_t dev)
 {
 	const struct ofw_bus_devinfo *obd;
 
- 	obd = OFW_BUS_GET_DEVINFO(bus, dev);
+	obd = OFW_BUS_GET_DEVINFO(bus, dev);
 	if (obd == NULL)
 		return (NULL);
 	return (obd->obd_model);
@@ -118,7 +118,7 @@ ofw_bus_gen_get_name(device_t bus, devic
 {
 	const struct ofw_bus_devinfo *obd;
 
- 	obd = OFW_BUS_GET_DEVINFO(bus, dev);
+	obd = OFW_BUS_GET_DEVINFO(bus, dev);
 	if (obd == NULL)
 		return (NULL);
 	return (obd->obd_name);
@@ -129,7 +129,7 @@ ofw_bus_gen_get_node(device_t bus, devic
 {
 	const struct ofw_bus_devinfo *obd;
 
- 	obd = OFW_BUS_GET_DEVINFO(bus, dev);
+	obd = OFW_BUS_GET_DEVINFO(bus, dev);
 	if (obd == NULL)
 		return (0);
 	return (obd->obd_node);
@@ -140,7 +140,7 @@ ofw_bus_gen_get_type(device_t bus, devic
 {
 	const struct ofw_bus_devinfo *obd;
 
- 	obd = OFW_BUS_GET_DEVINFO(bus, dev);
+	obd = OFW_BUS_GET_DEVINFO(bus, dev);
 	if (obd == NULL)
 		return (NULL);
 	return (obd->obd_type);
@@ -162,15 +162,13 @@ ofw_bus_setup_iinfo(phandle_t node, stru
 		msksz = OF_getprop_alloc(node, "interrupt-map-mask", 1,
 		    (void **)&ii->opi_imapmsk);
 		/*
-		 * Failure to get the mask is ignored; a full mask is used then.
-		 * Barf on bad mask sizes, however.
+		 * Failure to get the mask is ignored; a full mask is used
+		 * then.  We barf on bad mask sizes, however.
 		 */
-		if (msksz != -1 && msksz != ii->opi_addrc + intrsz) {
+		if (msksz != -1 && msksz != ii->opi_addrc + intrsz)
 			panic("ofw_bus_setup_iinfo: bad interrupt-map-mask "
 			    "property!");
-		}
 	}
-
 }
 
 int
@@ -197,10 +195,10 @@ ofw_bus_lookup_imap(phandle_t node, stru
  * Map an interrupt using the firmware reg, interrupt-map and
  * interrupt-map-mask properties.
  * The interrupt property to be mapped must be of size intrsz, and pointed to
- * by intr. The regs property of the node for which the mapping is done must
+ * by intr.  The regs property of the node for which the mapping is done must
  * be passed as regs. This property is an array of register specifications;
  * the size of the address part of such a specification must be passed as
- * physsz. Only the first element of the property is used.
+ * physsz.  Only the first element of the property is used.
  * imap and imapsz hold the interrupt mask and it's size.
  * imapmsk is a pointer to the interrupt-map-mask property, which must have
  * a size of physsz + intrsz; it may be NULL, in which case a full mask is
@@ -216,11 +214,11 @@ ofw_bus_search_intrmap(void *intr, int i
     int rintrsz)
 {
 	phandle_t parent;
-	u_int8_t *ref = maskbuf;
-	u_int8_t *uiintr = intr;
-	u_int8_t *uiregs = regs;
-	u_int8_t *uiimapmsk = imapmsk;
-	u_int8_t *mptr;
+	uint8_t *ref = maskbuf;
+	uint8_t *uiintr = intr;
+	uint8_t *uiregs = regs;
+	uint8_t *uiimapmsk = imapmsk;
+	uint8_t *mptr;
 	pcell_t pintrsz;
 	int i, rsz, tsz;
 
@@ -244,13 +242,13 @@ ofw_bus_search_intrmap(void *intr, int i
 			pintrsz = 1;	/* default */
 		pintrsz *= sizeof(pcell_t);
 
-		/* Compute the map stride size */
+		/* Compute the map stride size. */
 		tsz = physsz + intrsz + sizeof(phandle_t) + pintrsz;
 		KASSERT(i >= tsz, ("ofw_bus_search_intrmap: truncated map"));
-	
+
 		/*
 		 * XXX: Apple hardware uses a second cell to set information
-		 * on the interrupt trigger type. This information should
+		 * on the interrupt trigger type.  This information should
 		 * be used somewhere to program the PIC.
 		 */
 

Modified: head/sys/dev/ofw/ofw_bus_subr.h
==============================================================================
--- head/sys/dev/ofw/ofw_bus_subr.h	Sat Jun 13 23:44:56 2009	(r194137)
+++ head/sys/dev/ofw/ofw_bus_subr.h	Sun Jun 14 00:05:38 2009	(r194138)
@@ -41,30 +41,30 @@
 #define	ORIR_NOTFOUND	0xffffffff
 
 struct ofw_bus_iinfo {
-	u_int8_t		*opi_imap;
-	u_int8_t		*opi_imapmsk;
+	uint8_t			*opi_imap;
+	uint8_t			*opi_imapmsk;
 	int			opi_imapsz;
 	pcell_t			opi_addrc;
 };
 
+/* Generic implementation of ofw_bus_if.m methods and helper routines */
 int	ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *, phandle_t);
 void	ofw_bus_gen_destroy_devinfo(struct ofw_bus_devinfo *);
 
+ofw_bus_get_compat_t	ofw_bus_gen_get_compat;
+ofw_bus_get_model_t	ofw_bus_gen_get_model;
+ofw_bus_get_name_t	ofw_bus_gen_get_name;
+ofw_bus_get_node_t	ofw_bus_gen_get_node;
+ofw_bus_get_type_t	ofw_bus_gen_get_type;
+
 /* Helper method to report interesting OF properties in pnpinfo */
-int	ofw_bus_gen_child_pnpinfo_str(device_t, device_t, char *, size_t);
+bus_child_pnpinfo_str_t	ofw_bus_gen_child_pnpinfo_str;
 
 /* Routines for processing firmware interrupt maps */
-
 void	ofw_bus_setup_iinfo(phandle_t, struct ofw_bus_iinfo *, int);
 int	ofw_bus_lookup_imap(phandle_t, struct ofw_bus_iinfo *, void *, int,
 	    void *, int, void *, int, void *);
 int	ofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *,
 	    void *, void *, int);
 
-ofw_bus_get_compat_t	ofw_bus_gen_get_compat;
-ofw_bus_get_model_t	ofw_bus_gen_get_model;
-ofw_bus_get_name_t	ofw_bus_gen_get_name;
-ofw_bus_get_node_t	ofw_bus_gen_get_node;
-ofw_bus_get_type_t	ofw_bus_gen_get_type;
-
 #endif /* !_DEV_OFW_OFW_BUS_SUBR_H_ */

Modified: head/sys/dev/ofw/ofw_disk.c
==============================================================================
--- head/sys/dev/ofw/ofw_disk.c	Sat Jun 13 23:44:56 2009	(r194137)
+++ head/sys/dev/ofw/ofw_disk.c	Sun Jun 14 00:05:38 2009	(r194138)
@@ -47,16 +47,16 @@ __FBSDID("$FreeBSD$");
 
 struct ofwd_softc
 {
-        struct bio_queue_head ofwd_bio_queue;
-        struct mtx	ofwd_queue_mtx;
+	struct bio_queue_head ofwd_bio_queue;
+	struct mtx	ofwd_queue_mtx;
 	ihandle_t	ofwd_instance;
 	off_t		ofwd_mediasize;
-        unsigned	ofwd_sectorsize;
-        unsigned	ofwd_fwheads;
-        unsigned	ofwd_fwsectors;
-        struct proc	*ofwd_procp;
-        struct g_geom	*ofwd_gp;
-        struct g_provider *ofwd_pp;
+	unsigned	ofwd_sectorsize;
+	unsigned	ofwd_fwheads;
+	unsigned	ofwd_fwsectors;
+	struct proc	*ofwd_procp;
+	struct g_geom	*ofwd_gp;
+	struct g_provider *ofwd_pp;
 } ofwd_softc;
 
 static g_init_t g_ofwd_init;
@@ -83,21 +83,21 @@ ofwd_startio(struct ofwd_softc *sc, stru
 
 	r = OF_seek(sc->ofwd_instance, bp->bio_offset);
 
-        switch (bp->bio_cmd) {
-        case BIO_READ:
+	switch (bp->bio_cmd) {
+	case BIO_READ:
 		r = OF_read(sc->ofwd_instance, (void *)bp->bio_data,
-		        bp->bio_length);
-                break;
-        case BIO_WRITE:
+			bp->bio_length);
+		break;
+	case BIO_WRITE:
 		r = OF_write(sc->ofwd_instance, (void *)bp->bio_data,
-		        bp->bio_length);
-                break;
-        }
+			bp->bio_length);
+		break;
+	}
 	if (r != bp->bio_length)
 		panic("ofwd: incorrect i/o count");
 
-        bp->bio_resid = 0;
-        return (0);
+	bp->bio_resid = 0;
+	return (0);
 }
 
 static void
@@ -107,41 +107,41 @@ ofwd_kthread(void *arg)
 	struct bio *bp;
 	int error;
 
-        sc = arg;
-        curthread->td_base_pri = PRIBIO;
+	sc = arg;
+	curthread->td_base_pri = PRIBIO;
 
-        for (;;) {
+	for (;;) {
 		mtx_lock(&sc->ofwd_queue_mtx);
 		bp = bioq_takefirst(&sc->ofwd_bio_queue);
 		if (!bp) {
 			msleep(sc, &sc->ofwd_queue_mtx, PRIBIO | PDROP,
 			    "ofwdwait", 0);
-                        continue;
+			continue;
 		}
-                mtx_unlock(&sc->ofwd_queue_mtx);
-                if (bp->bio_cmd == BIO_GETATTR) {
+		mtx_unlock(&sc->ofwd_queue_mtx);
+		if (bp->bio_cmd == BIO_GETATTR) {
 			error = EOPNOTSUPP;
-                } else
+		} else
 			error = ofwd_startio(sc, bp);
 
 		if (error != -1) {
-                        bp->bio_completed = bp->bio_length;
-                        g_io_deliver(bp, error);
-                }
+			bp->bio_completed = bp->bio_length;
+			g_io_deliver(bp, error);
+		}
 	}
 }
 
 static void
 g_ofwd_init(struct g_class *mp __unused)
 {
-	struct ofwd_softc *sc;
-        struct g_geom *gp;
-        struct g_provider *pp;
-	char	path[128];
-	char	fname[32];
+	char path[128];
+	char fname[32];
 	phandle_t ofd;
+	struct ofwd_softc *sc;
+	struct g_geom *gp;
+	struct g_provider *pp;
 	ihandle_t ifd;
-	int	error;
+	int error;
 
 	if (ofwd_enable == 0)
 		return;
@@ -161,19 +161,19 @@ g_ofwd_init(struct g_class *mp __unused)
 	}
 
 	sc = (struct ofwd_softc *)malloc(sizeof *sc, M_DEVBUF,
-	         M_WAITOK|M_ZERO);
+		 M_WAITOK|M_ZERO);
 	bioq_init(&sc->ofwd_bio_queue);
-        mtx_init(&sc->ofwd_queue_mtx, "ofwd bio queue", NULL, MTX_DEF);
+	mtx_init(&sc->ofwd_queue_mtx, "ofwd bio queue", NULL, MTX_DEF);
 	sc->ofwd_instance = ifd;
-	sc->ofwd_mediasize = (off_t)2*33554432;
+	sc->ofwd_mediasize = (off_t)2 * 33554432;
 	sc->ofwd_sectorsize = OFWD_BLOCKSIZE;
 	sc->ofwd_fwsectors = 0;
 	sc->ofwd_fwheads = 0;
 	error = kproc_create(ofwd_kthread, sc, &sc->ofwd_procp, 0, 0,
-		     "ofwd0");
-        if (error != 0) {
+	    "ofwd0");
+	if (error != 0) {
 		free(sc, M_DEVBUF);
-                return;
+		return;
 	}
 
 	gp = g_new_geomf(&g_ofwd_class, "ofwd0");
@@ -189,13 +189,13 @@ g_ofwd_init(struct g_class *mp __unused)
 static void
 g_ofwd_start(struct bio *bp)
 {
-        struct ofwd_softc *sc;
+	struct ofwd_softc *sc;
 
-        sc = bp->bio_to->geom->softc;
-        mtx_lock(&sc->ofwd_queue_mtx);
-        bioq_disksort(&sc->ofwd_bio_queue, bp);
-        mtx_unlock(&sc->ofwd_queue_mtx);
-        wakeup(sc);
+	sc = bp->bio_to->geom->softc;
+	mtx_lock(&sc->ofwd_queue_mtx);
+	bioq_disksort(&sc->ofwd_bio_queue, bp);
+	mtx_unlock(&sc->ofwd_queue_mtx);
+	wakeup(sc);
 }
 
 static int
@@ -204,5 +204,5 @@ g_ofwd_access(struct g_provider *pp, int
 
 	if (pp->geom->softc == NULL)
 		return (ENXIO);
-        return (0);
+	return (0);
 }

Modified: head/sys/dev/ofw/ofw_if.m
==============================================================================
--- head/sys/dev/ofw/ofw_if.m	Sat Jun 13 23:44:56 2009	(r194137)
+++ head/sys/dev/ofw/ofw_if.m	Sun Jun 14 00:05:38 2009	(r194138)
@@ -32,7 +32,7 @@
 /**
  * @defgroup OFW ofw - KObj methods for Open Firmware RTAS implementations
  * @brief A set of methods to implement the Open Firmware client side interface.
- *@{
+ * @{
  */
 
 INTERFACE ofw;
@@ -49,59 +49,59 @@ METHOD void init {
 };
 
 /**
- * @brief Return next sibling of node
+ * @brief Return next sibling of node.
  *
  * @param _node		Selected node
  */
 METHOD phandle_t peer {
 	ofw_t		_ofw;
-	phandle_t 	_node;
+	phandle_t	_node;
 };
 
 /**
- * @brief Return parent of node
+ * @brief Return parent of node.
  *
  * @param _node		Selected node
  */
 METHOD phandle_t parent {
 	ofw_t		_ofw;
-	phandle_t 	_node;
+	phandle_t	_node;
 };
 
 /**
- * @brief Return first child of node
+ * @brief Return first child of node.
  *
  * @param _node		Selected node
  */
 METHOD phandle_t child {
 	ofw_t		_ofw;
-	phandle_t 	_node;
+	phandle_t	_node;
 };
 
 /**
- * @brief Return package corresponding to instance
+ * @brief Return package corresponding to instance.
  *
  * @param _handle	Selected instance
  */
 METHOD phandle_t instance_to_package {
 	ofw_t		_ofw;
-	ihandle_t 	_handle;
+	ihandle_t	_handle;
 };
 
 /**
- * @brief Return length of node property
+ * @brief Return length of node property.
  *
  * @param _node		Selected node
  * @param _prop		Property name
  */
 METHOD ssize_t getproplen {
 	ofw_t		_ofw;
-	phandle_t 	_node;
-	const char 	*_prop;
+	phandle_t	_node;
+	const char	*_prop;
 };
 
 /**
- * @brief Read node property
+ * @brief Read node property.
  *
  * @param _node		Selected node
  * @param _prop		Property name
@@ -110,14 +110,14 @@ METHOD ssize_t getproplen {
  */
 METHOD ssize_t getprop {
 	ofw_t		_ofw;
-	phandle_t 	_node;
+	phandle_t	_node;
 	const char	*_prop;
 	void		*_buf;
 	size_t		_size;
 };
 
 /**
- * @brief Get next property name
+ * @brief Get next property name.
  *
  * @param _node		Selected node
  * @param _prop		Current property name
@@ -126,14 +126,14 @@ METHOD ssize_t getprop {
  */
 METHOD int nextprop {
 	ofw_t		_ofw;
-	phandle_t 	_node;
+	phandle_t	_node;
 	const char	*_prop;
-	char 		*_buf;
+	char		*_buf;
 	size_t		_size;
 };
 
 /**
- * @brief Set property
+ * @brief Set property.
  *
  * @param _node		Selected node
  * @param _prop		Property name
@@ -142,14 +142,14 @@ METHOD int nextprop {
  */
 METHOD int setprop {
 	ofw_t		_ofw;
-	phandle_t 	_node;
-	const char 	*_prop;
+	phandle_t	_node;
+	const char	*_prop;
 	const void	*_buf;
 	size_t		_size;
 };
 
 /**
- * @brief Canonicalize path
+ * @brief Canonicalize path.
  *
  * @param _path		Path to canonicalize
  * @param _buf		Buffer for canonicalized path
@@ -163,17 +163,17 @@ METHOD ssize_t canon {
 };
 
 /**
- * @brief Return phandle for named device
+ * @brief Return phandle for named device.
  *
  * @param _path		Device path
  */
 METHOD phandle_t finddevice {
 	ofw_t		_ofw;
-	const char 	*_path;
+	const char	*_path;
 };
 
 /**
- * @brief Return path for node instance
+ * @brief Return path for node instance.
  *
  * @param _handle	Instance handle
  * @param _path		Buffer for path
@@ -182,12 +182,12 @@ METHOD phandle_t finddevice {
 METHOD ssize_t instance_to_path {
 	ofw_t		_ofw;
 	ihandle_t	_handle;
-	char	 	*_path;
+	char		*_path;
 	size_t		_size;
 };
 
 /**
- * @brief Return path for node
+ * @brief Return path for node.
  *
  * @param _node		Package node
  * @param _path		Buffer for path
@@ -196,11 +196,10 @@ METHOD ssize_t instance_to_path {
 METHOD ssize_t package_to_path {
 	ofw_t		_ofw;
 	phandle_t	_node;
-	char	 	*_path;
+	char		*_path;
 	size_t		_size;
 };
 
-
 # Methods for OF method calls (optional)
 
 /**
@@ -214,7 +213,7 @@ METHOD int test {
 };
 
 /**
- * @brief Call method belonging to an instance handle
+ * @brief Call method belonging to an instance handle.
  *
  * @param _instance	Instance handle
  * @param _method	Method name
@@ -228,13 +227,13 @@ METHOD int call_method {
 	ihandle_t	_instance;
 	const char	*_method;
 	int		_nargs;
-	int 		_nreturns;
+	int		_nreturns;
 
 	unsigned long	*_args_and_returns;
 };
 
 /**
- * @brief Interpret a forth command
+ * @brief Interpret a forth command.
  *
  * @param _cmd		Command
  * @param _nreturns	Number of return values
@@ -244,14 +243,14 @@ METHOD int call_method {
 METHOD int interpret {
 	ofw_t		_ofw;
 	const char	*_cmd;
-	int 		_nreturns;
+	int		_nreturns;
 	unsigned long	*_returns;
 };
 
 # Device I/O Functions (optional)
 
 /**
- * @brief Open node, returning instance handle
+ * @brief Open node, returning instance handle.
  *
  * @param _path		Path to node
  */
@@ -261,7 +260,7 @@ METHOD ihandle_t open {
 }
 
 /**
- * @brief Close node instance
+ * @brief Close node instance.
  *
  * @param _instance	Instance to close
  */
@@ -271,7 +270,7 @@ METHOD void close {
 }
 
 /**
- * @brief Read from device
+ * @brief Read from device.
  *
  * @param _instance	Device instance
  * @param _buf		Buffer to read to
@@ -285,7 +284,7 @@ METHOD ssize_t read {
 }
 
 /**
- * @brief Write to device
+ * @brief Write to device.
  *
  * @param _instance	Device instance
  * @param _buf		Buffer to write from
@@ -299,7 +298,7 @@ METHOD ssize_t write {
 }
 
 /**
- * @brief Seek device
+ * @brief Seek device.
  *
  * @param _instance	Device instance
  * @param _off		Offset to which to seek
@@ -313,7 +312,7 @@ METHOD int seek {
 # Open Firmware memory management
 
 /**
- * @brief Claim virtual memory
+ * @brief Claim virtual memory.
  *
  * @param _addr		Requested memory location (NULL for first available)
  * @param _size		Requested size in bytes
@@ -327,7 +326,7 @@ METHOD caddr_t claim {
 }
 
 /**
- * @brief Release virtual memory
+ * @brief Release virtual memory.
  *
  * @param _addr		Memory location
  * @param _size		Size in bytes
@@ -341,17 +340,15 @@ METHOD void release {
 # Commands for returning control to the firmware
 
 /**
- * @brief Temporarily return control to firmware
+ * @brief Temporarily return control to firmware.
  */
 METHOD void enter {
 	ofw_t		_ofw;
 };
 
 /**
- * @brief Halt and return control to firmware
+ * @brief Halt and return control to firmware.
  */
 METHOD void exit {
 	ofw_t		_ofw;
 };
-
-

Modified: head/sys/dev/ofw/ofw_iicbus.c
==============================================================================
--- head/sys/dev/ofw/ofw_iicbus.c	Sat Jun 13 23:44:56 2009	(r194137)
+++ head/sys/dev/ofw/ofw_iicbus.c	Sun Jun 14 00:05:38 2009	(r194138)
@@ -68,7 +68,7 @@ static device_method_t ofw_iicbus_method
 	DEVMETHOD(ofw_bus_get_node,	ofw_bus_gen_get_node),
 	DEVMETHOD(ofw_bus_get_type,	ofw_bus_gen_get_type),
 
-	{ 0, 0 }
+	KOBJMETHOD_END
 };
 
 struct ofw_iicbus_devinfo {
@@ -100,7 +100,7 @@ ofw_iicbus_attach(device_t dev)
 {
 	struct iicbus_softc *sc = IICBUS_SOFTC(dev);
 	struct ofw_iicbus_devinfo *dinfo;
-	phandle_t node, child;
+	phandle_t child;
 	device_t childdev;
 	uint32_t addr;
 
@@ -114,16 +114,13 @@ ofw_iicbus_attach(device_t dev)
 	/*
 	 * Attach those children represented in the device tree.
 	 */
-
-	node = ofw_bus_get_node(dev);
-
-	for (child = OF_child(node); child != 0; child = OF_peer(child)) {
+	for (child = OF_child(ofw_bus_get_node(dev)); child != 0;
+	    child = OF_peer(child)) {
 		/*
 		 * Try to get the I2C address first from the i2c-address
-		 * property, then try the reg property. It moves around
+		 * property, then try the reg property.  It moves around
 		 * on different systems.
 		 */
-
 		if (OF_getprop(child, "i2c-address", &addr, sizeof(addr)) == -1)
 			if (OF_getprop(child, "reg", &addr, sizeof(addr)) == -1)
 				continue;
@@ -132,7 +129,6 @@ ofw_iicbus_attach(device_t dev)
 		 * Now set up the I2C and OFW bus layer devinfo and add it
 		 * to the bus.
 		 */
-
 		dinfo = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF,
 		    M_NOWAIT | M_ZERO);
 		if (dinfo == NULL)
@@ -159,15 +155,17 @@ ofw_iicbus_add_child(device_t dev, int o
 	child = device_add_child_ordered(dev, order, name, unit);
 	if (child == NULL)
 		return (child);
-	devi = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF, 
+	devi = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF,
 	    M_NOWAIT | M_ZERO);
 	if (devi == NULL) {
 		device_delete_child(dev, child);
 		return (0);
 	}
 
-	/* NULL all the OFW-related parts of the ivars for non-OFW children */
-	
+	/*
+	 * NULL all the OFW-related parts of the ivars for non-OFW
+	 * children.
+	 */
 	devi->opd_obdinfo.obd_node = -1;
 	devi->opd_obdinfo.obd_name = NULL;
 	devi->opd_obdinfo.obd_compat = NULL;
@@ -175,7 +173,7 @@ ofw_iicbus_add_child(device_t dev, int o
 	devi->opd_obdinfo.obd_model = NULL;
 
 	device_set_ivars(child, devi);
-	
+
 	return (child);
 }
 
@@ -187,4 +185,3 @@ ofw_iicbus_get_devinfo(device_t bus, dev
 	dinfo = device_get_ivars(dev);
 	return (&dinfo->opd_obdinfo);
 }
-

Modified: head/sys/dev/ofw/ofw_standard.c
==============================================================================
--- head/sys/dev/ofw/ofw_standard.c	Sat Jun 13 23:44:56 2009	(r194137)
+++ head/sys/dev/ofw/ofw_standard.c	Sun Jun 14 00:05:38 2009	(r194138)
@@ -65,8 +65,9 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/stdarg.h>
 
-#include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofwvar.h>
+#include <dev/ofw/openfirm.h>
+
 #include "ofw_if.h"
 
 static void ofw_std_init(ofw_t ofw, void *openfirm);
@@ -101,7 +102,7 @@ static ssize_t ofw_std_read(ofw_t ofw, i
     size_t len);
 static ssize_t ofw_std_write(ofw_t ofw, ihandle_t instance, const void *addr,
     size_t len);
-static int ofw_std_seek(ofw_t ofw, ihandle_t instance, u_int64_t pos);
+static int ofw_std_seek(ofw_t ofw, ihandle_t instance, uint64_t pos);
 static caddr_t ofw_std_claim(ofw_t ofw, void *virt, size_t size, u_int align);
 static void ofw_std_release(ofw_t ofw, void *virt, size_t size);
 static void ofw_std_enter(ofw_t ofw);
@@ -147,11 +148,12 @@ OFW_DEF(ofw_std);
 
 static int (*openfirmware)(void *);
 
-/* Initialiser */
+/* Initializer */
 
 static void
 ofw_std_init(ofw_t ofw, void *openfirm)
 {
+
 	openfirmware = (int (*)(void *))openfirm;
 }
 
@@ -199,9 +201,8 @@ ofw_std_interpret(ofw_t ofw, const char 
 
 	args.nreturns = ++nreturns;
 	args.slot[i++] = (cell_t)cmd;
-	if (openfirmware(&args) == -1) {
+	if (openfirmware(&args) == -1)
 		return (-1);
-	}
 	status = args.slot[i++];
 	while (i < 1 + nreturns)
 		returns[j++] = args.slot[i++];
@@ -571,9 +572,8 @@ ofw_std_open(ofw_t ofw, const char *devi
 	};
 
 	args.device = (cell_t)device;
-	if (openfirmware(&args) == -1 || args.instance == 0) {
+	if (openfirmware(&args) == -1 || args.instance == 0)
 		return (-1);
-	}
 	return (args.instance);
 }
 
@@ -650,7 +650,7 @@ ofw_std_write(ofw_t ofw, ihandle_t insta
 
 /* Seek to a position. */
 static int
-ofw_std_seek(ofw_t ofw, ihandle_t instance, u_int64_t pos)
+ofw_std_seek(ofw_t ofw, ihandle_t instance, uint64_t pos)
 {
 	static struct {
 		cell_t name;
@@ -760,4 +760,3 @@ ofw_std_exit(ofw_t ofw)
 	for (;;)			/* just in case */
 		;
 }
-

Modified: head/sys/dev/ofw/ofwvar.h
==============================================================================
--- head/sys/dev/ofw/ofwvar.h	Sat Jun 13 23:44:56 2009	(r194137)
+++ head/sys/dev/ofw/ofwvar.h	Sun Jun 14 00:05:38 2009	(r194138)
@@ -27,8 +27,8 @@
  * $FreeBSD$
  */
 
-#ifndef _OFW_OFWVAR_H_
-#define _OFW_OFWVAR_H_
+#ifndef _DEV_OFW_OFWVAR_H_
+#define	_DEV_OFW_OFWVAR_H_
 
 /*
  * An Open Firmware client implementation is declared with a kernel object and
@@ -45,7 +45,7 @@
  * };
  *
  * static ofw_def_t ofw_fdt = {
- * 	"ofw_fdt",
+ *	"ofw_fdt",
  *	fdt_methods,
  *	sizeof(fdt_softc),	// or 0 if no softc
  * };
@@ -69,21 +69,21 @@ struct ofw_kobj {
 
 	/*
 	 * Opaque data that can be overlaid with an instance-private
-	 * structure. OFW code can test that this is large enough at
-	 * compile time with a sizeof() test againt it's softc. There
+	 * structure.  OFW code can test that this is large enough at
+	 * compile time with a sizeof() test againt it's softc.  There
 	 * is also a run-time test when the MMU kernel object is
 	 * registered.
 	 */
-#define OFW_OPAQUESZ	64
+#define	OFW_OPAQUESZ	64
 	u_int		ofw_opaque[OFW_OPAQUESZ];
 };
 
 typedef struct ofw_kobj		*ofw_t;
 typedef struct kobj_class	ofw_def_t;
 
-#define ofw_method_t	kobj_method_t
-#define OFWMETHOD	KOBJMETHOD
+#define	ofw_method_t	kobj_method_t
+#define	OFWMETHOD	KOBJMETHOD
 
-#define OFW_DEF(name)	DATA_SET(ofw_set, name)
+#define	OFW_DEF(name)	DATA_SET(ofw_set, name)
 
-#endif /* _OFW_OFWVAR_H_ */
+#endif /* _DEV_OFW_OFWVAR_H_ */

Modified: head/sys/dev/ofw/openfirm.c
==============================================================================
--- head/sys/dev/ofw/openfirm.c	Sat Jun 13 23:44:56 2009	(r194137)
+++ head/sys/dev/ofw/openfirm.c	Sun Jun 14 00:05:38 2009	(r194138)
@@ -65,8 +65,8 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/stdarg.h>
 
-#include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofwvar.h>
+#include <dev/ofw/openfirm.h>
 
 #include "ofw_if.h"
 
@@ -88,12 +88,12 @@ SET_DECLARE(ofw_set, ofw_def_t);
 boolean_t
 OF_install(char *name, int prio)
 {
-	ofw_def_t  **ofwpp, *ofwp;
+	ofw_def_t *ofwp, **ofwpp;
 	static int curr_prio = 0;
 
 	/*
-	* Try and locate the OFW kobj corresponding to the name
-	*/
+	 * Try and locate the OFW kobj corresponding to the name.
+	 */
 	SET_FOREACH(ofwpp, ofw_set) {
 		ofwp = *ofwpp;
 
@@ -109,8 +109,7 @@ OF_install(char *name, int prio)
 	return (FALSE);
 }
 
-/* Initialiser */
-
+/* Initializer */
 void
 OF_init(void *cookie)
 {
@@ -119,7 +118,7 @@ OF_init(void *cookie)
 	ofw_obj = &ofw_kernel_obj;
 	/*
 	 * Take care of compiling the selected class, and
-	 * then statically initialize the OFW object
+	 * then statically initialize the OFW object.
 	 */
 	kobj_class_compile_static(ofw_def_impl, &ofw_kernel_kops);
 	kobj_init((kobj_t)ofw_obj, ofw_def_impl);
@@ -152,6 +151,7 @@ OF_printf(const char *fmt, ...)
 int
 OF_test(const char *name)
 {
+
 	return (OFW_TEST(ofw_obj, name));
 }
 
@@ -183,6 +183,7 @@ OF_interpret(const char *cmd, int nretur
 phandle_t
 OF_peer(phandle_t node)
 {
+
 	return (OFW_PEER(ofw_obj, node));
 }
 
@@ -190,6 +191,7 @@ OF_peer(phandle_t node)
 phandle_t
 OF_child(phandle_t node)
 {
+
 	return (OFW_CHILD(ofw_obj, node));
 }
 
@@ -197,6 +199,7 @@ OF_child(phandle_t node)
 phandle_t
 OF_parent(phandle_t node)
 {
+
 	return (OFW_PARENT(ofw_obj, node));
 }
 
@@ -204,6 +207,7 @@ OF_parent(phandle_t node)
 phandle_t
 OF_instance_to_package(ihandle_t instance)
 {
+
 	return (OFW_INSTANCE_TO_PACKAGE(ofw_obj, instance));
 }
 
@@ -211,6 +215,7 @@ OF_instance_to_package(ihandle_t instanc
 ssize_t
 OF_getproplen(phandle_t package, const char *propname)
 {
+
 	return (OFW_GETPROPLEN(ofw_obj, package, propname));
 }
 
@@ -218,6 +223,7 @@ OF_getproplen(phandle_t package, const c
 ssize_t
 OF_getprop(phandle_t package, const char *propname, void *buf, size_t buflen)
 {
+
 	return (OFW_GETPROP(ofw_obj, package, propname, buf, buflen));
 }
 
@@ -227,20 +233,19 @@ OF_getprop(phandle_t package, const char
  * first match.
  */
 ssize_t
-OF_searchprop(phandle_t node, char *propname, void *buf, size_t len)
+OF_searchprop(phandle_t node, const char *propname, void *buf, size_t len)
 {
 	ssize_t rv;
 
-	for (; node != 0; node = OF_parent(node)) {
+	for (; node != 0; node = OF_parent(node))
 		if ((rv = OF_getprop(node, propname, buf, len)) != -1)
 			return (rv);
-	}
 	return (-1);
 }
 
 /*
  * Store the value of a property of a package into newly allocated memory
- * (using the M_OFWPROP malloc pool and M_WAITOK). elsz is the size of a
+ * (using the M_OFWPROP malloc pool and M_WAITOK).  elsz is the size of a
  * single element, the number of elements is return in number.
  */
 ssize_t
@@ -266,6 +271,7 @@ OF_getprop_alloc(phandle_t package, cons
 int
 OF_nextprop(phandle_t package, const char *previous, char *buf, size_t size)
 {
+
 	return (OFW_NEXTPROP(ofw_obj, package, previous, buf, size));
 }
 
@@ -273,6 +279,7 @@ OF_nextprop(phandle_t package, const cha
 int
 OF_setprop(phandle_t package, const char *propname, const void *buf, size_t len)
 {
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906140005.n5E05cXu028241>