summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wctdm24xxp/xhfc.c
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-08-04 00:18:49 +0000
committerShaun Ruffell <sruffell@digium.com>2010-08-04 00:18:49 +0000
commit78fdae3b7d38341d69e71b3c1390fc1a913815a2 (patch)
tree6aa78601d0d33b995300deb6ae8fd1654a4d176a /drivers/dahdi/wctdm24xxp/xhfc.c
parent0de45c565458d8849a455c11fcc023620e0c52d3 (diff)
wctdm24xxp: 'struct dahdi_span' is already embedded in the 'struct wctdm_span'.
We cannot also embed it in struct b400m_span structure and expect container_of to work. This fixes a regression introduced in r8984. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9087 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wctdm24xxp/xhfc.c')
-rw-r--r--drivers/dahdi/wctdm24xxp/xhfc.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/drivers/dahdi/wctdm24xxp/xhfc.c b/drivers/dahdi/wctdm24xxp/xhfc.c
index 9380ed5..2dd102d 100644
--- a/drivers/dahdi/wctdm24xxp/xhfc.c
+++ b/drivers/dahdi/wctdm24xxp/xhfc.c
@@ -550,7 +550,7 @@ struct b400m_span {
int fifos[B400M_CHANNELS_PER_SPAN]; /* B1, B2, D <--> host fifo numbers */
/* HDLC controller fields */
- struct dahdi_span span; /* The actual dahdi_span */
+ struct wctdm_span *wspan; /* pointer to the actual dahdi_span */
struct dahdi_chan *sigchan; /* pointer to the signalling channel for this span */
int sigactive; /* nonzero means we're in the middle of sending an HDLC frame */
atomic_t hdlc_pending; /* hdlc_hard_xmit() increments, hdlc_tx_frame() decrements */
@@ -603,6 +603,13 @@ struct b400m {
static void hfc_start_st(struct b400m_span *s);
static void hfc_stop_st(struct b400m_span *s);
+void b400m_set_dahdi_span(struct b400m *b4, int spanno,
+ struct wctdm_span *wspan)
+{
+ b4->spans[spanno].wspan = wspan;
+ wspan->bspan = &b4->spans[spanno];
+}
+
static inline void flush_hw(void)
{
}
@@ -1439,11 +1446,11 @@ static void hfc_update_st_timers(struct b400m *b4)
hfc_timer_expire(s, j);
}
- if (s->newalarm != s->span.alarms &&
+ if (s->wspan && s->newalarm != s->wspan->span.alarms &&
time_after_eq(b4->ticks, s->alarmtimer)) {
- s->span.alarms = s->newalarm;
+ s->wspan->span.alarms = s->newalarm;
if ((!s->newalarm && bri_teignorered) || (!bri_teignorered))
- dahdi_alarm_notify(&s->span);
+ dahdi_alarm_notify(&s->wspan->span);
if (DBG_ALARM) {
dev_info(&b4->wc->vb.pdev->dev, "span %d: alarm " \
@@ -1603,9 +1610,9 @@ static void hfc_reset_st(struct b400m_span *s)
b400m_setreg_ra(b4, R_SU_SEL, s->port, A_SU_WR_STA, V_SU_LD_STA);
flush_hw(); /* make sure write hit hardware */
- s->span.alarms = DAHDI_ALARM_RED;
+ s->wspan->span.alarms = DAHDI_ALARM_RED;
s->newalarm = DAHDI_ALARM_RED;
- dahdi_alarm_notify(&s->span);
+ dahdi_alarm_notify(&s->wspan->span);
/* set up the clock control register. Must be done before we activate
* the interface. */
@@ -2051,9 +2058,14 @@ static void xhfc_init_stage2(struct b400m *b4)
*/
}
+static inline struct b400m_span *bspan_from_dspan(struct dahdi_span *span)
+{
+ return container_of(span, struct wctdm_span, span)->bspan;
+}
+
static int xhfc_startup(struct dahdi_span *span)
{
- struct b400m_span *bspan = container_of(span, struct b400m_span, span);
+ struct b400m_span *bspan = bspan_from_dspan(span);
struct b400m *b4 = bspan->parent;
if (!b4->running)
hfc_enable_interrupts(bspan->parent);
@@ -2170,7 +2182,7 @@ int b400m_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
int te_mode, term;
int pos;
- bspan = container_of(span, struct b400m_span, span);
+ bspan = bspan_from_dspan(span);
b4 = bspan->parent;
wc = b4->wc;
@@ -2211,6 +2223,7 @@ int b400m_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
wc->spans[pos]->timing_priority = lc->sync;
+ bspan->wspan = container_of(span, struct wctdm_span, span);
xhfc_reset_span(bspan);
/* call startup() manually here, because DAHDI won't call the startup
@@ -2239,11 +2252,11 @@ int b400m_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
int b400m_chanconfig(struct dahdi_chan *chan, int sigtype)
{
int alreadyrunning;
- struct b400m_span *bspan = container_of(chan->span, struct b400m_span, span);
+ struct b400m_span *bspan = bspan_from_dspan(chan->span);
struct b400m *b4 = bspan->parent;
int res;
- alreadyrunning = bspan->span.flags & DAHDI_FLAG_RUNNING;
+ alreadyrunning = bspan->wspan->span.flags & DAHDI_FLAG_RUNNING;
if (DBG_FOPS) {
b4_info(b4, "%s channel %d (%s) sigtype %08x\n",
@@ -2286,7 +2299,7 @@ int b400m_dchan(struct dahdi_span *span)
int res;
int i;
- bspan = container_of(span, struct b400m_span, span);
+ bspan = bspan_from_dspan(span);
b4 = bspan->parent;
#ifdef HARDHDLC_RX
return 0;
@@ -2510,7 +2523,7 @@ void wctdm_hdlc_hard_xmit(struct dahdi_chan *chan)
int span;
dspan = chan->span;
- bspan = container_of(dspan, struct b400m_span, span);
+ bspan = bspan_from_dspan(dspan);
b4 = bspan->parent;
wc = b4->wc;
span = bspan->port;
@@ -2710,8 +2723,8 @@ void wctdm_unload_b400m(struct wctdm *wc, int card)
wc->spans[i]->timing_priority = 0;
}
- for (i = 0; i < 4; i++)
- b4->spans[i].span.flags &= ~DAHDI_FLAG_RUNNING;
+ for (i = 0; i < ARRAY_SIZE(b4->spans); i++)
+ b4->spans[i].wspan->span.flags &= ~DAHDI_FLAG_RUNNING;
wctdm_change_card_sync_src(b4->wc, 0, 0);