drm/rcar-du: Use dynamic number of CRTCs instead of CRTCs array size
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sun, 16 Jun 2013 20:22:23 +0000 (22:22 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 9 Aug 2013 21:17:47 +0000 (23:17 +0200)
The rcar_du_device structure contains a field that stores the number of
CRTCs, use it instead of the CRTCs array size. This prepares the driver
to support a variable number of CRTCs.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_drv.c
drivers/gpu/drm/rcar-du/rcar_du_kms.c

index cdc363b6cd3781d552b8361f6f308d7d69941e9b..fd7cdda375b6ab7da8e166b7208a772dfb789d91 100644 (file)
@@ -105,7 +105,7 @@ static void rcar_du_preclose(struct drm_device *dev, struct drm_file *file)
        struct rcar_du_device *rcdu = dev->dev_private;
        unsigned int i;
 
-       for (i = 0; i < ARRAY_SIZE(rcdu->crtcs); ++i)
+       for (i = 0; i < rcdu->num_crtcs; ++i)
                rcar_du_crtc_cancel_page_flip(&rcdu->crtcs[i], file);
 }
 
index c32e0f9d482355631264849b6fa445edeb4abcf3..845bcb384863b55fc52f39bfb1518fa8ddf5eab7 100644 (file)
@@ -197,7 +197,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
                if (pdata->type == RCAR_DU_ENCODER_UNUSED)
                        continue;
 
-               if (pdata->output >= ARRAY_SIZE(rcdu->crtcs)) {
+               if (pdata->output >= rcdu->num_crtcs) {
                        dev_warn(rcdu->dev,
                                 "encoder %u references unexisting output %u, skipping\n",
                                 i, pdata->output);