]> err.no Git - linux-2.6/commitdiff
sk98lin: kill bogus check and convert to use ARRAY_SIZE()
authorAlejandro Martinez Ruiz <alex@flawedcode.org>
Thu, 18 Oct 2007 08:22:02 +0000 (10:22 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:03:38 +0000 (15:03 -0800)
This converts uses of ARRAY_SIZE(), and while at it also kills
unreachable code as far as I can say. I can't tell what was the author
trying to do with the following check. First we have:

PNMI_STATIC const SK_PNMI_STATADDR
StatAddr[SK_PNMI_MAX_IDX][SK_PNMI_MAC_TYPES];

and then a check goes like this:

if (SK_PNMI_MAX_IDX !=
   (sizeof(StatAddr) / (sizeof(SK_PNMI_STATADDR) * SK_PNMI_MAC_TYPES)))

with the second line being just ARRAY_SIZE(StatAddr), which will always
return SK_PNMI_MAX_IDX, rendering the check useless.

Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/sk98lin/skgemib.c
drivers/net/sk98lin/skgepnmi.c
drivers/net/sk98lin/skgesirq.c

index 0a6f67a7a3952bb57c5bd246fa8f5d902777799d..fde45083eb7bde5da608745cd4d4db4d2977f020 100644 (file)
@@ -82,7 +82,7 @@ PNMI_STATIC int DiagActions(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id,
 
 
 /* defines *******************************************************************/
-#define ID_TABLE_SIZE (sizeof(IdTable)/sizeof(IdTable[0]))
+#define ID_TABLE_SIZE  ARRAY_SIZE(IdTable)
 
 
 /* global variables **********************************************************/
index b36dd9ac6b29c34f7637cb2c3e361260f29cc3bc..3c19d98fcfacdf46c86955c0ee0bfcd08ec9ae07 100644 (file)
@@ -388,18 +388,6 @@ int Level)         /* Initialization level */
                                                SK_PNMI_CNT_NO, SK_PNMI_MAX_IDX));
                }
 
-               if (SK_PNMI_MAX_IDX !=
-                       (sizeof(StatAddr) / (sizeof(SK_PNMI_STATADDR) * SK_PNMI_MAC_TYPES))) {
-                       
-                       SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR050, SK_PNMI_ERR050MSG);
-
-                       SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_INIT | SK_DBGCAT_FATAL,
-                                          ("StatAddr table size (%d) differs from "
-                                               "SK_PNMI_MAX_IDX (%d)\n",
-                                               (sizeof(StatAddr) /
-                                                (sizeof(SK_PNMI_STATADDR) * SK_PNMI_MAC_TYPES)),
-                                                SK_PNMI_MAX_IDX));
-               }
 #endif /* SK_PNMI_CHECK */
                break;
 
index 3e7aa49afd00565e8a10a13b07c5fd98d6f44f64..e5ee6d63ba4e68fff30e4ff3e41452a4e7d0472d 100644 (file)
@@ -892,7 +892,7 @@ int         Port)           /* Which port should be checked */
         */
        RxCts = 0;
 
-       for (i = 0; i < sizeof(SkGeRxRegs)/sizeof(SkGeRxRegs[0]); i++) {
+       for (i = 0; i < ARRAY_SIZE(SkGeRxRegs); i++) {
                
                (void)SkXmMacStatistic(pAC, IoC, Port, SkGeRxRegs[i], &RxTmp);