A recent diff from dlg@ made me looks at where the global variable
``ticks'' is used and how. I find this *really* difficult because
there's a lot of noise. In order to reduce the noise and help for
this audit here's a first diff. It renames all the local variables
from ``ticks'' to ``nticks'' where this was not already the case.
This should make grepping easier, ok?
Index: arch/alpha/alpha/lock_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/alpha/alpha/lock_machdep.c,v
retrieving revision 1.3
diff -u -p -r1.3 lock_machdep.c
--- arch/alpha/alpha/lock_machdep.c 11 Feb 2015 03:56:00 -0000 1.3
+++ arch/alpha/alpha/lock_machdep.c 17 Mar 2016 18:46:17 -0000
@@ -71,14 +71,14 @@ __mp_lock_spin(struct __mp_lock *mpl)
while (mpl->mpl_count != 0)
SPINLOCK_SPIN_HOOK;
#else
- int ticks = __mp_lock_spinout;
- if (!CPU_IS_PRIMARY(curcpu())) /* XXX */
- ticks += ticks; /* XXX */
+ int nticks = __mp_lock_spinout;
+ if (!CPU_IS_PRIMARY(curcpu()))
+ nticks += nticks;
- while (mpl->mpl_count != 0 && --ticks > 0)
+ while (mpl->mpl_count != 0 && --nticks > 0)
SPINLOCK_SPIN_HOOK;
- if (ticks == 0) {
+ if (nticks == 0) {
db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
Index: arch/amd64/amd64/lock_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/lock_machdep.c,v
retrieving revision 1.9
diff -u -p -r1.9 lock_machdep.c
--- arch/amd64/amd64/lock_machdep.c 25 Jun 2015 00:58:49 -0000 1.9
+++ arch/amd64/amd64/lock_machdep.c 17 Mar 2016 18:46:21 -0000
@@ -50,12 +50,12 @@ __mp_lock_spin(struct __mp_lock *mpl, u_
while (mpl->mpl_ticket != me)
SPINLOCK_SPIN_HOOK;
#else
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
- while (mpl->mpl_ticket != me && --ticks > 0)
+ while (mpl->mpl_ticket != me && --nticks > 0)
SPINLOCK_SPIN_HOOK;
- if (ticks == 0) {
+ if (nticks == 0) {
db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
Index: arch/hppa/hppa/lock_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/hppa/lock_machdep.c,v
retrieving revision 1.8
diff -u -p -r1.8 lock_machdep.c
--- arch/hppa/hppa/lock_machdep.c 11 Feb 2015 01:58:57 -0000 1.8
+++ arch/hppa/hppa/lock_machdep.c 17 Mar 2016 18:46:27 -0000
@@ -81,12 +81,12 @@ __mp_lock_spin(struct __mp_lock *mpl)
while (mpl->mpl_count != 0)
SPINLOCK_SPIN_HOOK;
#else
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
- while (mpl->mpl_count != 0 && --ticks > 0)
+ while (mpl->mpl_count != 0 && --nticks > 0)
SPINLOCK_SPIN_HOOK;
- if (ticks == 0) {
+ if (nticks == 0) {
db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
Index: arch/i386/i386/lock_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/lock_machdep.c,v
retrieving revision 1.18
diff -u -p -r1.18 lock_machdep.c
--- arch/i386/i386/lock_machdep.c 30 May 2015 08:41:30 -0000 1.18
+++ arch/i386/i386/lock_machdep.c 17 Mar 2016 18:46:31 -0000
@@ -80,12 +80,12 @@ __mp_lock_spin(struct __mp_lock *mpl, u_
while (mpl->mpl_ticket != me)
SPINLOCK_SPIN_HOOK;
#else
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
- while (mpl->mpl_ticket != me && --ticks > 0)
+ while (mpl->mpl_ticket != me && --nticks > 0)
SPINLOCK_SPIN_HOOK;
- if (ticks == 0) {
+ if (nticks == 0) {
db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
Index: arch/m88k/m88k/mplock.c
===================================================================
RCS file: /cvs/src/sys/arch/m88k/m88k/mplock.c,v
retrieving revision 1.3
diff -u -p -r1.3 mplock.c
--- arch/m88k/m88k/mplock.c 11 Feb 2015 07:05:39 -0000 1.3
+++ arch/m88k/m88k/mplock.c 17 Mar 2016 18:46:34 -0000
@@ -50,12 +50,12 @@ __mp_lock_spin(struct __mp_lock *mpl)
while (mpl->mpl_count != 0)
SPINLOCK_SPIN_HOOK;
#else
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
- while (mpl->mpl_count != 0 && ticks-- > 0)
+ while (mpl->mpl_count != 0 && nticks-- > 0)
SPINLOCK_SPIN_HOOK;
- if (ticks == 0) {
+ if (nticks == 0) {
db_printf("__mp_lock(0x%x): lock spun out", mpl);
Debugger();
}
Index: arch/mips64/mips64/mutex.c
===================================================================
RCS file: /cvs/src/sys/arch/mips64/mips64/mutex.c,v
retrieving revision 1.3
diff -u -p -r1.3 mutex.c
--- arch/mips64/mips64/mutex.c 26 Sep 2015 04:03:25 -0000 1.3
+++ arch/mips64/mips64/mutex.c 17 Mar 2016 18:46:39 -0000
@@ -57,15 +57,15 @@ void
mtx_enter(struct mutex *mtx)
{
#ifdef MP_LOCKDEBUG
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
#endif
while (mtx_enter_try(mtx) == 0) {
#ifdef MP_LOCKDEBUG
- if (--ticks == 0) {
+ if (--nticks == 0) {
db_printf("%s(%p): lock spun out", __func__, mtx);
Debugger();
- ticks = __mp_lock_spinout;
+ nticks = __mp_lock_spinout;
}
#endif
}
Index: arch/mips64/mips64/lock_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/mips64/mips64/lock_machdep.c,v
retrieving revision 1.1
diff -u -p -r1.1 lock_machdep.c
--- arch/mips64/mips64/lock_machdep.c 9 Sep 2015 15:48:52 -0000 1.1
+++ arch/mips64/mips64/lock_machdep.c 17 Mar 2016 18:46:42 -0000
@@ -51,12 +51,12 @@ __mp_lock_spin(struct __mp_lock *mpl)
while (mpl->mpl_count != 0)
SPINLOCK_SPIN_HOOK;
#else
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
- while (mpl->mpl_count != 0 && --ticks > 0)
+ while (mpl->mpl_count != 0 && --nticks > 0)
SPINLOCK_SPIN_HOOK;
- if (ticks == 0) {
+ if (nticks == 0) {
db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
Index: arch/powerpc/powerpc/mutex.c
===================================================================
RCS file: /cvs/src/sys/arch/powerpc/powerpc/mutex.c,v
retrieving revision 1.2
diff -u -p -r1.2 mutex.c
--- arch/powerpc/powerpc/mutex.c 21 Sep 2015 06:21:49 -0000 1.2
+++ arch/powerpc/powerpc/mutex.c 17 Mar 2016 18:46:45 -0000
@@ -57,14 +57,14 @@ void
mtx_enter(struct mutex *mtx)
{
#if defined(MP_LOCKDEBUG)
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
#endif
while (mtx_enter_try(mtx) == 0) {
SPINLOCK_SPIN_HOOK;
#if defined(MP_LOCKDEBUG)
- if (--ticks == 0) {
+ if (--nticks == 0) {
db_printf("%s: %p lock spun out", __func__, mtx);
Debugger();
}
Index: arch/powerpc/powerpc/lock_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/powerpc/powerpc/lock_machdep.c,v
retrieving revision 1.3
diff -u -p -r1.3 lock_machdep.c
--- arch/powerpc/powerpc/lock_machdep.c 14 Aug 2015 06:14:19 -0000 1.3
+++ arch/powerpc/powerpc/lock_machdep.c 17 Mar 2016 18:46:47 -0000
@@ -49,12 +49,12 @@ __mp_lock_spin(struct __mp_lock *mpl)
while (mpl->mpl_count != 0)
SPINLOCK_SPIN_HOOK;
#else
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
- while (mpl->mpl_count != 0 && --ticks > 0)
+ while (mpl->mpl_count != 0 && --nticks > 0)
SPINLOCK_SPIN_HOOK;
- if (ticks == 0) {
+ if (nticks == 0) {
db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
Index: arch/sparc64/dev/beep.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/dev/beep.c,v
retrieving revision 1.6
diff -u -p -r1.6 beep.c
--- arch/sparc64/dev/beep.c 8 Jan 2016 15:54:13 -0000 1.6
+++ arch/sparc64/dev/beep.c 17 Mar 2016 18:42:36 -0000
@@ -219,11 +219,11 @@ void
beep_bell(void *vsc, u_int pitch, u_int period, u_int volume, int poll)
{
struct beep_softc *sc = vsc;
- int s, ticks;
+ int s, nticks;
- ticks = (period * hz) / 1000;
- if (ticks <= 0)
- ticks = 1;
+ nticks = (period * hz) / 1000;
+ if (nticks <= 0)
+ nticks = 1;
s = spltty();
if (sc->sc_bellactive) {
@@ -240,7 +240,7 @@ beep_bell(void *vsc, u_int pitch, u_int
sc->sc_belltimeout = 1;
bus_space_write_1(sc->sc_iot, sc->sc_ioh, BEEP_CTRL,
BEEP_CTRL_ON);
- timeout_add(&sc->sc_to, ticks);
+ timeout_add(&sc->sc_to, nticks);
}
splx(s);
}
Index: arch/sparc64/dev/beeper.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/dev/beeper.c,v
retrieving revision 1.10
diff -u -p -r1.10 beeper.c
--- arch/sparc64/dev/beeper.c 20 Dec 2005 16:50:33 -0000 1.10
+++ arch/sparc64/dev/beeper.c 17 Mar 2016 18:42:42 -0000
@@ -148,11 +148,11 @@ beeper_bell(vsc, pitch, period, volume,
int poll;
{
struct beeper_softc *sc = vsc;
- int s, ticks;
+ int s, nticks;
- ticks = (period * hz) / 1000;
- if (ticks <= 0)
- ticks = 1;
+ nticks = (period * hz) / 1000;
+ if (nticks <= 0)
+ nticks = 1;
s = spltty();
if (sc->sc_bellactive) {
@@ -168,7 +168,7 @@ beeper_bell(vsc, pitch, period, volume,
sc->sc_bellactive = 1;
sc->sc_belltimeout = 1;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, BEEP_REG, 1);
- timeout_add(&sc->sc_to, ticks);
+ timeout_add(&sc->sc_to, nticks);
}
splx(s);
}
Index: arch/sparc64/sparc64/lock_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/sparc64/lock_machdep.c,v
retrieving revision 1.10
diff -u -p -r1.10 lock_machdep.c
--- arch/sparc64/sparc64/lock_machdep.c 25 Jun 2015 00:53:19 -0000 1.10
+++ arch/sparc64/sparc64/lock_machdep.c 17 Mar 2016 18:46:56 -0000
@@ -93,12 +93,12 @@ __mp_lock_spin(struct __mp_lock *mpl, u_
while (mpl->mpl_ticket != me)
SPINLOCK_SPIN_HOOK;
#else
- int ticks = __mp_lock_spinout;
+ int nticks = __mp_lock_spinout;
- while (mpl->mpl_ticket != me && --ticks > 0)
+ while (mpl->mpl_ticket != me && --nticks > 0)
SPINLOCK_SPIN_HOOK;
- if (ticks == 0) {
+ if (nticks == 0) {
db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
Index: dev/ic/aic79xx_openbsd.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/aic79xx_openbsd.c,v
retrieving revision 1.43
diff -u -p -r1.43 aic79xx_openbsd.c
--- dev/ic/aic79xx_openbsd.c 17 Jul 2015 21:42:49 -0000 1.43
+++ dev/ic/aic79xx_openbsd.c 17 Mar 2016 18:43:00 -0000
@@ -692,24 +692,24 @@ void
aic_timer_reset(aic_timer_t *timer, u_int msec, ahd_callback_t *func,
void *arg)
{
- uint64_t ticks;
+ uint64_t nticks;
- ticks = msec;
- ticks *= hz;
- ticks /= 1000;
- callout_reset(timer, ticks, func, arg);
+ nticks = msec;
+ nticks *= hz;
+ nticks /= 1000;
+ callout_reset(timer, nticks, func, arg);
}
void
aic_scb_timer_reset(struct scb *scb, u_int msec)
{
- uint64_t ticks;
+ uint64_t nticks;
- ticks = msec;
- ticks *= hz;
- ticks /= 1000;
+ nticks = msec;
+ nticks *= hz;
+ nticks /= 1000;
if (!(scb->xs->xs_control & XS_CTL_POLL))
- callout_reset(&scb->xs->xs_callout, ticks, ahd_timeout, scb);
+ callout_reset(&scb->xs->xs_callout, nticks, ahd_timeout, scb);
}
void
Index: dev/ic/re.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/re.c,v
retrieving revision 1.189
diff -u -p -r1.189 re.c
--- dev/ic/re.c 4 Jan 2016 05:41:22 -0000 1.189
+++ dev/ic/re.c 17 Mar 2016 18:43:17 -0000
@@ -2262,15 +2262,15 @@ re_setup_sim_im(struct rl_softc *sc)
if (sc->sc_hwrev == RL_HWREV_8139CPLUS)
CSR_WRITE_4(sc, RL_TIMERINT, 0x400); /* XXX */
else {
- u_int32_t ticks;
+ u_int32_t nticks;
/*
* Datasheet says tick decreases at bus speed,
* but it seems the clock runs a little bit
* faster, so we do some compensation here.
*/
- ticks = (sc->rl_sim_time * sc->rl_bus_speed * 8) / 5;
- CSR_WRITE_4(sc, RL_TIMERINT_8169, ticks);
+ nticks = (sc->rl_sim_time * sc->rl_bus_speed * 8) / 5;
+ CSR_WRITE_4(sc, RL_TIMERINT_8169, nticks);
}
CSR_WRITE_4(sc, RL_TIMERCNT, 1); /* reload */
sc->rl_timerintr = 1;
Index: dev/isa/spkr.c
===================================================================
RCS file: /cvs/src/sys/dev/isa/spkr.c,v
retrieving revision 1.20
diff -u -p -r1.20 spkr.c
--- dev/isa/spkr.c 25 Nov 2015 04:49:10 -0000 1.20
+++ dev/isa/spkr.c 17 Mar 2016 18:52:04 -0000
@@ -83,16 +83,16 @@ static void playstring(char *, size_t);
/* emit tone of frequency hz for given number of ticks */
static void
-tone(hz, ticks)
- u_int hz, ticks;
+tone(hz, nticks)
+ u_int hz, nticks;
{
- pcppi_bell(ppicookie, hz, ticks, PCPPI_BELL_SLEEP);
+ pcppi_bell(ppicookie, hz, nticks, PCPPI_BELL_SLEEP);
}
/* rest for given number of ticks */
static void
-rest(ticks)
- int ticks;
+rest(nticks)
+ int nticks;
{
/*
* Set timeout to endrest function, then give up the timeslice.
@@ -100,10 +100,10 @@ rest(ticks)
* waited out.
*/
#ifdef SPKRDEBUG
- printf("rest: %d\n", ticks);
+ printf("rest: %d\n", nticks);
#endif /* SPKRDEBUG */
- if (ticks > 0)
- tsleep(rest, SPKRPRI | PCATCH, "rest", ticks);
+ if (nticks > 0)
+ tsleep(rest, SPKRPRI | PCATCH, "rest", nticks);
}
/**************** PLAY STRING INTERPRETER BEGINS HERE **********************
Index: dev/pci/ichwdt.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ichwdt.c,v
retrieving revision 1.5
diff -u -p -r1.5 ichwdt.c
--- dev/pci/ichwdt.c 10 Dec 2014 12:27:57 -0000 1.5
+++ dev/pci/ichwdt.c 17 Mar 2016 18:44:29 -0000
@@ -158,7 +158,7 @@ int
ichwdt_cb(void *arg, int period)
{
struct ichwdt_softc *sc = arg;
- int ticks;
+ int nticks;
if (period == 0) {
if (sc->sc_period != 0) {
@@ -178,11 +178,11 @@ ichwdt_cb(void *arg, int period)
if (sc->sc_period != period) {
/* Set new timeout */
- ticks = (period * 33000000) / sc->sc_divisor;
- ichwdt_unlock_write(sc, ICH_WDT_PRE1, ticks);
+ nticks = (period * 33000000) / sc->sc_divisor;
+ ichwdt_unlock_write(sc, ICH_WDT_PRE1, nticks);
ichwdt_unlock_write(sc, ICH_WDT_PRE2, 2);
- DPRINTF(("%s: timeout %ds (%d ticks)\n",
- sc->sc_dev.dv_xname, period, ticks));
+ DPRINTF(("%s: timeout %ds (%d nticks)\n",
+ sc->sc_dev.dv_xname, period, nticks));
}
if (sc->sc_period == 0) {
/* Enable watchdog */
Index: dev/sbus/stp4020.c
===================================================================
RCS file: /cvs/src/sys/dev/sbus/stp4020.c,v
retrieving revision 1.18
diff -u -p -r1.18 stp4020.c
--- dev/sbus/stp4020.c 19 Nov 2013 01:23:51 -0000 1.18
+++ dev/sbus/stp4020.c 17 Mar 2016 18:44:36 -0000
@@ -898,21 +898,21 @@ void
stp4020_delay(ms)
unsigned int ms;
{
- unsigned int ticks;
+ unsigned int nticks;
- /* Convert to ticks */
- ticks = (ms * hz) / 1000000;
+ /* Convert to nticks */
+ nticks = (ms * hz) / 1000000;
- if (cold || ticks == 0) {
+ if (cold || nticks == 0) {
delay(ms);
return;
}
#ifdef DEBUG
- if (ticks > 60 * hz)
- panic("stp4020: preposterous delay: %u", ticks);
+ if (nticks > 60 * hz)
+ panic("stp4020: preposterous delay: %u", nticks);
#endif
- tsleep(&ticks, 0, "stp4020_delay", ticks);
+ tsleep(&nticks, 0, "stp4020_delay", ticks);
}
#ifdef STP4020_DEBUG
Index: dev/usb/uthum.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uthum.c,v
retrieving revision 1.30
diff -u -p -r1.30 uthum.c
--- dev/usb/uthum.c 9 Jan 2016 04:14:42 -0000 1.30
+++ dev/usb/uthum.c 17 Mar 2016 18:45:17 -0000
@@ -742,7 +742,7 @@ uthum_ds75_temp(uint8_t msb, uint8_t lsb
int
uthum_sht1x_temp(uint8_t msb, uint8_t lsb)
{
- int ticks;
+ int nticks;
/* sensor device VDD-bias value table
* ----------------------------------------------
@@ -754,20 +754,20 @@ uthum_sht1x_temp(uint8_t msb, uint8_t ls
* bias -3970 will be best for that device.
*/
- ticks = (msb * 256 + lsb) & 0x3fff;
- return (ticks - 3970);
+ nticks = (msb * 256 + lsb) & 0x3fff;
+ return (nticks - 3970);
}
/* return %RH * 1000 */
int
uthum_sht1x_rh(uint8_t msb, uint8_t lsb, int temp)
{
- int ticks, rh_l;
+ int nticks, rh_l;
- ticks = (msb * 256 + lsb) & 0x0fff;
- rh_l = (-40000 + 405 * ticks) - ((7 * ticks * ticks) / 250);
+ nticks = (msb * 256 + lsb) & 0x0fff;
+ rh_l = (-40000 + 405 * nticks) - ((7 * nticks * nticks) / 250);
- return ((temp - 2500) * (1 + (ticks >> 7)) + rh_l) / 10;
+ return ((temp - 2500) * (1 + (nticks >> 7)) + rh_l) / 10;
}
/* return muK */