summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wctdm24xxp
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-07-26 00:30:39 +0000
committerShaun Ruffell <sruffell@digium.com>2010-07-26 00:30:39 +0000
commit8682c2a90bd996765326fb6477a2466b63530b73 (patch)
tree384ce57c53c650294c490cda43b5ea7e624685cc /drivers/dahdi/wctdm24xxp
parent5c45b4da59502f5a30f3eb01e431d92d3d1c2202 (diff)
dahdi: Remove the 'pvt' member from dahdi_span.
The vast majority of board drivers already keep the dahdi_span structure in a driver specific structure. The others were easily converted. This way board drivers can use the container_of macro to find what was previously pointed to by the "pvt" member of the span. One less thing to think about in the span structure. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8984 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wctdm24xxp')
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c11
-rw-r--r--drivers/dahdi/wctdm24xxp/wctdm24xxp.h1
-rw-r--r--drivers/dahdi/wctdm24xxp/xhfc.c34
-rw-r--r--drivers/dahdi/wctdm24xxp/xhfc.h1
4 files changed, 22 insertions, 25 deletions
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index 92b5b50..99236fa 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -3312,9 +3312,15 @@ static int wctdm_open(struct dahdi_chan *chan)
return 0;
}
+static inline struct wctdm *span_to_wctdm(struct dahdi_span *span)
+{
+ struct wctdm_span *s = container_of(span, struct wctdm_span, span);
+ return s->wc;
+}
+
static int wctdm_watchdog(struct dahdi_span *span, int event)
{
- struct wctdm *wc = span->pvt;
+ struct wctdm *wc = span_to_wctdm(span);
dev_info(&wc->vb.pdev->dev, "TDM: Called watchdog\n");
return 0;
}
@@ -3609,6 +3615,7 @@ static struct wctdm_span *wctdm_init_span(struct wctdm *wc, int spanno, int chan
s->span.offset = spanno;
s->spanno = spancount++;
+ s->wc = wc;
/* Do not change the procfs representation for non-hx8 cards. */
if (digital_span)
@@ -4787,7 +4794,6 @@ __wctdm_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return -EIO;
}
b4 = wc->mods[i].bri;
- b400m_set_dahdi_span(b4, i & 0x03, &wc->spans[curspan]->span);
++curspan;
curchan += 3;
@@ -4822,7 +4828,6 @@ __wctdm_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
wctdm_init_span(wc, curspan, curchan, wc->desc->ports, 0);
wctdm_fixup_analog_span(wc, curspan);
wc->aspan = wc->spans[curspan];
- wc->aspan->span.pvt = wc;
curchan += wc->desc->ports;
++curspan;
}
diff --git a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
index 58b1907..beb929f 100644
--- a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
+++ b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
@@ -155,6 +155,7 @@ struct wctdm_span {
struct dahdi_span span;
int timing_priority;
int spanno;
+ struct wctdm *wc;
};
struct wctdm_chan {
diff --git a/drivers/dahdi/wctdm24xxp/xhfc.c b/drivers/dahdi/wctdm24xxp/xhfc.c
index 500cdf7..9380ed5 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; /* pointer to the actual dahdi_span */
+ struct dahdi_span span; /* 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,13 +603,6 @@ 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 dahdi_span *span)
-{
- span->pvt = &b4->spans[spanno];
- b4->spans[spanno].span = span;
-}
-
static inline void flush_hw(void)
{
}
@@ -1446,11 +1439,11 @@ static void hfc_update_st_timers(struct b400m *b4)
hfc_timer_expire(s, j);
}
- if (s->span && s->newalarm != s->span->alarms &&
+ if (s->newalarm != s->span.alarms &&
time_after_eq(b4->ticks, s->alarmtimer)) {
- s->span->alarms = s->newalarm;
+ s->span.alarms = s->newalarm;
if ((!s->newalarm && bri_teignorered) || (!bri_teignorered))
- dahdi_alarm_notify(s->span);
+ dahdi_alarm_notify(&s->span);
if (DBG_ALARM) {
dev_info(&b4->wc->vb.pdev->dev, "span %d: alarm " \
@@ -1610,9 +1603,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->span.alarms = DAHDI_ALARM_RED;
s->newalarm = DAHDI_ALARM_RED;
- dahdi_alarm_notify(s->span);
+ dahdi_alarm_notify(&s->span);
/* set up the clock control register. Must be done before we activate
* the interface. */
@@ -2060,7 +2053,7 @@ static void xhfc_init_stage2(struct b400m *b4)
static int xhfc_startup(struct dahdi_span *span)
{
- struct b400m_span *bspan = span->pvt;
+ struct b400m_span *bspan = container_of(span, struct b400m_span, span);
struct b400m *b4 = bspan->parent;
if (!b4->running)
hfc_enable_interrupts(bspan->parent);
@@ -2177,7 +2170,7 @@ int b400m_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
int te_mode, term;
int pos;
- bspan = span->pvt;
+ bspan = container_of(span, struct b400m_span, span);
b4 = bspan->parent;
wc = b4->wc;
@@ -2218,7 +2211,6 @@ int b400m_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
wc->spans[pos]->timing_priority = lc->sync;
- bspan->span = span;
xhfc_reset_span(bspan);
/* call startup() manually here, because DAHDI won't call the startup
@@ -2247,11 +2239,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 = chan->span->pvt;
+ struct b400m_span *bspan = container_of(chan->span, struct b400m_span, span);
struct b400m *b4 = bspan->parent;
int res;
- alreadyrunning = bspan->span->flags & DAHDI_FLAG_RUNNING;
+ alreadyrunning = bspan->span.flags & DAHDI_FLAG_RUNNING;
if (DBG_FOPS) {
b4_info(b4, "%s channel %d (%s) sigtype %08x\n",
@@ -2294,7 +2286,7 @@ int b400m_dchan(struct dahdi_span *span)
int res;
int i;
- bspan = span->pvt;
+ bspan = container_of(span, struct b400m_span, span);
b4 = bspan->parent;
#ifdef HARDHDLC_RX
return 0;
@@ -2518,7 +2510,7 @@ void wctdm_hdlc_hard_xmit(struct dahdi_chan *chan)
int span;
dspan = chan->span;
- bspan = dspan->pvt;
+ bspan = container_of(dspan, struct b400m_span, span);
b4 = bspan->parent;
wc = b4->wc;
span = bspan->port;
@@ -2719,7 +2711,7 @@ void wctdm_unload_b400m(struct wctdm *wc, int card)
}
for (i = 0; i < 4; i++)
- b4->spans[i].span->flags &= ~DAHDI_FLAG_RUNNING;
+ b4->spans[i].span.flags &= ~DAHDI_FLAG_RUNNING;
wctdm_change_card_sync_src(b4->wc, 0, 0);
diff --git a/drivers/dahdi/wctdm24xxp/xhfc.h b/drivers/dahdi/wctdm24xxp/xhfc.h
index 2699175..685809b 100644
--- a/drivers/dahdi/wctdm24xxp/xhfc.h
+++ b/drivers/dahdi/wctdm24xxp/xhfc.h
@@ -42,7 +42,6 @@ int b400m_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc);
int b400m_dchan(struct dahdi_span *span);
int b400m_chanconfig(struct dahdi_chan *chan, int sigtype);
void b400m_post_init(struct b400m *b4);
-void b400m_set_dahdi_span(struct b400m *b4, int spanno, struct dahdi_span *span);
void b400m_module_init(void);
void b400m_module_cleanup(void);