• Ville Syrjälä's avatar
    drm: Reduce the amount of dev->vblank[crtc] in the code · 8a51d5be
    Ville Syrjälä authored
    Declare a local struct drm_vblank_crtc * and use that
    instead of having to do dig it out via 'dev->vblank[crtc]'
    everywhere.
    
    Performed with the following coccinelle incantation,
    and a few manual whitespace cleanups:
    
    @@
    identifier func,member;
    expression num_crtcs;
    struct drm_device *dev;
    unsigned int crtc;
    @@
    func (...) {
    + struct drm_vblank_crtc *vblank;
    ...
    if (crtc >= num_crtcs)
       return ...;
    + vblank = &dev->vblank[crtc];
    <+...
    (
    - dev->vblank[crtc].member
    + vblank->member
    |
    - &(dev->vblank[crtc])
    + vblank
    )
    ...+>
    }
    
    @@
    struct drm_device *dev;
    int crtc;
    identifier member;
    expression num_crtcs;
    @@
    for (crtc = 0; crtc < num_crtcs; crtc++) {
    + struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
    +
    <+...
    (
    - dev->vblank[crtc].member
    + vblank->member
    |
    - &(dev->vblank[crtc])
    + vblank
    )
    ...+>
    }
    
    @@
    identifier func,member;
    @@
    func (struct drm_device *dev, int crtc, ...) {
    + struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
    <+...
    (
    - dev->vblank[crtc].member
    + vblank->member
    |
    - &(dev->vblank[crtc])
    + vblank
    )
    ...+>
    }
    
    v2: Rebased
    Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
    Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    8a51d5be
drm_irq.c 45.3 KB