Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Avoid pointless use of a sysctl definition, CTL_...



details:   https://anonhg.NetBSD.org/src/rev/af1119b0226a
branches:  trunk
changeset: 758727:af1119b0226a
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sun Nov 14 05:31:59 2010 +0000

description:
Avoid pointless use of a sysctl definition, CTL_NAMES.  Clean up whitespace.

diffstat:

 sys/dev/pci/twa.c |  61 +++++++++++++++++++++++++++---------------------------
 sys/dev/pci/twe.c |  31 +++++++++++++--------------
 2 files changed, 45 insertions(+), 47 deletions(-)

diffs (190 lines):

diff -r 8809938060f7 -r af1119b0226a sys/dev/pci/twa.c
--- a/sys/dev/pci/twa.c Sun Nov 14 04:31:02 2010 +0000
+++ b/sys/dev/pci/twa.c Sun Nov 14 05:31:59 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: twa.c,v 1.34 2010/11/13 13:52:08 uebayasi Exp $ */
+/*     $NetBSD: twa.c,v 1.35 2010/11/14 05:33:44 uebayasi Exp $ */
 /*     $wasabi: twa.c,v 1.27 2006/07/28 18:17:21 wrstuden Exp $        */
 
 /*-
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.34 2010/11/13 13:52:08 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.35 2010/11/14 05:33:44 uebayasi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -984,7 +984,7 @@
 
                if (twa_inquiry(tr, unit) == 0) {
                        if (td->td_dev == NULL) {
-                               twa_print_inquiry_data(sc,
+                               twa_print_inquiry_data(sc,
                                   ((struct scsipi_inquiry_data *)tr->tr_data));
 
                                sc->sc_units[unit].td_size =
@@ -1142,24 +1142,24 @@
 static int
 twa_drain_response_queue_large(struct twa_softc *sc, uint32_t timeout)
 {
-        uint32_t        start_time = 0, end_time;
-        uint32_t        response = 0;
-
-        if (sc->sc_product_id == PCI_PRODUCT_3WARE_9550 ||
-            sc->sc_product_id == PCI_PRODUCT_3WARE_9650 ) {
-               start_time = 0;
-               end_time = (timeout * TWA_MICROSECOND);
-
-               while ((response &
-                   TWA_9550SX_DRAIN_COMPLETE) != TWA_9550SX_DRAIN_COMPLETE) {
+       uint32_t        start_time = 0, end_time;
+       uint32_t        response = 0;
+
+       if (sc->sc_product_id == PCI_PRODUCT_3WARE_9550 ||
+           sc->sc_product_id == PCI_PRODUCT_3WARE_9650 ) {
+              start_time = 0;
+              end_time = (timeout * TWA_MICROSECOND);
+
+              while ((response &
+                  TWA_9550SX_DRAIN_COMPLETE) != TWA_9550SX_DRAIN_COMPLETE) {
                        response = twa_inl(sc, TWA_RESPONSE_QUEUE_LARGE_OFFSET);
                        if (start_time >= end_time)
-                               return (1);
-                        DELAY(1);
-                        start_time++;
-               }
-               /* P-chip delay */
-               DELAY(500000);
+                              return (1);
+                       DELAY(1);
+                       start_time++;
+              }
+              /* P-chip delay */
+              DELAY(500000);
        }
        return (0);
 }
@@ -1492,7 +1492,6 @@
        pcireg_t csr;
        pci_intr_handle_t ih;
        const char *intrstr;
-       struct ctlname ctlnames[] = CTL_NAMES;
        const struct sysctlnode *node; 
        int i;
        bool use_64bit;
@@ -1594,27 +1593,27 @@
                                NULL, NULL, 0, NULL, 0,
                                CTL_HW, CTL_EOL) != 0) {
                aprint_error_dev(&sc->twa_dv, "could not create %s sysctl node\n",
-                       ctlnames[CTL_HW].ctl_name);
+                       "hw");
                return;
        }
        if (sysctl_createv(NULL, 0, NULL, &node,
-                               0, CTLTYPE_NODE, device_xname(&sc->twa_dv),
-                               SYSCTL_DESCR("twa driver information"),
-                               NULL, 0, NULL, 0,
+                               0, CTLTYPE_NODE, device_xname(&sc->twa_dv),
+                               SYSCTL_DESCR("twa driver information"),
+                               NULL, 0, NULL, 0,
                                CTL_HW, CTL_CREATE, CTL_EOL) != 0) {
-                aprint_error_dev(&sc->twa_dv, "could not create %s.%s sysctl node\n",
-                       ctlnames[CTL_HW].ctl_name,
+               aprint_error_dev(&sc->twa_dv, "could not create %s.%s sysctl node\n",
+                       "hw",
                        device_xname(&sc->twa_dv));
                return;
        }
        if ((i = sysctl_createv(NULL, 0, NULL, NULL,
-                               0, CTLTYPE_STRING, "driver_version",
-                               SYSCTL_DESCR("twa driver version"),
-                               NULL, 0, &twaver, 0,
+                               0, CTLTYPE_STRING, "driver_version",
+                               SYSCTL_DESCR("twa driver version"),
+                               NULL, 0, &twaver, 0,
                                CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
                                != 0) {
-                aprint_error_dev(&sc->twa_dv, "could not create %s.%s.driver_version sysctl\n",
-                       ctlnames[CTL_HW].ctl_name,
+               aprint_error_dev(&sc->twa_dv, "could not create %s.%s.driver_version sysctl\n",
+                       "hw",
                        device_xname(&sc->twa_dv));
                return;
        }
diff -r 8809938060f7 -r af1119b0226a sys/dev/pci/twe.c
--- a/sys/dev/pci/twe.c Sun Nov 14 04:31:02 2010 +0000
+++ b/sys/dev/pci/twe.c Sun Nov 14 05:31:59 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: twe.c,v 1.92 2010/11/13 13:52:08 uebayasi Exp $        */
+/*     $NetBSD: twe.c,v 1.93 2010/11/14 05:31:59 uebayasi Exp $        */
 
 /*-
  * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.92 2010/11/13 13:52:08 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.93 2010/11/14 05:31:59 uebayasi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -315,8 +315,7 @@
        int s, size, i, rv, rseg;
        size_t max_segs, max_xfer;
        bus_dma_segment_t seg;
-        struct ctlname ctlnames[] = CTL_NAMES;
-        const struct sysctlnode *node;
+       const struct sysctlnode *node;
        struct twe_cmd *tc;
        struct twe_ccb *ccb;
 
@@ -364,7 +363,7 @@
        /*
         * Allocate and initialise the command blocks and CCBs.
         */
-        size = sizeof(struct twe_cmd) * TWE_MAX_QUEUECNT;
+       size = sizeof(struct twe_cmd) * TWE_MAX_QUEUECNT;
 
        if ((rv = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &seg, 1,
            &rseg, BUS_DMA_NOWAIT)) != 0) {
@@ -462,26 +461,26 @@
                                NULL, NULL, 0, NULL, 0,
                                CTL_HW, CTL_EOL) != 0) {
                aprint_error_dev(&sc->sc_dv, "could not create %s sysctl node\n",
-                       ctlnames[CTL_HW].ctl_name);
+                       "hw");
                return;
        }
        if (sysctl_createv(NULL, 0, NULL, &node,
-                               0, CTLTYPE_NODE, device_xname(&sc->sc_dv),
-                               SYSCTL_DESCR("twe driver information"),
-                               NULL, 0, NULL, 0,
+                               0, CTLTYPE_NODE, device_xname(&sc->sc_dv),
+                               SYSCTL_DESCR("twe driver information"),
+                               NULL, 0, NULL, 0,
                                CTL_HW, CTL_CREATE, CTL_EOL) != 0) {
-                aprint_error_dev(&sc->sc_dv, "could not create %s.%s sysctl node\n",
-                       ctlnames[CTL_HW].ctl_name, device_xname(&sc->sc_dv));
+               aprint_error_dev(&sc->sc_dv, "could not create %s.%s sysctl node\n",
+                       "hw", device_xname(&sc->sc_dv));
                return;
        }
        if ((i = sysctl_createv(NULL, 0, NULL, NULL,
-                               0, CTLTYPE_STRING, "driver_version",
-                               SYSCTL_DESCR("twe0 driver version"),
-                               NULL, 0, &twever, 0,
+                               0, CTLTYPE_STRING, "driver_version",
+                               SYSCTL_DESCR("twe0 driver version"),
+                               NULL, 0, &twever, 0,
                                CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
                                != 0) {
-                aprint_error_dev(&sc->sc_dv, "could not create %s.%s.driver_version sysctl\n",
-                       ctlnames[CTL_HW].ctl_name, device_xname(&sc->sc_dv));
+               aprint_error_dev(&sc->sc_dv, "could not create %s.%s.driver_version sysctl\n",
+                       "hw", device_xname(&sc->sc_dv));
                return;
        }
 }



Home | Main Index | Thread Index | Old Index