summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-01-11 11:55:56 +0000
committerglebius <glebius@FreeBSD.org>2005-01-11 11:55:56 +0000
commit55acc709312dfb2c2386aa69bbb52eed430e627e (patch)
tree7fa0382bfc479046489c56702fabcfdf7ecebc4b /sys/netgraph
parent1e5d735a0a5af0ca79a65938cefa487f297eeaa1 (diff)
downloadFreeBSD-src-55acc709312dfb2c2386aa69bbb52eed430e627e.zip
FreeBSD-src-55acc709312dfb2c2386aa69bbb52eed430e627e.tar.gz
- Use ng_callout() instead of home-grown implementation.
Submitted by: emax
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/bluetooth/drivers/h4/ng_h4.c24
-rw-r--r--sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h2
2 files changed, 4 insertions, 22 deletions
diff --git a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c
index 9f45b2e..b84244f 100644
--- a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c
+++ b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c
@@ -116,7 +116,6 @@ static ng_disconnect_t ng_h4_disconnect;
/* Other stuff */
static void ng_h4_timeout (node_p);
static void ng_h4_untimeout (node_p);
-static void ng_h4_queue_timeout (void *);
static void ng_h4_process_timeout (node_p, hook_p, void *, int);
static int ng_h4_mod_event (module_t, int, void *);
@@ -179,7 +178,7 @@ ng_h4_open(struct cdev *dev, struct tty *tp)
sc->got = 0;
NG_BT_MBUFQ_INIT(&sc->outq, NG_H4_DEFAULTQLEN);
- callout_handle_init(&sc->timo);
+ ng_callout_init(&sc->timo);
/* Setup netgraph node */
error = ng_make_node_common(&typestruct, &sc->node);
@@ -959,8 +958,7 @@ ng_h4_timeout(node_p node)
{
ng_h4_info_p sc = (ng_h4_info_p) NG_NODE_PRIVATE(node);
- NG_NODE_REF(node);
- sc->timo = timeout(ng_h4_queue_timeout, node, 1);
+ ng_callout(&sc->timo, node, NULL, 1, ng_h4_process_timeout, NULL, 0);
sc->flags |= NG_H4_TIMEOUT;
} /* ng_h4_timeout */
@@ -974,26 +972,10 @@ ng_h4_untimeout(node_p node)
ng_h4_info_p sc = (ng_h4_info_p) NG_NODE_PRIVATE(node);
sc->flags &= ~NG_H4_TIMEOUT;
- untimeout(ng_h4_queue_timeout, node, sc->timo);
- NG_NODE_UNREF(node);
+ ng_uncallout(&sc->timo, node);
} /* ng_h4_untimeout */
/*
- * OK, timeout has happend, so queue function to process it
- */
-
-static void
-ng_h4_queue_timeout(void *context)
-{
- node_p node = (node_p) context;
-
- if (NG_NODE_IS_VALID(node))
- ng_send_fn(node, NULL, &ng_h4_process_timeout, NULL, 0);
-
- NG_NODE_UNREF(node);
-} /* ng_h4_queue_timeout */
-
-/*
* Timeout processing function.
* We still have data to output to the device, so try sending more.
*/
diff --git a/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h b/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h
index eca54f7..d0cba3d 100644
--- a/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h
+++ b/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h
@@ -94,7 +94,7 @@ typedef struct ng_h4_info {
u_int32_t want; /* Number of bytes we want to receive */
hook_p hook; /* Upstream hook */
- struct callout_handle timo; /* See man timeout(9) */
+ struct callout timo; /* See man timeout(9) */
} ng_h4_info_t;
typedef ng_h4_info_t * ng_h4_info_p;
OpenPOWER on IntegriCloud