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
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user