/* Return @modes's hsync rate in kHz, rounded to the nearest int.  */
int drm_mode_hsync(struct drm_display_mode *mode)
/* Return @modes's hsync rate in kHz, rounded to the nearest int.  */
int drm_mode_hsync(struct drm_display_mode *mode)
{
	unsigned int calc_val;
	if (mode->hsync)
		return mode->hsync;
	if (mode->htotal < 0)
		return 0;
	calc_val = (mode->clock * 1000) / mode->htotal;
	calc_val += 500;
	calc_val /= 1000;
	return calc_val;
}