From 8682c2a90bd996765326fb6477a2466b63530b73 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Mon, 26 Jul 2010 00:30:39 +0000 Subject: 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 --- drivers/dahdi/dahdi_dynamic.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/dahdi/dahdi_dynamic.c') 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; -- cgit v1.2.3