Skip to content

Commit

Permalink
drm: Flatten drm_mode_vrefresh()
Browse files Browse the repository at this point in the history
Remove the pointless whole-function indentation. Also don't
need to worry about negative values anymore since we switched
everything to u16.

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200428171940.19552-10-ville.syrjala@linux.intel.com
  • Loading branch information
Ville Syrjälä committed May 27, 2020
1 parent d857e16 commit 4ed2101
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions drivers/gpu/drm/drm_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,24 +757,22 @@ EXPORT_SYMBOL(drm_mode_set_name);
*/
int drm_mode_vrefresh(const struct drm_display_mode *mode)
{
int refresh = 0;
unsigned int num, den;

if (mode->htotal > 0 && mode->vtotal > 0) {
unsigned int num, den;
if (mode->htotal == 0 || mode->vtotal == 0)
return 0;

num = mode->clock * 1000;
den = mode->htotal * mode->vtotal;
num = mode->clock * 1000;
den = mode->htotal * mode->vtotal;

if (mode->flags & DRM_MODE_FLAG_INTERLACE)
num *= 2;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
den *= 2;
if (mode->vscan > 1)
den *= mode->vscan;
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
num *= 2;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
den *= 2;
if (mode->vscan > 1)
den *= mode->vscan;

refresh = DIV_ROUND_CLOSEST(num, den);
}
return refresh;
return DIV_ROUND_CLOSEST(num, den);
}
EXPORT_SYMBOL(drm_mode_vrefresh);

Expand Down

0 comments on commit 4ed2101

Please sign in to comment.