summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/bluetooth
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-09-20 16:43:14 +0000
committerjhb <jhb@FreeBSD.org>2014-09-20 16:43:14 +0000
commita34aa18195a77cad15c2408a51b63e07ce819451 (patch)
tree48d8f0daa521fdfa6791fb78741bd3f95c34a2f9 /sys/netgraph/bluetooth
parent2de9b1383f69a330c29c69bd2fec9af162fcda3f (diff)
downloadFreeBSD-src-a34aa18195a77cad15c2408a51b63e07ce819451.zip
FreeBSD-src-a34aa18195a77cad15c2408a51b63e07ce819451.tar.gz
Use callout(9) instead of timeout(9).
Reviewed by: emax
Diffstat (limited to 'sys/netgraph/bluetooth')
-rw-r--r--sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h2
-rw-r--r--sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h2
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c13
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c12
4 files changed, 12 insertions, 17 deletions
diff --git a/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h b/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h
index deea5b3..493ea42 100644
--- a/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h
+++ b/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h
@@ -162,7 +162,7 @@ struct ng_btsocket_l2cap_pcb {
u_int16_t flush_timo; /* flush timeout */
u_int16_t link_timo; /* link timeout */
- struct callout_handle timo; /* timeout */
+ struct callout timo; /* timeout */
u_int32_t token; /* message token */
ng_btsocket_l2cap_rtentry_p rt; /* routing info */
diff --git a/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h b/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
index 4aaa658..fdc1d00 100644
--- a/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
+++ b/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
@@ -296,7 +296,7 @@ struct ng_btsocket_rfcomm_pcb {
int16_t tx_cred; /* TX credits */
struct mtx pcb_mtx; /* PCB lock */
- struct callout_handle timo; /* timeout */
+ struct callout timo; /* timeout */
LIST_ENTRY(ng_btsocket_rfcomm_pcb) session_next;/* link to next */
LIST_ENTRY(ng_btsocket_rfcomm_pcb) next; /* link to next */
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
index af2ce1a..bab8bbb 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
@@ -1967,8 +1967,6 @@ ng_btsocket_l2cap_attach(struct socket *so, int proto, struct thread *td)
pcb->flush_timo = NG_L2CAP_FLUSH_TIMO_DEFAULT;
pcb->link_timo = NG_L2CAP_LINK_TIMO_DEFAULT;
- callout_handle_init(&pcb->timo);
-
/*
* XXX Mark PCB mutex as DUPOK to prevent "duplicated lock of
* the same type" message. When accepting new L2CAP connection
@@ -1978,6 +1976,7 @@ ng_btsocket_l2cap_attach(struct socket *so, int proto, struct thread *td)
mtx_init(&pcb->pcb_mtx, "btsocks_l2cap_pcb_mtx", NULL,
MTX_DEF|MTX_DUPOK);
+ callout_init_mtx(&pcb->timo, &pcb->pcb_mtx, 0);
/*
* Add the PCB to the list
@@ -2664,8 +2663,8 @@ ng_btsocket_l2cap_timeout(ng_btsocket_l2cap_pcb_p pcb)
if (!(pcb->flags & NG_BTSOCKET_L2CAP_TIMO)) {
pcb->flags |= NG_BTSOCKET_L2CAP_TIMO;
- pcb->timo = timeout(ng_btsocket_l2cap_process_timeout, pcb,
- bluetooth_l2cap_ertx_timeout());
+ callout_reset(&pcb->timo, bluetooth_l2cap_ertx_timeout(),
+ ng_btsocket_l2cap_process_timeout, pcb);
} else
KASSERT(0,
("%s: Duplicated socket timeout?!\n", __func__));
@@ -2681,7 +2680,7 @@ ng_btsocket_l2cap_untimeout(ng_btsocket_l2cap_pcb_p pcb)
mtx_assert(&pcb->pcb_mtx, MA_OWNED);
if (pcb->flags & NG_BTSOCKET_L2CAP_TIMO) {
- untimeout(ng_btsocket_l2cap_process_timeout, pcb, pcb->timo);
+ callout_stop(&pcb->timo);
pcb->flags &= ~NG_BTSOCKET_L2CAP_TIMO;
} else
KASSERT(0,
@@ -2697,7 +2696,7 @@ ng_btsocket_l2cap_process_timeout(void *xpcb)
{
ng_btsocket_l2cap_pcb_p pcb = (ng_btsocket_l2cap_pcb_p) xpcb;
- mtx_lock(&pcb->pcb_mtx);
+ mtx_assert(&pcb->pcb_mtx, MA_OWNED);
pcb->flags &= ~NG_BTSOCKET_L2CAP_TIMO;
pcb->so->so_error = ETIMEDOUT;
@@ -2731,8 +2730,6 @@ ng_btsocket_l2cap_process_timeout(void *xpcb)
"%s: Invalid socket state=%d\n", __func__, pcb->state);
break;
}
-
- mtx_unlock(&pcb->pcb_mtx);
} /* ng_btsocket_l2cap_process_timeout */
/*
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
index 215843c..cb3753d 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
@@ -434,7 +434,7 @@ ng_btsocket_rfcomm_attach(struct socket *so, int proto, struct thread *td)
pcb->rx_cred = RFCOMM_DEFAULT_CREDITS;
mtx_init(&pcb->pcb_mtx, "btsocks_rfcomm_pcb_mtx", NULL, MTX_DEF);
- callout_handle_init(&pcb->timo);
+ callout_init_mtx(&pcb->timo, &pcb->pcb_mtx, 0);
/* Add the PCB to the list */
mtx_lock(&ng_btsocket_rfcomm_sockets_mtx);
@@ -3451,8 +3451,8 @@ ng_btsocket_rfcomm_timeout(ng_btsocket_rfcomm_pcb_p pcb)
if (!(pcb->flags & NG_BTSOCKET_RFCOMM_DLC_TIMO)) {
pcb->flags |= NG_BTSOCKET_RFCOMM_DLC_TIMO;
pcb->flags &= ~NG_BTSOCKET_RFCOMM_DLC_TIMEDOUT;
- pcb->timo = timeout(ng_btsocket_rfcomm_process_timeout, pcb,
- ng_btsocket_rfcomm_timo * hz);
+ callout_reset(&pcb->timo, ng_btsocket_rfcomm_timo * hz,
+ ng_btsocket_rfcomm_process_timeout, pcb);
} else
panic("%s: Duplicated socket timeout?!\n", __func__);
} /* ng_btsocket_rfcomm_timeout */
@@ -3467,7 +3467,7 @@ ng_btsocket_rfcomm_untimeout(ng_btsocket_rfcomm_pcb_p pcb)
mtx_assert(&pcb->pcb_mtx, MA_OWNED);
if (pcb->flags & NG_BTSOCKET_RFCOMM_DLC_TIMO) {
- untimeout(ng_btsocket_rfcomm_process_timeout, pcb, pcb->timo);
+ callout_stop(&pcb->timo);
pcb->flags &= ~NG_BTSOCKET_RFCOMM_DLC_TIMO;
pcb->flags &= ~NG_BTSOCKET_RFCOMM_DLC_TIMEDOUT;
} else
@@ -3483,7 +3483,7 @@ ng_btsocket_rfcomm_process_timeout(void *xpcb)
{
ng_btsocket_rfcomm_pcb_p pcb = (ng_btsocket_rfcomm_pcb_p) xpcb;
- mtx_lock(&pcb->pcb_mtx);
+ mtx_assert(&pcb->pcb_mtx, MA_OWNED);
NG_BTSOCKET_RFCOMM_INFO(
"%s: Timeout, so=%p, dlci=%d, state=%d, flags=%#x\n",
@@ -3510,8 +3510,6 @@ ng_btsocket_rfcomm_process_timeout(void *xpcb)
}
ng_btsocket_rfcomm_task_wakeup();
-
- mtx_unlock(&pcb->pcb_mtx);
} /* ng_btsocket_rfcomm_process_timeout */
/*
OpenPOWER on IntegriCloud