wct4xxp: Move bottom half processing from tasklet to workqueue.
I am primarily making this change in order that the oct612x API can use a mutex as a synchronization primitive. Mutexes can only be aquired in process context and the wct4xxp driver calls the Oct61000InterruptServiceRoutine (which grabs a serialization object) when tone detection is enabled. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
This commit is contained in:
parent
a3578ca156
commit
b4941f35ad
@ -371,9 +371,14 @@ struct t4 {
|
||||
dma_addr_t writedma;
|
||||
void __iomem *membase; /* Base address of card */
|
||||
|
||||
/* Flags for our bottom half */
|
||||
#define T4_CHECK_VPM 0
|
||||
#define T4_LOADING_FW 1
|
||||
#define T4_STOP_DMA 2
|
||||
#define T4_CHECK_TIMING 3
|
||||
#define T4_CHANGE_LATENCY 4
|
||||
#define T4_IGNORE_LATENCY 5
|
||||
unsigned long checkflag;
|
||||
struct tasklet_struct t4_tlet;
|
||||
struct work_struct bh_work;
|
||||
/* Latency related additions */
|
||||
unsigned char rxident;
|
||||
unsigned char lastindex;
|
||||
@ -549,8 +554,6 @@ static void t4_check_sigbits(struct t4 *wc, int span);
|
||||
|
||||
#define MAX_T4_CARDS 64
|
||||
|
||||
static void t4_isr_bh(unsigned long data);
|
||||
|
||||
static struct t4 *cards[MAX_T4_CARDS];
|
||||
|
||||
struct t8_firm_header {
|
||||
@ -2116,6 +2119,8 @@ static void free_wc(struct t4 *wc)
|
||||
{
|
||||
unsigned int x, y;
|
||||
|
||||
flush_scheduled_work();
|
||||
|
||||
for (x = 0; x < ARRAY_SIZE(wc->tspans); x++) {
|
||||
if (!wc->tspans[x])
|
||||
continue;
|
||||
@ -4056,9 +4061,15 @@ static void t4_increase_latency(struct t4 *wc, int newlatency)
|
||||
|
||||
}
|
||||
|
||||
static void t4_isr_bh(unsigned long data)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void t4_work_func(void *data)
|
||||
{
|
||||
struct t4 *wc = (struct t4 *)data;
|
||||
struct t4 *wc = data;
|
||||
#else
|
||||
static void t4_work_func(struct work_struct *work)
|
||||
{
|
||||
struct t4 *wc = container_of(work, struct t4, bh_work);
|
||||
#endif
|
||||
|
||||
if (test_bit(T4_CHANGE_LATENCY, &wc->checkflag)) {
|
||||
if (wc->needed_latency != wc->numbufs) {
|
||||
@ -4265,7 +4276,7 @@ static irqreturn_t _t4_interrupt_gen2(int irq, void *dev_id)
|
||||
|
||||
out:
|
||||
if (unlikely(test_bit(T4_CHANGE_LATENCY, &wc->checkflag) || test_bit(T4_CHECK_VPM, &wc->checkflag)))
|
||||
tasklet_schedule(&wc->t4_tlet);
|
||||
schedule_work(&wc->bh_work);
|
||||
|
||||
#ifndef ENABLE_WORKQUEUES
|
||||
__t4_pci_out(wc, WC_INTR, 0);
|
||||
@ -5146,7 +5157,11 @@ static int __devinit t4_launch(struct t4 *wc)
|
||||
&wc->ddev->spans);
|
||||
}
|
||||
|
||||
tasklet_init(&wc->t4_tlet, t4_isr_bh, (unsigned long)wc);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&wc->bh_work, t4_work_func, wc);
|
||||
#else
|
||||
INIT_WORK(&wc->bh_work, t4_work_func);
|
||||
#endif
|
||||
|
||||
res = dahdi_register_device(wc->ddev, &wc->dev->dev);
|
||||
if (res) {
|
||||
|
@ -131,13 +131,6 @@ struct t4_reg {
|
||||
unsigned int val;
|
||||
};
|
||||
|
||||
#define T4_CHECK_VPM 0
|
||||
#define T4_LOADING_FW 1
|
||||
#define T4_STOP_DMA 2
|
||||
#define T4_CHECK_TIMING 3
|
||||
#define T4_CHANGE_LATENCY 4
|
||||
#define T4_IGNORE_LATENCY 5
|
||||
|
||||
#define WCT4_GET_REGS _IOW(DAHDI_CODE, 60, struct t4_regs)
|
||||
#define WCT4_GET_REG _IOW(DAHDI_CODE, 61, struct t4_reg)
|
||||
#define WCT4_SET_REG _IOW(DAHDI_CODE, 62, struct t4_reg)
|
||||
|
Loading…
Reference in New Issue
Block a user