Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Add comments and KNF. No functional change.



details:   https://anonhg.NetBSD.org/src/rev/03612070059c
branches:  trunk
changeset: 326258:03612070059c
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jan 23 17:43:28 2014 +0000

description:
Add comments and KNF. No functional change.

diffstat:

 sys/dev/pci/puccn.c |  31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diffs (98 lines):

diff -r 5a2bebd91523 -r 03612070059c sys/dev/pci/puccn.c
--- a/sys/dev/pci/puccn.c       Thu Jan 23 17:32:03 2014 +0000
+++ b/sys/dev/pci/puccn.c       Thu Jan 23 17:43:28 2014 +0000
@@ -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 @@
        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 @@
 
                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
 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 @@
 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);
 }



Home | Main Index | Thread Index | Old Index