From 99de304d84f81ac086c22db51573c1a51e29ce63 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Tue, 7 Jan 2014 14:10:56 -0600 Subject: [PATCH] wcaxx, wcte13xp, wcte43x: Honor max_latency module parameter. The wcxb library did not do actually use the max_latency member to limit the maximum latency of the DMA engine. Now it does. Signed-off-by: Shaun Ruffell Signed-off-by: Russ Meyerriecks --- drivers/dahdi/wcxb.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/dahdi/wcxb.c b/drivers/dahdi/wcxb.c index a418447..191a0b0 100644 --- a/drivers/dahdi/wcxb.c +++ b/drivers/dahdi/wcxb.c @@ -401,16 +401,22 @@ static irqreturn_t _wcxb_isr(int irq, void *dev_id) spin_lock(&xb->lock); if (!xb->flags.latency_locked) { - xb->latency++; - + xb->latency = min(xb->latency + 1, + xb->max_latency); #ifdef HAVE_RATELIMIT if (__ratelimit(&_underrun_rl)) { #else if (printk_ratelimit()) { #endif - dev_info(&xb->pdev->dev, - "Underrun detected by hardware. Latency bumped to: %dms\n", - xb->latency); + if (xb->latency != xb->max_latency) { + dev_info(&xb->pdev->dev, + "Underrun detected by hardware. Latency bumped to: %dms\n", + xb->latency); + } else { + dev_info(&xb->pdev->dev, + "Underrun detected by hardware. Latency at max of %dms.\n", + xb->latency); + } } } @@ -602,6 +608,8 @@ int wcxb_init(struct wcxb *xb, const char *board_name, u32 int_mode) return -EINVAL; xb->latency = WCXB_DEFAULT_LATENCY; + xb->max_latency = WCXB_DEFAULT_MAXLATENCY; + spin_lock_init(&xb->lock); xb->membase = pci_iomap(pdev, 0, 0);