summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wct4xxp
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-10-20 20:53:22 +0000
committerShaun Ruffell <sruffell@digium.com>2011-10-20 20:53:22 +0000
commitb48c47380da978bfdeecb093fcca6432c616eb0c (patch)
tree938dcab73f1aafc6d4b0d07dbddcc4a9ce87baf3 /drivers/dahdi/wct4xxp
parentec592f243448b471c89ba2b8087f70b730a60c56 (diff)
wct4xxp: Trivial. Use ARRAY_SIZE in free_wc() and __handle_leds().
Reduces the amount of code to read in the two functions and fixes checkpatch.pl warnings. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Acked-by: Michael Spiceland <mspiceland@digium.com> Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10249 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wct4xxp')
-rw-r--r--drivers/dahdi/wct4xxp/base.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c
index b74e9ac..9465999 100644
--- a/drivers/dahdi/wct4xxp/base.c
+++ b/drivers/dahdi/wct4xxp/base.c
@@ -3081,7 +3081,7 @@ static inline void __handle_leds(struct t4 *wc)
if (wc->blinktimer == 0xf) {
wc->blinktimer = -1;
wc->alarmpos++;
- if (wc->alarmpos >= (sizeof(altab) / sizeof(altab[0])))
+ if (wc->alarmpos >= ARRAY_SIZE(altab))
wc->alarmpos = 0;
}
#else
@@ -4044,17 +4044,12 @@ static void free_wc(struct t4 *wc)
{
unsigned int x, y;
- for (x = 0; x < sizeof(wc->tspans)/sizeof(wc->tspans[0]); x++) {
- if (!wc->tspans[x]) {
+ for (x = 0; x < ARRAY_SIZE(wc->tspans); x++) {
+ if (!wc->tspans[x])
continue;
- }
-
- for (y = 0; y < sizeof(wc->tspans[x]->chans)/sizeof(wc->tspans[x]->chans[0]); y++) {
- if (wc->tspans[x]->chans[y]) {
- kfree(wc->tspans[x]->chans[y]);
- }
- if (wc->tspans[x]->ec[y])
- kfree(wc->tspans[x]->ec[y]);
+ for (y = 0; y < ARRAY_SIZE(wc->tspans[x]->chans); y++) {
+ kfree(wc->tspans[x]->chans[y]);
+ kfree(wc->tspans[x]->ec[y]);
}
kfree(wc->tspans[x]);
}