From b48c47380da978bfdeecb093fcca6432c616eb0c Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 20 Oct 2011 20:53:22 +0000 Subject: 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 Acked-by: Michael Spiceland Acked-by: Russ Meyerriecks git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10249 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wct4xxp/base.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'drivers/dahdi') 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]); } -- cgit v1.2.3