/* RETURNS: Negative if @lh_a is better than @lh_b, zero if they're equivalent, or positive if @lh_b is better than @lh_a.  */
static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b)
/* RETURNS: Negative if @lh_a is better than @lh_b, zero if they're equivalent, or positive if @lh_b is better than @lh_a.  */
static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b)
{
	struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head);
	struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head);
	int diff;
	diff = ((b->type & DRM_MODE_TYPE_PREFERRED) != 0) -
		((a->type & DRM_MODE_TYPE_PREFERRED) != 0);
	if (diff)
		return diff;
	diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay;
	if (diff)
		return diff;
	diff = b->clock - a->clock;
	return diff;
}