From db5ce0faef41095d4fbf9804031931f8e886b2a1 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 8 Sep 2010 13:34:58 +0300 Subject: remove 'pvt' member of dahdi_span r8984 removed the member 'pvt' of struct dahdi_span in dahdi/kernel.h . No use to have a pointer to a struct that is already embedded in our struct. Thus we remove a single usage of it and replace it with container_of(). --- drivers/dahdi/opvxa1200.c | 7 +++++-- drivers/dahdi/wcopenpci.c | 7 +++++-- drivers/dahdi/zaphfc/base.c | 3 +-- drivers/dahdi/zaphfc/zaphfc.h | 4 ++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/dahdi/opvxa1200.c b/drivers/dahdi/opvxa1200.c index 8a5193e..77a1e02 100644 --- a/drivers/dahdi/opvxa1200.c +++ b/drivers/dahdi/opvxa1200.c @@ -2267,10 +2267,14 @@ static int wctdm_open(struct dahdi_chan *chan) return 0; } +static inline struct wctdm* wctdm_from_span(struct dahdi_span *span) { + return container_of(span, struct wctdm, span); +} + static int wctdm_watchdog(struct dahdi_span *span, int event) { printk(KERN_INFO "opvxa1200: Restarting DMA\n"); - wctdm_restart_dma(span->pvt); + wctdm_restart_dma(wctdm_from_span(span)); return 0; } @@ -2412,7 +2416,6 @@ static int wctdm_initialize(struct wctdm *wc) wc->span.watchdog = wctdm_watchdog; init_waitqueue_head(&wc->span.maintq); - wc->span.pvt = wc; if (dahdi_register(&wc->span, 0)) { printk(KERN_NOTICE "Unable to register span with Dahdi\n"); return -1; diff --git a/drivers/dahdi/wcopenpci.c b/drivers/dahdi/wcopenpci.c index b28cac4..9e28279 100644 --- a/drivers/dahdi/wcopenpci.c +++ b/drivers/dahdi/wcopenpci.c @@ -1158,10 +1158,14 @@ static int openpci_open(struct dahdi_chan *chan) return 0; } +static inline struct openpci* openpci_from_span(struct dahdi_span *span) { + return container_of(span, struct openpci, span); +} + static int openpci_watchdog(struct dahdi_span *span, int event) { info("TDM: Restarting DMA"); - restart_dma(span->pvt); + restart_dma(openpci_from_span(span)); return 0; } @@ -1321,7 +1325,6 @@ static int span_initialize(struct openpci *wc) wc->span.watchdog = openpci_watchdog; init_waitqueue_head(&wc->span.maintq); - wc->span.pvt = wc; if (dahdi_register(&wc->span, 0)) { cardcrit(wc->boardnum, "Unable to register span with dahdi"); return RET_FAIL; diff --git a/drivers/dahdi/zaphfc/base.c b/drivers/dahdi/zaphfc/base.c index 049a37b..4db6736 100644 --- a/drivers/dahdi/zaphfc/base.c +++ b/drivers/dahdi/zaphfc/base.c @@ -592,7 +592,7 @@ static void hfc_hdlc_hard_xmit(struct dahdi_chan *d_chan) static int hfc_zap_startup(struct dahdi_span *span) { - struct dahdi_hfc *zthfc = span->pvt; + struct dahdi_hfc *zthfc = dahdi_hfc_from_span(span); struct hfc_card *hfctmp = zthfc->card; int alreadyrunning; @@ -682,7 +682,6 @@ static int hfc_zap_initialize(struct dahdi_hfc *hfccard) hfccard->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_CCS; hfccard->span.offset = 0; init_waitqueue_head(&hfccard->span.maintq); - hfccard->span.pvt = hfccard; for (i = 0; i < hfccard->span.channels; i++) { memset(&hfccard->chans[i], 0x0, sizeof(struct dahdi_chan)); diff --git a/drivers/dahdi/zaphfc/zaphfc.h b/drivers/dahdi/zaphfc/zaphfc.h index c9353cc..29dd304 100644 --- a/drivers/dahdi/zaphfc/zaphfc.h +++ b/drivers/dahdi/zaphfc/zaphfc.h @@ -401,6 +401,10 @@ typedef struct dahdi_hfc { } dahdi_hfc; +static inline struct dahdi_hfc* dahdi_hfc_from_span(struct dahdi_span *span) { + return container_of(span, struct dahdi_hfc, span); +} + static inline u8 hfc_inb(struct hfc_card *card, int offset) { return readb(card->io_mem + offset); -- cgit v1.2.3