[dahdi-commits] sruffell: linux/trunk r10238 - /linux/trunk/drivers/dahdi/wct4xxp/base.c
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Thu Oct 20 15:52:38 CDT 2011
Author: sruffell
Date: Thu Oct 20 15:52:35 2011
New Revision: 10238
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10238
Log:
wct4xxp: Hold a pointer to the devtype directly
Eliminates the need to store a copy of the flags and variety from the
global devtype.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Michael Spiceland <mspiceland at digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>
Modified:
linux/trunk/drivers/dahdi/wct4xxp/base.c
Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=10238&r1=10237&r2=10238
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Thu Oct 20 15:52:35 2011
@@ -342,7 +342,7 @@
#endif
int irq; /* IRQ used by device */
int order; /* Order */
- int flags; /* Device flags */
+ const struct devtype *devtype;
unsigned int falc31 : 1; /* are we falc v3.1 (atomic not necessary) */
int ledreg; /* LED Register */
unsigned int gpio;
@@ -356,7 +356,6 @@
atomic_t worklist;
struct workqueue_struct *workq;
#endif
- char *variety;
int last0; /* for detecting double-missed IRQ */
/* DMA related fields */
@@ -1971,7 +1970,7 @@
for (x = 0; x < wc->numspans; x++) {
ts = wc->tspans[x];
- strlcpy(ts->span.devicetype, wc->variety,
+ strlcpy(ts->span.devicetype, wc->devtype->desc,
sizeof(ts->span.devicetype));
#ifdef VPM_SUPPORT
if (wc->vpm == T4_VPM_PRESENT) {
@@ -2189,13 +2188,13 @@
/* Configure ports */
t4_framer_out(wc, unit, 0x80, 0x00); /* PC1: SPYR/SPYX input on RPA/XPA */
if (wc->falc31) {
- t4_framer_out(wc, unit, 0x81, 0xBB); /* PC2: RMFB/XSIG output/input on RPB/XPB */
- t4_framer_out(wc, unit, 0x82, 0xBB); /* PC3: Some unused stuff */
- t4_framer_out(wc, unit, 0x83, 0xBB); /* PC4: Some more unused stuff */
+ t4_framer_out(wc, unit, 0x81, 0xBB);
+ t4_framer_out(wc, unit, 0x82, 0xBB);
+ t4_framer_out(wc, unit, 0x83, 0xBB);
} else {
- t4_framer_out(wc, unit, 0x81, 0x22); /* PC2: RMFB/XSIG output/input on RPB/XPB */
- t4_framer_out(wc, unit, 0x82, 0x65); /* PC3: Some unused stuff */
- t4_framer_out(wc, unit, 0x83, 0x35); /* PC4: Some more unused stuff */
+ t4_framer_out(wc, unit, 0x81, 0x22);
+ t4_framer_out(wc, unit, 0x82, 0x65);
+ t4_framer_out(wc, unit, 0x83, 0x35);
}
t4_framer_out(wc, unit, 0x84, 0x01); /* PC5: XMFS active low, SCLKR is input, RCLK is output */
if (debug & DEBUG_MAIN)
@@ -2212,7 +2211,6 @@
{
int cmr1 = 0x38; /* Clock Mode: RCLK sourced by DCO-R1
by default, Disable Clock-Switching */
-
cmr1 |= (span << 6);
__t4_framer_out(wc, 0, 0x44, cmr1);
@@ -2674,7 +2672,7 @@
span->flags |= DAHDI_FLAG_RUNNING;
wc->spansstarted++;
- if (wc->flags & FLAG_5THGEN)
+ if (wc->devtype->flags & FLAG_5THGEN)
__t4_pci_out(wc, 5, (ms_per_irq << 16) | wc->numbufs);
/* enable interrupts */
/* Start DMA, enabling DMA interrupts on read only */
@@ -3812,7 +3810,7 @@
}
wc->intcount++;
- if ((wc->flags & FLAG_5THGEN) && (status & 0x2)) {
+ if ((wc->devtype->flags & FLAG_5THGEN) && (status & 0x2)) {
rxident = (status >> 16) & 0x7f;
expected = (wc->rxident + ms_per_irq) % 128;
@@ -3900,7 +3898,7 @@
dev_info(&wc->dev->dev, "Reg 5 is %08x\n", reg5);
#endif
- if (wc->flags & FLAG_5THGEN) {
+ if (wc->devtype->flags & FLAG_5THGEN) {
unsigned int current_index = (reg5 >> 8) & 0x7f;
#if 0
int catchup = 0;
@@ -4426,7 +4424,7 @@
#if defined(CONFIG_FORCE_EXTENDED_RESET)
t4_extended_reset(wc);
#elif !defined(CONFIG_NOEXTENDED_RESET)
- if (wc->flags & FLAG_EXPRESS)
+ if (wc->devtype->flags & FLAG_EXPRESS)
t4_extended_reset(wc);
#endif
@@ -4614,7 +4612,6 @@
{
int res;
struct t4 *wc;
- struct devtype *dt;
unsigned int x, f;
int init_latency;
@@ -4628,16 +4625,12 @@
memset(wc, 0x0, sizeof(*wc));
spin_lock_init(&wc->reglock);
- dt = (struct devtype *) (ent->driver_data);
-
- wc->flags = dt->flags;
-
- if (wc->flags & FLAG_2PORT)
+ wc->devtype = (const struct devtype *)(ent->driver_data);
+
+ if (wc->devtype->flags & FLAG_2PORT)
wc->numspans = 2;
else
wc->numspans = 4;
-
- wc->variety = dt->desc;
wc->membase = pci_iomap(pdev, 0, 0);
/* This rids of the Double missed interrupt message after loading */
@@ -4647,7 +4640,7 @@
dev_info(&wc->dev->dev, "wct4: Unable to request memory "
"region :(, using anyway...\n");
#endif
- if (pci_request_regions(pdev, wc->variety))
+ if (pci_request_regions(pdev, wc->devtype->desc))
dev_info(&pdev->dev, "wct%dxxp: Unable to request regions\n",
wc->numspans);
@@ -4662,7 +4655,7 @@
/* Keep track of which device we are */
pci_set_drvdata(pdev, wc);
- if (wc->flags & FLAG_5THGEN) {
+ if (wc->devtype->flags & FLAG_5THGEN) {
if ((ms_per_irq > 1) && (latency <= ((ms_per_irq) << 1))) {
init_latency = ms_per_irq << 1;
} else {
@@ -4674,7 +4667,7 @@
dev_info(&wc->dev->dev, "5th gen card with initial latency of "
"%d and %d ms per IRQ\n", init_latency, ms_per_irq);
} else {
- if (wc->flags & FLAG_2NDGEN)
+ if (wc->devtype->flags & FLAG_2NDGEN)
init_latency = 1;
else
init_latency = 2;
@@ -4690,7 +4683,7 @@
}
/* Initialize hardware */
- t4_hardware_init_1(wc, wc->flags);
+ t4_hardware_init_1(wc, wc->devtype->flags);
for(x = 0; x < MAX_T4_CARDS; x++) {
if (!cards[x])
@@ -4707,7 +4700,7 @@
cards[x] = wc;
#ifdef ENABLE_WORKQUEUES
- if (wc->flags & FLAG_2NDGEN) {
+ if (wc->devtype->flags & FLAG_2NDGEN) {
char tmp[20];
sprintf(tmp, "te%dxxp[%d]", wc->numspans, wc->num);
@@ -4749,14 +4742,17 @@
#ifdef ENABLE_WORKQUEUES
INIT_WORK(&wc->tspans[x]->swork, workq_handlespan, wc->tspans[x]);
#endif
- wc->tspans[x]->spanflags |= wc->flags;
+ wc->tspans[x]->spanflags |= wc->devtype->flags;
}
/* Continue hardware intiialization */
t4_hardware_init_2(wc);
#ifdef SUPPORT_GEN1
- if (request_irq(pdev->irq, (wc->flags & FLAG_2NDGEN) ? t4_interrupt_gen2 : t4_interrupt, DAHDI_IRQ_SHARED_DISABLED, (wc->numspans == 2) ? "wct2xxp" : "wct4xxp", wc))
+ if (request_irq(pdev->irq, (wc->devtype->flags & FLAG_2NDGEN) ?
+ t4_interrupt_gen2 : t4_interrupt,
+ DAHDI_IRQ_SHARED_DISABLED,
+ (wc->numspans == 2) ? "wct2xxp" : "wct4xxp", wc))
#else
if (!(wc->tspans[0]->spanflags & FLAG_2NDGEN)) {
dev_notice(&wc->dev->dev, "This driver does not "
@@ -4778,7 +4774,7 @@
if (!ignore_rotary)
wct4xxp_sort_cards();
- dev_info(&wc->dev->dev, "Found a Wildcard: %s\n", wc->variety);
+ dev_info(&wc->dev->dev, "Found a Wildcard: %s\n", wc->devtype->desc);
wc->gpio = 0x00000000;
t4_pci_out(wc, WC_GPIO, wc->gpio);
t4_gpio_setdir(wc, (1 << 17), (1 << 17));
More information about the dahdi-commits
mailing list