[svn-commits] sruffell: linux/trunk r10249 - /linux/trunk/drivers/dahdi/wct4xxp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 20 15:53:26 CDT 2011


Author: sruffell
Date: Thu Oct 20 15:53:22 2011
New Revision: 10249

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10249
Log:
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 at digium.com>
Acked-by: Michael Spiceland <mspiceland at digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>

Modified:
    linux/trunk/drivers/dahdi/wct4xxp/base.c

Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=10249&r1=10248&r2=10249
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Thu Oct 20 15:53:22 2011
@@ -3081,7 +3081,7 @@
 	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 @@
 {
 	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]);
 	}




More information about the svn-commits mailing list