unsigned long msk;
        unsigned int idx;
 
-       for (idx = 0; idx < sizeof(msp3400_ops)/sizeof(msp3400_ops[0]);
-            idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(msp3400_ops); idx++) {
                msk = 1 << idx;
                if (ctxt->stale_mask & msk) continue;
                if (msp3400_ops[idx].check(ctxt)) {
        unsigned long msk;
        unsigned int idx;
 
-       for (idx = 0; idx < sizeof(msp3400_ops)/sizeof(msp3400_ops[0]);
-            idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(msp3400_ops); idx++) {
                msk = 1 << idx;
                if (!(ctxt->stale_mask & msk)) continue;
                ctxt->stale_mask &= ~msk;
        ctxt->i2c_handler.func_table = &msp3400_funcs;
        ctxt->client = cp;
        ctxt->hdw = hdw;
-       ctxt->stale_mask = (1 << (sizeof(msp3400_ops)/
-                                 sizeof(msp3400_ops[0]))) - 1;
+       ctxt->stale_mask = (1 << ARRAY_SIZE(msp3400_ops)) - 1;
        cp->handler = &ctxt->i2c_handler;
        pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x msp3400 V4L2 handler set up",
                   cp->client->addr);
 
                        }
                        if (maskptr) *maskptr = ~0;
                } else if (cptr->info->type == pvr2_ctl_bool) {
-                       ret = parse_token(
-                               ptr,len,valptr,boolNames,
-                               sizeof(boolNames)/sizeof(boolNames[0]));
+                       ret = parse_token(ptr,len,valptr,boolNames,
+                                         ARRAY_SIZE(boolNames));
                        if (ret == 1) {
                                *valptr = *valptr ? !0 : 0;
                        } else if (ret == 0) {
 
        unsigned long msk;
        unsigned int idx;
 
-       for (idx = 0; idx < sizeof(decoder_ops)/sizeof(decoder_ops[0]);
-            idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(decoder_ops); idx++) {
                msk = 1 << idx;
                if (ctxt->stale_mask & msk) continue;
                if (decoder_ops[idx].check(ctxt)) {
        unsigned long msk;
        unsigned int idx;
 
-       for (idx = 0; idx < sizeof(decoder_ops)/sizeof(decoder_ops[0]);
-            idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(decoder_ops); idx++) {
                msk = 1 << idx;
                if (!(ctxt->stale_mask & msk)) continue;
                ctxt->stale_mask &= ~msk;
        ctxt->ctrl.force_reset = (void (*)(void*))decoder_reset;
        ctxt->client = cp;
        ctxt->hdw = hdw;
-       ctxt->stale_mask = (1 << (sizeof(decoder_ops)/
-                                 sizeof(decoder_ops[0]))) - 1;
+       ctxt->stale_mask = (1 << ARRAY_SIZE(decoder_ops)) - 1;
        hdw->decoder_ctrl = &ctxt->ctrl;
        cp->handler = &ctxt->handler;
        {
 
 {
        struct debugifc_mask_item *mip;
        unsigned int idx;
-       for (idx = 0; idx < sizeof(mask_items)/sizeof(mask_items[0]); idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(mask_items); idx++) {
                mip = mask_items + idx;
                if (debugifc_match_keyword(buf,count,mip->name)) {
                        return mip->msk;
        unsigned int idx;
        int bcnt = 0;
        int ccnt;
-       for (idx = 0; idx < sizeof(mask_items)/sizeof(mask_items[0]); idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(mask_items); idx++) {
                mip = mask_items + idx;
                if (!(mip->msk & msk)) continue;
                ccnt = scnprintf(buf,sz,"%s%c%s",
 
                }
                msg[1].len = pcnt;
                msg[1].buf = eeprom+tcnt;
-               if ((ret = i2c_transfer(
-                            &hdw->i2c_adap,
-                            msg,sizeof(msg)/sizeof(msg[0]))) != 2) {
+               if ((ret = i2c_transfer(&hdw->i2c_adap,
+                                       msg,ARRAY_SIZE(msg))) != 2) {
                        pvr2_trace(PVR2_TRACE_ERROR_LEGS,
                                   "eeprom fetch set offs err=%d",ret);
                        kfree(eeprom);
 
 
 #define DEFENUM(tab) \
        .type = pvr2_ctl_enum, \
-       .def.type_enum.count = (sizeof(tab)/sizeof((tab)[0])), \
+       .def.type_enum.count = ARRAY_SIZE(tab), \
        .def.type_enum.value_names = tab
 
 #define DEFBOOL \