Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Use a #define instead of a magic number



details:   https://anonhg.NetBSD.org/src/rev/23f160d480c0
branches:  trunk
changeset: 357600:23f160d480c0
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Nov 17 13:08:48 2017 +0000

description:
Use a #define instead of a magic number

diffstat:

 sys/dev/usb/if_run.c    |  8 ++++----
 sys/dev/usb/if_runvar.h |  6 ++++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 56bda242c35d -r 23f160d480c0 sys/dev/usb/if_run.c
--- a/sys/dev/usb/if_run.c      Fri Nov 17 12:55:16 2017 +0000
+++ b/sys/dev/usb/if_run.c      Fri Nov 17 13:08:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_run.c,v 1.23 2017/11/17 12:55:16 skrll Exp $        */
+/*     $NetBSD: if_run.c,v 1.24 2017/11/17 13:08:48 skrll Exp $        */
 /*     $OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $ */
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.23 2017/11/17 12:55:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.24 2017/11/17 13:08:48 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -599,13 +599,13 @@
                if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) {
                        sc->rxq.pipe_no = ed->bEndpointAddress;
                        nrx++;
-               } else if (ntx < 4) {
+               } else if (ntx < RUN_MAXEPOUT) {
                        sc->txq[ntx].pipe_no = ed->bEndpointAddress;
                        ntx++;
                }
        }
        /* make sure we've got them all */
-       if (nrx < 1 || ntx < 4) {
+       if (nrx < 1 || ntx < RUN_MAXEPOUT) {
                aprint_error_dev(sc->sc_dev, "missing endpoint\n");
                return;
        }
diff -r 56bda242c35d -r 23f160d480c0 sys/dev/usb/if_runvar.h
--- a/sys/dev/usb/if_runvar.h   Fri Nov 17 12:55:16 2017 +0000
+++ b/sys/dev/usb/if_runvar.h   Fri Nov 17 13:08:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_runvar.h,v 1.3 2016/09/16 09:25:30 mlelstv Exp $    */
+/*     $NetBSD: if_runvar.h,v 1.4 2017/11/17 13:08:48 skrll Exp $      */
 /*     $OpenBSD: if_runvar.h,v 1.8 2010/02/08 18:46:47 damien Exp $    */
 
 /*-
@@ -132,6 +132,8 @@
        uint8_t                 ctl_ridx[IEEE80211_RATE_MAXSIZE];
 };
 
+#define        RUN_MAXEPOUT    4
+
 struct run_softc {
        device_t                        sc_dev;
        struct ethercom                 sc_ec;
@@ -191,7 +193,7 @@
        callout_t                       calib_to;
 
        struct run_rx_ring              rxq;
-       struct run_tx_ring              txq[4];
+       struct run_tx_ring              txq[RUN_MAXEPOUT];
        struct run_host_cmd_ring        cmdq;
        uint8_t                         qfullmsk;
        int                             sc_tx_timer;



Home | Main Index | Thread Index | Old Index