From feac553f9f107e630f79d2170178dd6715d1d3d2 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Wed, 20 Oct 2010 12:23:16 +0000 Subject: dahdi: Atomically set/test if channel has associated network device. Push all tests for the DAHDI_FLAGBIT_NETDEV flag behind a 'dahdi_have_netdev' function so if CONFIG_DAHDI_NET is not defined the compiler can just remove all the flag tests. Also, makes sure that the bit is checked / set atomically. (closes issue #9379) Signed-off-by: Shaun Ruffell Acked-by: Kinsey Moore Acked-by: Russ Meyerriecks git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9444 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- include/dahdi/kernel.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include/dahdi') diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 6edddbd..cf9ee3c 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -692,7 +692,9 @@ enum { DAHDI_FLAGBIT_MFDECODE = 3, /*!< Channel supports native MFr2 decode */ DAHDI_FLAGBIT_ECHOCANCEL= 4, /*!< Channel supports native echo cancellation */ DAHDI_FLAGBIT_HDLC = 5, /*!< Perform HDLC */ +#ifdef CONFIG_DAHDI_NET DAHDI_FLAGBIT_NETDEV = 6, /*!< Send to network */ +#endif DAHDI_FLAGBIT_CLEAR = 8, /*!< Clear channel */ DAHDI_FLAGBIT_AUDIO = 9, /*!< Audio mode channel */ DAHDI_FLAGBIT_OPEN = 10, /*!< Channel is open */ @@ -708,6 +710,20 @@ enum { DAHDI_FLAGBIT_HDLC56 = 20, /*!< Sets the given channel (if in HDLC mode) to use 56K HDLC instead of 64K */ }; +#ifdef CONFIG_DAHDI_NET +/** + * have_netdev() - Return true if a channel has an associated network device. + * @chan: Then channel to check. + * + */ +static inline int dahdi_have_netdev(const struct dahdi_chan *chan) +{ + return test_bit(DAHDI_FLAGBIT_NETDEV, &chan->flags); +} +#else +static inline int dahdi_have_netdev(const struct dahdi_chan *chan) { return 0; } +#endif + struct dahdi_count { __u32 fe; /*!< Framing error counter */ __u32 cv; /*!< Coding violations counter */ @@ -740,7 +756,7 @@ struct dahdi_count { #define DAHDI_FLAG_ECHOCANCEL DAHDI_FLAG(ECHOCANCEL) #define DAHDI_FLAG_HDLC DAHDI_FLAG(HDLC) -#define DAHDI_FLAG_NETDEV DAHDI_FLAG(NETDEV) +/* #define DAHDI_FLAG_NETDEV DAHDI_FLAG(NETDEV) */ #define DAHDI_FLAG_CLEAR DAHDI_FLAG(CLEAR) #define DAHDI_FLAG_AUDIO DAHDI_FLAG(AUDIO) -- cgit v1.2.3