wctc4xxp: channel count does not need to be atomic.

It is only modified under the chanlock anyway.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
This commit is contained in:
Shaun Ruffell 2014-05-09 16:09:41 -05:00 committed by Russ Meyerriecks
parent 354d88cd41
commit b6a8623203

View File

@ -355,7 +355,7 @@ struct wcdte {
struct napi_struct napi; struct napi_struct napi;
#endif #endif
struct timer_list watchdog; struct timer_list watchdog;
atomic_t open_channels; u16 open_channels;
#if HZ > 100 #if HZ > 100
unsigned long jiffies_at_last_poll; unsigned long jiffies_at_last_poll;
#endif #endif
@ -1744,9 +1744,6 @@ do_channel_allocate(struct dahdi_transcoder_channel *dtc)
u8 wctc4xxp_dstfmt; /* Digium Transcoder Engine Dest Format */ u8 wctc4xxp_dstfmt; /* Digium Transcoder Engine Dest Format */
int res; int res;
if (mutex_lock_interruptible(&wc->chanlock))
return -EINTR;
/* Check again to see if the channel was built after grabbing the /* Check again to see if the channel was built after grabbing the
* channel lock, in case the previous holder of the lock * channel lock, in case the previous holder of the lock
* built this channel as a complement to itself. */ * built this channel as a complement to itself. */
@ -1837,8 +1834,8 @@ wctc4xxp_operation_allocate(struct dahdi_transcoder_channel *dtc)
goto error_exit; goto error_exit;
} }
atomic_inc(&wc->open_channels); ++wc->open_channels;
if (atomic_read(&wc->open_channels) > POLLING_CALL_THRESHOLD) { if (wc->open_channels > POLLING_CALL_THRESHOLD) {
if (!test_bit(DTE_POLLING, &wc->flags)) if (!test_bit(DTE_POLLING, &wc->flags))
wctc4xxp_enable_polling(wc); wctc4xxp_enable_polling(wc);
} }
@ -1846,9 +1843,10 @@ wctc4xxp_operation_allocate(struct dahdi_transcoder_channel *dtc)
if (dahdi_tc_is_built(dtc)) { if (dahdi_tc_is_built(dtc)) {
DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP,
"Allocating channel %p which is already built.\n", dtc); "Allocating channel %p which is already built.\n", dtc);
return 0; res = 0;
} } else {
res = do_channel_allocate(dtc); res = do_channel_allocate(dtc);
}
error_exit: error_exit:
mutex_unlock(&wc->chanlock); mutex_unlock(&wc->chanlock);
@ -1894,14 +1892,16 @@ wctc4xxp_operation_release(struct dahdi_transcoder_channel *dtc)
goto error_exit; goto error_exit;
} }
atomic_dec(&wc->open_channels); if (wc->open_channels) {
--wc->open_channels;
#if !defined(CONFIG_WCTC4XXP_POLLING) #if !defined(CONFIG_WCTC4XXP_POLLING)
if (atomic_read(&wc->open_channels) < POLLING_CALL_THRESHOLD) { if (wc->open_channels < POLLING_CALL_THRESHOLD) {
if (test_bit(DTE_POLLING, &wc->flags)) if (test_bit(DTE_POLLING, &wc->flags))
wctc4xxp_disable_polling(wc); wctc4xxp_disable_polling(wc);
} }
#endif #endif
}
packets_received = atomic_read(&cpvt->stats.packets_received); packets_received = atomic_read(&cpvt->stats.packets_received);
packets_sent = atomic_read(&cpvt->stats.packets_sent); packets_sent = atomic_read(&cpvt->stats.packets_sent);