No functional changes yet, we just should be using this iterator here
instead of manually counting the number of CRTCs anyhow.

Signed-off-by: Lyude Paul <[email protected]>
---
 drivers/gpu/drm/drm_vblank.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 17283e8920378..d57405050554f 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -547,19 +547,20 @@ static void drm_vblank_init_release(struct drm_device 
*dev, void *ptr)
 int drm_vblank_init(struct drm_device *dev)
 {
        int ret;
-       unsigned int num_crtcs = dev->mode_config.num_crtc;
-       unsigned int i;
+       struct drm_crtc *crtc;
 
        spin_lock_init(&dev->vbl_lock);
        spin_lock_init(&dev->vblank_time_lock);
 
-       dev->vblank = drmm_kcalloc(dev, num_crtcs, sizeof(*dev->vblank), 
GFP_KERNEL);
+       dev->vblank = drmm_kcalloc(dev, dev->mode_config.num_crtc,
+                                  sizeof(*dev->vblank), GFP_KERNEL);
        if (!dev->vblank)
                return -ENOMEM;
 
        dev->has_hw_vblank = true;
 
-       for (i = 0; i < num_crtcs; i++) {
+       drm_for_each_crtc(crtc, dev) {
+               unsigned int i = crtc->index;
                struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, i);
 
                vblank->dev = dev;
-- 
2.55.0

Reply via email to