Commit 4ed2101c authored by Ville Syrjälä's avatar Ville Syrjälä

drm: Flatten drm_mode_vrefresh()

Remove the pointless whole-function indentation. Also don't
need to worry about negative values anymore since we switched
everything to u16.
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200428171940.19552-10-ville.syrjala@linux.intel.com
parent d857e167
...@@ -757,24 +757,22 @@ EXPORT_SYMBOL(drm_mode_set_name); ...@@ -757,24 +757,22 @@ EXPORT_SYMBOL(drm_mode_set_name);
*/ */
int drm_mode_vrefresh(const struct drm_display_mode *mode) int drm_mode_vrefresh(const struct drm_display_mode *mode)
{ {
int refresh = 0; unsigned int num, den;
if (mode->htotal > 0 && mode->vtotal > 0) { if (mode->htotal == 0 || mode->vtotal == 0)
unsigned int num, den; return 0;
num = mode->clock * 1000; num = mode->clock * 1000;
den = mode->htotal * mode->vtotal; den = mode->htotal * mode->vtotal;
if (mode->flags & DRM_MODE_FLAG_INTERLACE) if (mode->flags & DRM_MODE_FLAG_INTERLACE)
num *= 2; num *= 2;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN) if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
den *= 2; den *= 2;
if (mode->vscan > 1) if (mode->vscan > 1)
den *= mode->vscan; den *= mode->vscan;
refresh = DIV_ROUND_CLOSEST(num, den); return DIV_ROUND_CLOSEST(num, den);
}
return refresh;
} }
EXPORT_SYMBOL(drm_mode_vrefresh); EXPORT_SYMBOL(drm_mode_vrefresh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment