summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_vblank.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2020-05-27 13:11:34 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2020-05-29 12:58:11 +0200
commit6015002ece38dac85a373f041e0302781de7474b (patch)
tree3d7308ef59d128562e6c3bd6e25f89ecc28393ac /drivers/gpu/drm/drm_vblank.c
parentdrm/gma500: Stop using mode->private_flags (diff)
downloadlinux-6015002ece38dac85a373f041e0302781de7474b.tar.xz
linux-6015002ece38dac85a373f041e0302781de7474b.zip
drm: use drm_dev_has_vblank more
For historical reasons it's called dev->num_crtcs, which is rather confusing ever since kms was added. But now we have a nice helper, so let's use it for better readability! Only code change is in atomic helpers: vblank support means that dev->irq_enabled must be set too. Another one of these quirky things ... But since it's implied we can simplify that check. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20200527111134.1571781-1-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu/drm/drm_vblank.c')
-rw-r--r--drivers/gpu/drm/drm_vblank.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 8837bebc7e13..e2beacafaa28 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -604,7 +604,7 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,
int linedur_ns = 0, framedur_ns = 0;
int dotclock = mode->crtc_clock;
- if (!dev->num_crtcs)
+ if (!drm_dev_has_vblank(dev))
return;
if (WARN_ON(pipe >= dev->num_crtcs))
@@ -1064,7 +1064,7 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
unsigned int pipe = drm_crtc_index(crtc);
ktime_t now;
- if (dev->num_crtcs > 0) {
+ if (drm_dev_has_vblank(dev)) {
seq = drm_vblank_count_and_time(dev, pipe, &now);
} else {
seq = 0;
@@ -1136,7 +1136,7 @@ static int drm_vblank_get(struct drm_device *dev, unsigned int pipe)
unsigned long irqflags;
int ret = 0;
- if (!dev->num_crtcs)
+ if (!drm_dev_has_vblank(dev))
return -EINVAL;
if (WARN_ON(pipe >= dev->num_crtcs))
@@ -1505,7 +1505,7 @@ static void drm_legacy_vblank_pre_modeset(struct drm_device *dev,
struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
/* vblank is not initialized (IRQ not installed ?), or has been freed */
- if (!dev->num_crtcs)
+ if (!drm_dev_has_vblank(dev))
return;
if (WARN_ON(pipe >= dev->num_crtcs))
@@ -1532,7 +1532,7 @@ static void drm_legacy_vblank_post_modeset(struct drm_device *dev,
unsigned long irqflags;
/* vblank is not initialized (IRQ not installed ?), or has been freed */
- if (!dev->num_crtcs)
+ if (!drm_dev_has_vblank(dev))
return;
if (WARN_ON(pipe >= dev->num_crtcs))
@@ -1557,7 +1557,7 @@ int drm_legacy_modeset_ctl_ioctl(struct drm_device *dev, void *data,
unsigned int pipe;
/* If drm_vblank_init() hasn't been called yet, just no-op */
- if (!dev->num_crtcs)
+ if (!drm_dev_has_vblank(dev))
return 0;
/* KMS drivers handle this internally */
@@ -1895,7 +1895,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
unsigned long irqflags;
bool disable_irq;
- if (WARN_ON_ONCE(!dev->num_crtcs))
+ if (WARN_ON_ONCE(!drm_dev_has_vblank(dev)))
return false;
if (WARN_ON(pipe >= dev->num_crtcs))