summaryrefslogtreecommitdiff
path: root/drivers/dahdi/dahdi_dynamic.c
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/dahdi_dynamic.c
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/dahdi_dynamic.c')
-rw-r--r--drivers/dahdi/dahdi_dynamic.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/dahdi/dahdi_dynamic.c b/drivers/dahdi/dahdi_dynamic.c
index f914e21..9b2542c 100644
--- a/drivers/dahdi/dahdi_dynamic.c
+++ b/drivers/dahdi/dahdi_dynamic.c
@@ -267,9 +267,14 @@ static void ztdynamic_run(void)
#define ztdynamic_run __ztdynamic_run
#endif
+static inline struct dahdi_dynamic *dynamic_from_span(struct dahdi_span *span)
+{
+ return container_of(span, struct dahdi_dynamic, span);
+}
+
void dahdi_dynamic_receive(struct dahdi_span *span, unsigned char *msg, int msglen)
{
- struct dahdi_dynamic *ztd = span->pvt;
+ struct dahdi_dynamic *ztd = dynamic_from_span(span);
int newerr=0;
int sflags;
int xlen;
@@ -497,8 +502,7 @@ static int ztd_rbsbits(struct dahdi_chan *chan, int bits)
static int ztd_open(struct dahdi_chan *chan)
{
- struct dahdi_dynamic *z;
- z = chan->span->pvt;
+ struct dahdi_dynamic *z = dynamic_from_span(chan->span);
if (likely(z)) {
if (unlikely(z->dead))
return -ENODEV;
@@ -514,8 +518,7 @@ static int ztd_chanconfig(struct dahdi_chan *chan, int sigtype)
static int ztd_close(struct dahdi_chan *chan)
{
- struct dahdi_dynamic *z;
- z = chan->span->pvt;
+ struct dahdi_dynamic *z = dynamic_from_span(chan->span);
if (z) {
z->usecount--;
if (z->dead && !z->usecount)
@@ -584,7 +587,6 @@ static int create_dynamic(struct dahdi_dynamic_span *zds)
sprintf(z->span.desc, "Dynamic '%s' span at '%s'", zds->driver, zds->addr);
z->span.owner = THIS_MODULE;
z->span.channels = zds->numchans;
- z->span.pvt = z;
z->span.deflaw = DAHDI_LAW_MULAW;
z->span.flags |= DAHDI_FLAG_RBS;
z->span.chans = z->chans;