},
 };
 
-#define NUM_TV_MODES sizeof(tv_modes) / sizeof (tv_modes[0])
-
 static void
 intel_tv_dpms(struct drm_encoder *encoder, int mode)
 {
                tv_priv->margin[TV_MARGIN_BOTTOM] = val;
                changed = true;
        } else if (property == dev->mode_config.tv_mode_property) {
-               if (val >= NUM_TV_MODES) {
+               if (val >= ARRAY_SIZE(tv_modes)) {
                        ret = -EINVAL;
                        goto out;
                }
        connector->doublescan_allowed = false;
 
        /* Create TV properties then attach current values */
-       tv_format_names = kmalloc(sizeof(char *) * NUM_TV_MODES,
+       tv_format_names = kmalloc(sizeof(char *) * ARRAY_SIZE(tv_modes),
                                  GFP_KERNEL);
        if (!tv_format_names)
                goto out;
-       for (i = 0; i < NUM_TV_MODES; i++)
+       for (i = 0; i < ARRAY_SIZE(tv_modes); i++)
                tv_format_names[i] = tv_modes[i].name;
-       drm_mode_create_tv_properties(dev, NUM_TV_MODES, tv_format_names);
+       drm_mode_create_tv_properties(dev, ARRAY_SIZE(tv_modes), tv_format_names);
 
        drm_connector_attach_property(connector, dev->mode_config.tv_mode_property,
                                   initial_mode);