drm/i915: Use ARRAY_SIZE() instead of hand rolling it
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 21 Aug 2015 17:45:28 +0000 (20:45 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 26 Aug 2015 09:19:30 +0000 (11:19 +0200)
A couple of hand rolled ARRAY_SIZE()s caught my eye. Get rid of them.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/i915/intel_tv.c
drivers/gpu/drm/i915/intel_uncore.c

index c98098e884ccef64e7d722a70063bd97b404a7cc..25d74d23e85e45527123a8de4206b1ee1bdfbbb7 100644 (file)
@@ -63,7 +63,7 @@ static const char *tv_format_names[] = {
        "SECAM_60"
 };
 
-#define TV_FORMAT_NUM  (sizeof(tv_format_names) / sizeof(*tv_format_names))
+#define TV_FORMAT_NUM  ARRAY_SIZE(tv_format_names)
 
 struct intel_sdvo {
        struct intel_encoder base;
index 0568ae6ec9dd2c945b0395a14305c281daf18be2..cbe39dcc7bc0a2103330a7195a1bddd469df3a5c 100644 (file)
@@ -1291,7 +1291,7 @@ static void intel_tv_find_better_format(struct drm_connector *connector)
                return;
 
 
-       for (i = 0; i < sizeof(tv_modes) / sizeof(*tv_modes); i++) {
+       for (i = 0; i < ARRAY_SIZE(tv_modes); i++) {
                tv_mode = tv_modes + i;
 
                if ((intel_tv->type == DRM_MODE_CONNECTOR_Component) ==
index 9d3c2e420d2b68611d52e9c6395d35721da19447..ad4e421226b2b2f4e61f1f32f6d2ada5f9ab74b1 100644 (file)
@@ -52,8 +52,7 @@ static const char * const forcewake_domain_names[] = {
 const char *
 intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id)
 {
-       BUILD_BUG_ON((sizeof(forcewake_domain_names)/sizeof(const char *)) !=
-                    FW_DOMAIN_ID_COUNT);
+       BUILD_BUG_ON(ARRAY_SIZE(forcewake_domain_names) != FW_DOMAIN_ID_COUNT);
 
        if (id >= 0 && id < FW_DOMAIN_ID_COUNT)
                return forcewake_domain_names[id];