Skip to content

Commit

Permalink
CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more tha…
Browse files Browse the repository at this point in the history
…n ten

years for head.  However, it is continuously misused as the mpsafe argument
for callout_init(9).  Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision:	https://reviews.freebsd.org/D2613
Reviewed by:	jhb
MFC after:	2 weeks
  • Loading branch information
juikim committed May 22, 2015
1 parent 316f4c8 commit fd90e2e
Show file tree
Hide file tree
Showing 100 changed files with 145 additions and 149 deletions.
2 changes: 1 addition & 1 deletion sys/amd64/amd64/mp_watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static void
watchdog_init(void *arg)
{

callout_init(&watchdog_callout, CALLOUT_MPSAFE);
callout_init(&watchdog_callout, 1);
if (watchdog_cpu != -1)
watchdog_change(watchdog_cpu);
}
Expand Down
2 changes: 1 addition & 1 deletion sys/amd64/vmm/io/vatpit.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ vatpit_init(struct vm *vm)
vatpit->freq_sbt = bttosbt(bt);

for (i = 0; i < 3; i++) {
callout_init(&vatpit->channel[i].callout, true);
callout_init(&vatpit->channel[i].callout, 1);
arg = &vatpit->channel[i].callout_arg;
arg->vatpit = vatpit;
arg->channel_num = i;
Expand Down
2 changes: 1 addition & 1 deletion sys/arm/amlogic/aml8726/aml8726_rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ aml8726_rng_attach(device_t dev)
else
sc->ticks = 1;

callout_init(&sc->co, CALLOUT_MPSAFE);
callout_init(&sc->co, 1);
callout_reset(&sc->co, sc->ticks, aml8726_rng_harvest, sc);

return (0);
Expand Down
2 changes: 1 addition & 1 deletion sys/arm/freescale/imx/imx_sdhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ imx_sdhci_attach(device_t dev)
sc->force_card_present = true;
}

callout_init(&sc->r1bfix_callout, true);
callout_init(&sc->r1bfix_callout, 1);
sdhci_init_slot(dev, &sc->slot, 0);

bus_generic_probe(dev);
Expand Down
4 changes: 2 additions & 2 deletions sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -14225,8 +14225,8 @@ dtrace_state_create(struct cdev *dev)
state->dts_cleaner = CYCLIC_NONE;
state->dts_deadman = CYCLIC_NONE;
#else
callout_init(&state->dts_cleaner, CALLOUT_MPSAFE);
callout_init(&state->dts_deadman, CALLOUT_MPSAFE);
callout_init(&state->dts_cleaner, 1);
callout_init(&state->dts_deadman, 1);
#endif
state->dts_vstate.dtvs_state = state;

Expand Down
2 changes: 1 addition & 1 deletion sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ spa_add(const char *name, nvlist_t *config, const char *altroot)
mutex_exit(&cpu_lock);
#else /* !illumos */
#ifdef _KERNEL
callout_init(&spa->spa_deadman_cycid, CALLOUT_MPSAFE);
callout_init(&spa->spa_deadman_cycid, 1);
#endif
#endif
refcount_create(&spa->spa_refcount);
Expand Down
4 changes: 2 additions & 2 deletions sys/cddl/dev/profile/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ profile_create(hrtime_t interval, char *name, int kind)
prof->prof_cyclic = CYCLIC_NONE;
#else
prof->prof_interval = nsec_to_sbt(interval);
callout_init(&prof->prof_cyclic, CALLOUT_MPSAFE);
callout_init(&prof->prof_cyclic, 1);
#endif
prof->prof_kind = kind;
prof->prof_id = dtrace_probe_create(profile_id,
Expand Down Expand Up @@ -590,7 +590,7 @@ profile_enable_omni(profile_probe_t *prof)
pcpu->profc_probe = prof;
pcpu->profc_expected = sbinuptime() + prof->prof_interval;
pcpu->profc_interval = prof->prof_interval;
callout_init(&pcpu->profc_cyclic, CALLOUT_MPSAFE);
callout_init(&pcpu->profc_cyclic, 1);
callout_reset_sbt_on(&pcpu->profc_cyclic,
pcpu->profc_expected, 0, profile_fire, pcpu,
cpu, C_DIRECT_EXEC | C_ABSOLUTE);
Expand Down
2 changes: 1 addition & 1 deletion sys/compat/ndis/subr_ntoskrnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3749,7 +3749,7 @@ ntoskrnl_insert_timer(timer, ticks)

timer->k_callout = c;

callout_init(c, CALLOUT_MPSAFE);
callout_init(c, 1);
callout_reset(c, ticks, ntoskrnl_timercall, timer);
}

Expand Down
4 changes: 2 additions & 2 deletions sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ ipf_timer_func(arg)
#if 0
softc->ipf_slow_ch = timeout(ipf_timer_func, softc, hz/2);
#endif
callout_init(&softc->ipf_slow_ch, CALLOUT_MPSAFE);
callout_init(&softc->ipf_slow_ch, 1);
callout_reset(&softc->ipf_slow_ch,
(hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT,
ipf_timer_func, softc);
Expand Down Expand Up @@ -235,7 +235,7 @@ ipfattach(softc)
softc->ipf_slow_ch = timeout(ipf_timer_func, softc,
(hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT);
#endif
callout_init(&softc->ipf_slow_ch, CALLOUT_MPSAFE);
callout_init(&softc->ipf_slow_ch, 1);
callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT,
ipf_timer_func, softc);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion sys/contrib/vchiq/interface/compat/vchi_bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void
init_timer(struct timer_list *t)
{
mtx_init(&t->mtx, "dahdi timer lock", NULL, MTX_SPIN);
callout_init(&t->callout, CALLOUT_MPSAFE);
callout_init(&t->callout, 1);
t->expires = 0;
/*
* function and data are not initialized intentionally:
Expand Down
2 changes: 1 addition & 1 deletion sys/dev/acpica/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ acpi_attach(device_t dev)

sc = device_get_softc(dev);
sc->acpi_dev = dev;
callout_init(&sc->susp_force_to, TRUE);
callout_init(&sc->susp_force_to, 1);

error = ENXIO;

Expand Down
4 changes: 2 additions & 2 deletions sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ altera_jtag_uart_attach(struct altera_jtag_uart_softc *sc)
aju_intr_readable_enable(sc);
AJU_UNLOCK(sc);
} else {
callout_init(&sc->ajus_io_callout, CALLOUT_MPSAFE);
callout_init(&sc->ajus_io_callout, 1);
callout_reset(&sc->ajus_io_callout, AJU_IO_POLLINTERVAL,
aju_io_callout, sc);
}
callout_init(&sc->ajus_ac_callout, CALLOUT_MPSAFE);
callout_init(&sc->ajus_ac_callout, 1);
callout_reset(&sc->ajus_ac_callout, AJU_AC_POLLINTERVAL,
aju_ac_callout, sc);
return (0);
Expand Down
2 changes: 1 addition & 1 deletion sys/dev/ath/if_ath.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
sc->sc_ledstate = 1;
sc->sc_ledon = 0; /* low true */
sc->sc_ledidle = (2700*hz)/1000; /* 2.7sec */
callout_init(&sc->sc_ledtimer, CALLOUT_MPSAFE);
callout_init(&sc->sc_ledtimer, 1);

/*
* Don't setup hardware-based blinking.
Expand Down
10 changes: 3 additions & 7 deletions sys/dev/ce/if_ce.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ __FBSDID("$FreeBSD$");
#define CE_DEBUG2(d,s) ({if (d->chan->debug>1) {\
printf ("%s: ", d->name); printf s;}})

#ifndef CALLOUT_MPSAFE
#define CALLOUT_MPSAFE 0
#endif

#ifndef IF_DRAIN
#define IF_DRAIN(ifq) do { \
struct mbuf *m; \
Expand Down Expand Up @@ -609,7 +605,7 @@ static int ce_attach (device_t dev)
return (ENXIO);
}
#if __FreeBSD_version >= 500000
callout_init (&led_timo[unit], CALLOUT_MPSAFE);
callout_init (&led_timo[unit], 1);
#else
callout_init (&led_timo[unit]);
#endif
Expand Down Expand Up @@ -661,7 +657,7 @@ static int ce_attach (device_t dev)
continue;
d = c->sys;

callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
callout_init (&d->timeout_handle, 1);
#ifdef NETGRAPH
if (ng_make_node_common (&typestruct, &d->node) != 0) {
printf ("%s: cannot make common node\n", d->name);
Expand Down Expand Up @@ -2558,7 +2554,7 @@ static int ce_modevent (module_t mod, int type, void *unused)
cdevsw_add (&ce_cdevsw);
#endif
#if __FreeBSD_version >= 500000
callout_init (&timeout_handle, CALLOUT_MPSAFE);
callout_init (&timeout_handle, 1);
#else
callout_init (&timeout_handle);
#endif
Expand Down
6 changes: 3 additions & 3 deletions sys/dev/cp/if_cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static int cp_attach (device_t dev)
splx (s);
return (ENXIO);
}
callout_init (&led_timo[unit], CALLOUT_MPSAFE);
callout_init (&led_timo[unit], 1);
error = bus_setup_intr (dev, bd->cp_irq,
INTR_TYPE_NET|INTR_MPSAFE,
NULL, cp_intr, bd, &bd->cp_intrhand);
Expand Down Expand Up @@ -474,7 +474,7 @@ static int cp_attach (device_t dev)
d->board = b;
d->chan = c;
c->sys = d;
callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
callout_init (&d->timeout_handle, 1);
#ifdef NETGRAPH
if (ng_make_node_common (&typestruct, &d->node) != 0) {
printf ("%s: cannot make common node\n", d->name);
Expand Down Expand Up @@ -2223,7 +2223,7 @@ static int cp_modevent (module_t mod, int type, void *unused)
printf ("Failed to register ng_cp\n");
#endif
++load_count;
callout_init (&timeout_handle, CALLOUT_MPSAFE);
callout_init (&timeout_handle, 1);
callout_reset (&timeout_handle, hz*5, cp_timeout, 0);
break;
case MOD_UNLOAD:
Expand Down
6 changes: 3 additions & 3 deletions sys/dev/ctau/if_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ static int ct_attach (device_t dev)
return ENXIO;
}

callout_init (&led_timo[unit], CALLOUT_MPSAFE);
callout_init (&led_timo[unit], 1);
s = splimp ();
if (bus_setup_intr (dev, bd->irq_res,
INTR_TYPE_NET|INTR_MPSAFE,
Expand Down Expand Up @@ -685,7 +685,7 @@ static int ct_attach (device_t dev)
c->sys = d;
channel [b->num*NCHAN + c->num] = d;
sprintf (d->name, "ct%d.%d", b->num, c->num);
callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
callout_init (&d->timeout_handle, 1);

#ifdef NETGRAPH
if (ng_make_node_common (&typestruct, &d->node) != 0) {
Expand Down Expand Up @@ -2162,7 +2162,7 @@ static int ct_modevent (module_t mod, int type, void *unused)
printf ("Failed to register ng_ct\n");
#endif
++load_count;
callout_init (&timeout_handle, CALLOUT_MPSAFE);
callout_init (&timeout_handle, 1);
callout_reset (&timeout_handle, hz*5, ct_timeout, 0);
break;
case MOD_UNLOAD:
Expand Down
8 changes: 4 additions & 4 deletions sys/dev/cx/if_cx.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ static int cx_attach (device_t dev)
return ENXIO;
}
b->sys = bd;
callout_init (&led_timo[b->num], CALLOUT_MPSAFE);
callout_init (&led_timo[b->num], 1);
s = splhigh ();
if (bus_setup_intr (dev, bd->irq_res,
INTR_TYPE_NET|INTR_MPSAFE,
Expand Down Expand Up @@ -796,7 +796,7 @@ static int cx_attach (device_t dev)
case T_UNIV_RS232:
case T_UNIV_RS449:
case T_UNIV_V35:
callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
callout_init (&d->timeout_handle, 1);
#ifdef NETGRAPH
if (ng_make_node_common (&typestruct, &d->node) != 0) {
printf ("%s: cannot make common node\n", d->name);
Expand Down Expand Up @@ -867,7 +867,7 @@ static int cx_attach (device_t dev)
ttycreate(d->tty, TS_CALLOUT, "x%r%r", b->num, c->num);
d->devt = make_dev (&cx_cdevsw, b->num*NCHAN + c->num + 64, UID_ROOT, GID_WHEEL, 0600, "cx%d", b->num*NCHAN + c->num);
d->devt->si_drv1 = d;
callout_init (&d->dcd_timeout_handle, CALLOUT_MPSAFE);
callout_init (&d->dcd_timeout_handle, 1);
}
splx (s);

Expand Down Expand Up @@ -2497,7 +2497,7 @@ static int cx_modevent (module_t mod, int type, void *unused)
#endif
++load_count;

callout_init (&timeout_handle, CALLOUT_MPSAFE);
callout_init (&timeout_handle, 1);
callout_reset (&timeout_handle, hz*5, cx_timeout, 0);
/* Software interrupt. */
swi_add(&tty_intr_event, "cx", cx_softintr, NULL, SWI_TTY,
Expand Down
4 changes: 2 additions & 2 deletions sys/dev/cxgb/cxgb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ cxgb_controller_attach(device_t dev)


/* Create a periodic callout for checking adapter status */
callout_init(&sc->cxgb_tick_ch, TRUE);
callout_init(&sc->cxgb_tick_ch, 1);

if (t3_check_fw_version(sc) < 0 || force_fw_update) {
/*
Expand Down Expand Up @@ -1006,7 +1006,7 @@ cxgb_port_attach(device_t dev)
device_get_unit(device_get_parent(dev)), p->port_id);
PORT_LOCK_INIT(p, p->lockbuf);

callout_init(&p->link_check_ch, CALLOUT_MPSAFE);
callout_init(&p->link_check_ch, 1);
TASK_INIT(&p->link_check_task, 0, check_link_status, p);

/* Allocate an ifnet object and set it up */
Expand Down
2 changes: 1 addition & 1 deletion sys/dev/cxgb/cxgb_sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ sge_timer_cb(void *arg)
int
t3_sge_init_adapter(adapter_t *sc)
{
callout_init(&sc->sge_timer_ch, CALLOUT_MPSAFE);
callout_init(&sc->sge_timer_ch, 1);
callout_reset(&sc->sge_timer_ch, TX_RECLAIM_PERIOD, sge_timer_cb, sc);
TASK_INIT(&sc->slow_intr_task, 0, sge_slow_intr_handler, sc);
return (0);
Expand Down
6 changes: 3 additions & 3 deletions sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ start_ep_timer(struct iwch_ep *ep)
* XXX this looks racy
*/
get_ep(&ep->com);
callout_init(&ep->timer, TRUE);
callout_init(&ep->timer, 1);
}
callout_reset(&ep->timer, ep_timeout_secs * hz, ep_timeout, ep);
}
Expand Down Expand Up @@ -1307,7 +1307,7 @@ iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
err = (-ENOMEM);
goto out;
}
callout_init(&ep->timer, TRUE);
callout_init(&ep->timer, 1);
ep->plen = conn_param->private_data_len;
if (ep->plen)
memcpy(ep->mpa_pkt + sizeof(struct mpa_message),
Expand Down Expand Up @@ -1598,7 +1598,7 @@ process_newconn(struct iwch_ep *parent_ep)
free(remote, M_SONAME);
get_ep(&parent_ep->com);
child_ep->parent_ep = parent_ep;
callout_init(&child_ep->timer, TRUE);
callout_init(&child_ep->timer, 1);
state_set(&child_ep->com, MPA_REQ_WAIT);
start_ep_timer(child_ep);

Expand Down
2 changes: 1 addition & 1 deletion sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ static struct ib_qp *iwch_create_qp(struct ib_pd *pd,
insert_mmap(ucontext, mm2);
}
qhp->ibqp.qp_num = qhp->wq.qpid;
callout_init(&(qhp->timer), TRUE);
callout_init(&(qhp->timer), 1);
CTR6(KTR_IW_CXGB, "sq_num_entries %d, rq_num_entries %d "
"qpid 0x%0x qhp %p dma_addr 0x%llx size %d",
qhp->attr.sq_num_entries, qhp->attr.rq_num_entries,
Expand Down
4 changes: 2 additions & 2 deletions sys/dev/cxgbe/t4_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ t4_attach(device_t dev)

mtx_init(&sc->sfl_lock, "starving freelists", 0, MTX_DEF);
TAILQ_INIT(&sc->sfl);
callout_init(&sc->sfl_callout, CALLOUT_MPSAFE);
callout_init(&sc->sfl_callout, 1);

mtx_init(&sc->regwin_lock, "register and memory window", 0, MTX_DEF);

Expand Down Expand Up @@ -1082,7 +1082,7 @@ cxgbe_attach(device_t dev)
pi->ifp = ifp;
ifp->if_softc = pi;

callout_init(&pi->tick, CALLOUT_MPSAFE);
callout_init(&pi->tick, 1);

if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
Expand Down
2 changes: 1 addition & 1 deletion sys/dev/dcons/dcons_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ dcons_attach(void)

dcons_attach_port(DCONS_CON, "dcons", 0);
dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB);
callout_init(&dcons_callout, CALLOUT_MPSAFE);
callout_init(&dcons_callout, 1);
polltime = hz / poll_hz;
callout_reset(&dcons_callout, polltime, dcons_timeout, NULL);
return(0);
Expand Down
2 changes: 1 addition & 1 deletion sys/dev/drm2/drm_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
{
int i, ret = -ENOMEM;

callout_init(&dev->vblank_disable_callout, CALLOUT_MPSAFE);
callout_init(&dev->vblank_disable_callout, 1);
mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF);
mtx_init(&dev->vblank_time_lock, "drmvtl", NULL, MTX_DEF);

Expand Down
4 changes: 2 additions & 2 deletions sys/dev/drm2/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -6449,7 +6449,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)

intel_crtc->busy = false;

callout_init(&intel_crtc->idle_callout, CALLOUT_MPSAFE);
callout_init(&intel_crtc->idle_callout, 1);
}

int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
Expand Down Expand Up @@ -7038,7 +7038,7 @@ void intel_modeset_init(struct drm_device *dev)
intel_setup_outputs(dev);

TASK_INIT(&dev_priv->idle_task, 0, intel_idle_update, dev_priv);
callout_init(&dev_priv->idle_callout, CALLOUT_MPSAFE);
callout_init(&dev_priv->idle_callout, 1);
}

void intel_modeset_gem_init(struct drm_device *dev)
Expand Down
2 changes: 1 addition & 1 deletion sys/dev/glxsb/glxsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ glxsb_attach(device_t dev)
sc->sc_rnghz = hz / 100;
else
sc->sc_rnghz = 1;
callout_init(&sc->sc_rngco, CALLOUT_MPSAFE);
callout_init(&sc->sc_rngco, 1);
glxsb_rnd(sc);

return (0);
Expand Down
Loading

0 comments on commit fd90e2e

Please sign in to comment.