Module Name:    src
Committed By:   msaitoh
Date:           Thu Jan 23 17:43:28 UTC 2014

Modified Files:
        src/sys/dev/pci: puccn.c

Log Message:
Add comments and KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/puccn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/puccn.c
diff -u src/sys/dev/pci/puccn.c:1.11 src/sys/dev/pci/puccn.c:1.12
--- src/sys/dev/pci/puccn.c:1.11	Mon Jul 22 13:40:36 2013
+++ src/sys/dev/pci/puccn.c	Thu Jan 23 17:43:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puccn.c,v 1.11 2013/07/22 13:40:36 soren Exp $ */
+/*	$NetBSD: puccn.c,v 1.12 2014/01/23 17:43:28 msaitoh Exp $ */
 
 /*
  * Derived from  pci.c
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puccn.c,v 1.11 2013/07/22 13:40:36 soren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puccn.c,v 1.12 2014/01/23 17:43:28 msaitoh Exp $");
 
 #include "opt_kgdb.h"
 
@@ -106,8 +106,7 @@ pucprobe_doit(struct consdev *cn)
 	puctag = pa.pa_iot;
 	pci_decompose_tag(pa.pa_pc, pa.pa_tag, &bus, &maxdev, NULL);
 
-	/* scan through devices */
-
+	/* Scan through devices and find a communication class device. */
 	for (; dev <= maxdev ; dev++) {
 		pa.pa_tag = pci_make_tag(pa.pa_pc, bus, dev, 0);
 		reg = pci_conf_read(pa.pa_pc, pa.pa_tag, PCI_ID_REG);
@@ -139,17 +138,30 @@ resume_scan:
 
 		func = 0;
 	}
+
+	/*
+	 * If all devices was scanned and couldn't find any communication
+	 * device, return with 0.
+	 */
 	if (!foundport)
 		return 0;
 	foundport = 0;
 
+	/* Check whether the device is in the puc device table or not */
 	desc = puc_find_description(PCI_VENDOR(pa.pa_id),
 	    PCI_PRODUCT(pa.pa_id), PCI_VENDOR(subsys), PCI_PRODUCT(subsys));
+
+	/* If not, check the next communication device */
 	if (desc == NULL) {
+		/* Resume from the next function */
 		func++;
 		goto resume_scan;
 	}
 
+	/*
+	 * We found a device and it's on the puc table. Set the tag and
+	 * the base address.
+	 */
 	for (i = 0; PUC_PORT_VALID(desc, i); i++)
 	{
 		if (desc->ports[i].type != PUC_PORT_TYPE_COM)
@@ -182,15 +194,17 @@ void comgdbinit(struct consdev *);
 void
 comgdbprobe(struct consdev *cn)
 {
+
 	pucgdbbase = pucprobe_doit(cn);
 }
 
 void
 comgdbinit(struct consdev *cn)
 {
-	if (pucgdbbase == 0) {
+
+	if (pucgdbbase == 0)
 		return;
-	}
+
 	com_kgdb_attach(puctag, pucgdbbase, CONSPEED, COM_FREQ,
 	    COM_TYPE_NORMAL, CONMODE);
 }
@@ -199,15 +213,16 @@ comgdbinit(struct consdev *cn)
 void
 comcnprobe(struct consdev *cn)
 {
+
 	puccnbase = pucprobe_doit(cn);
 }
 
 void
 comcninit(struct consdev *cn)
 {
-	if (puccnbase == 0) {
+	if (puccnbase == 0)
 		return;
-	}
+
 	comcnattach(puctag, puccnbase, CONSPEED, COM_FREQ, COM_TYPE_NORMAL,
 	    CONMODE);
 }

Reply via email to