From patchwork Thu Mar 19 04:33:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 6045941 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5A243BF90F for ; Thu, 19 Mar 2015 04:34:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F439204B0 for ; Thu, 19 Mar 2015 04:34:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9167D20465 for ; Thu, 19 Mar 2015 04:34:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE4B76E963; Wed, 18 Mar 2015 21:34:07 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E64789B3C for ; Wed, 18 Mar 2015 21:33:56 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id 00083600621 From: Daniel Stone To: dri-devel@lists.freedesktop.org Subject: [RFC PATCH 21/37] DRM: mode: Un-staticise drm_mode_new_from_umode Date: Thu, 19 Mar 2015 04:33:20 +0000 Message-Id: <1426739616-10635-21-git-send-email-daniels@collabora.com> X-Mailer: git-send-email 2.3.2 In-Reply-To: <1426739616-10635-1-git-send-email-daniels@collabora.com> References: <1426739556-10429-1-git-send-email-daniels@collabora.com> <1426739616-10635-1-git-send-email-daniels@collabora.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Daniel Stone --- drivers/gpu/drm/drm_crtc.c | 51 ------------------------------------------- drivers/gpu/drm/drm_modes.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_modes.h | 2 ++ 3 files changed, 55 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index c7ee172..8bb8dbf 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1746,58 +1746,7 @@ static void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out, out->name[DRM_DISPLAY_MODE_LEN-1] = 0; } -/** - * drm_mode_new_from_umode - convert a modeinfo into a drm_display_mode - * @dev: DRM device to create mode for - * @in: drm_mode_modeinfo to use - * - * Convert a drm_mode_modeinfo into a drm_display_mode structure to return to - * the caller. - * - * Returns: - * New drm_display_mode on success, NULL on failure - */ -static struct drm_display_mode *drm_mode_new_from_umode(struct drm_device *dev, - const struct drm_mode_modeinfo *in) -{ - struct drm_display_mode *out; - - out = drm_mode_create(dev); - if (!out) - return NULL; - - if (in->clock > INT_MAX || in->vrefresh > INT_MAX) - goto err; - - if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX) - goto err; - - out->clock = in->clock; - out->hdisplay = in->hdisplay; - out->hsync_start = in->hsync_start; - out->hsync_end = in->hsync_end; - out->htotal = in->htotal; - out->hskew = in->hskew; - out->vdisplay = in->vdisplay; - out->vsync_start = in->vsync_start; - out->vsync_end = in->vsync_end; - out->vtotal = in->vtotal; - out->vscan = in->vscan; - out->vrefresh = in->vrefresh; - out->flags = in->flags; - out->type = in->type; - strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN); - out->name[DRM_DISPLAY_MODE_LEN-1] = 0; - out->status = drm_mode_validate_basic(out); - if (out->status != MODE_OK) - goto err; - - return out; -err: - drm_mode_destroy(dev, out); - return NULL; -} /** * drm_mode_getresources - get graphics configuration diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 213b11e..f4922e9 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -892,6 +892,59 @@ struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, EXPORT_SYMBOL(drm_mode_duplicate); /** + * drm_mode_new_from_umode - convert a modeinfo into a drm_display_mode + * @dev: DRM device to create mode for + * @in: drm_mode_modeinfo to use + * + * Convert a drm_mode_modeinfo into a drm_display_mode structure to return to + * the caller. + * + * Returns: + * New drm_display_mode on success, NULL on failure + */ +struct drm_display_mode *drm_mode_new_from_umode(struct drm_device *dev, + const struct drm_mode_modeinfo *in) +{ + struct drm_display_mode *out; + + out = drm_mode_create(dev); + if (!out) + return NULL; + + if (in->clock > INT_MAX || in->vrefresh > INT_MAX) + goto err; + + if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX) + goto err; + + out->clock = in->clock; + out->hdisplay = in->hdisplay; + out->hsync_start = in->hsync_start; + out->hsync_end = in->hsync_end; + out->htotal = in->htotal; + out->hskew = in->hskew; + out->vdisplay = in->vdisplay; + out->vsync_start = in->vsync_start; + out->vsync_end = in->vsync_end; + out->vtotal = in->vtotal; + out->vscan = in->vscan; + out->vrefresh = in->vrefresh; + out->flags = in->flags; + out->type = in->type; + strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN); + out->name[DRM_DISPLAY_MODE_LEN-1] = 0; + + out->status = drm_mode_validate_basic(out); + if (out->status != MODE_OK) + goto err; + + return out; +err: + drm_mode_destroy(dev, out); + return NULL; +} + +/** * drm_mode_equal - test modes for equality * @mode1: first mode * @mode2: second mode diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index 0616188..cd014c0 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h @@ -216,6 +216,8 @@ void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, const struct drm_display_mode *mode); +struct drm_display_mode *drm_mode_new_from_umode(struct drm_device *dev, + const struct drm_mode_modeinfo *in); bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,