summaryrefslogtreecommitdiffstats
path: root/sys/dev/ctau
diff options
context:
space:
mode:
authorrik <rik@FreeBSD.org>2008-06-30 21:18:27 +0000
committerrik <rik@FreeBSD.org>2008-06-30 21:18:27 +0000
commitb49a85befd88be2728fef2765dde3ad4793511cc (patch)
treefc0d5f8df2864c985a23cc83800e237fc998a308 /sys/dev/ctau
parent8805d22e343f9c4b23897204b50dcd29aed7ca3f (diff)
downloadFreeBSD-src-b49a85befd88be2728fef2765dde3ad4793511cc.zip
FreeBSD-src-b49a85befd88be2728fef2765dde3ad4793511cc.tar.gz
Do not set IFF_DEBUG directly from the driver.
MFC after: 1 month.
Diffstat (limited to 'sys/dev/ctau')
-rw-r--r--sys/dev/ctau/ctddk.h1
-rw-r--r--sys/dev/ctau/if_ct.c19
2 files changed, 13 insertions, 7 deletions
diff --git a/sys/dev/ctau/ctddk.h b/sys/dev/ctau/ctddk.h
index 9962090..be0a092 100644
--- a/sys/dev/ctau/ctddk.h
+++ b/sys/dev/ctau/ctddk.h
@@ -412,6 +412,7 @@ typedef struct _ct_chan_t {
void *attach [NBUF]; /* system dependent data per buffer */
void *sys; /* system dependent data per channel */
int debug;
+ int debug_shadow;
int e1_first_int;
unsigned char *sccrx, *scctx; /* pointers to SCC rx and tx buffers */
diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c
index 25e927a..f2d876d 100644
--- a/sys/dev/ctau/if_ct.c
+++ b/sys/dev/ctau/if_ct.c
@@ -949,8 +949,8 @@ static int ct_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data)
if (! (ifp->if_flags & IFF_DEBUG))
d->chan->debug = 0;
- else if (! d->chan->debug)
- d->chan->debug = 1;
+ else
+ d->chan->debug = d->chan->debug_shadow;
switch (cmd) {
default: CT_DEBUG2 (d, ("ioctl 0x%lx\n", cmd)); return 0;
@@ -1529,12 +1529,17 @@ static int ct_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struc
error = priv_check (td, PRIV_DRIVER);
if (error)
return error;
- c->debug = *(int*)data;
#ifndef NETGRAPH
- if (d->chan->debug)
- d->ifp->if_flags |= IFF_DEBUG;
- else
- d->ifp->if_flags &= (~IFF_DEBUG);
+ /*
+ * The debug_shadow is always greater than zero for logic
+ * simplicity. For switching debug off the IFF_DEBUG is
+ * responsible.
+ */
+ c->debug_shadow = (*(int*)data) ? (*(int*)data) : 1;
+ if (d->ifp->if_flags & IFF_DEBUG)
+ c->debug = c->debug_shadow;
+#else
+ c->debug = *(int*)data;
#endif
return 0;
OpenPOWER on IntegriCloud