From patchwork Thu Jan 2 21:29:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 3427151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 57E4C9F2E9 for ; Thu, 2 Jan 2014 21:36:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B97520122 for ; Thu, 2 Jan 2014 21:36:54 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A2C9200F0 for ; Thu, 2 Jan 2014 21:36:53 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VypvO-0003HA-P2; Thu, 02 Jan 2014 21:35:31 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vypv6-000692-AY; Thu, 02 Jan 2014 21:35:12 +0000 Received: from gw-1.arm.linux.org.uk ([78.32.30.217] helo=pandora.arm.linux.org.uk) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VypsG-0005gb-5D for linux-arm-kernel@lists.infradead.org; Thu, 02 Jan 2014 21:32:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Date:Sender:Message-Id:Subject:Cc:To:From:References:In-Reply-To; bh=wXRUELaJRtCU1045C8phPDig7t2TPM11krx3cYWS4og=; b=Kr7N43hC+sveOoFxBzHEqNuTkcRh4jakRjSQfnROxE9lCKQETV44LyJI62GfjgQd6M7Z+pHNs1fvKPum9AJRLW3bZps6H/tCiykjRMAxlcfxv6RHk9DLWhVJGoCLQ6+vr592gBOTm6fJov1NAPJXBu08q0qeQ6jq9+nc1eWdZvA=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:46463 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1VyppL-0004CA-TO; Thu, 02 Jan 2014 21:29:15 +0000 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1VyppL-0007GG-D3; Thu, 02 Jan 2014 21:29:15 +0000 In-Reply-To: <20140102212528.GD7383@n2100.arm.linux.org.uk> References: <20140102212528.GD7383@n2100.arm.linux.org.uk> From: Russell King To: David Airlie , Greg Kroah-Hartman , Sascha Hauer , Shawn Guo Subject: [PATCH RFC 41/46] imx-drm: imx-drm-core: various cleanups Message-Id: Date: Thu, 02 Jan 2014 21:29:15 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140102_163216_882267_F9218470 X-CRM114-Status: GOOD ( 14.47 ) X-Spam-Score: -2.5 (--) Cc: devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Various cleanups are possible after the previous round of changes; these have no real functional bearing other than tidying up the code. Signed-off-by: Russell King --- drivers/staging/imx-drm/imx-drm-core.c | 47 +++++++++++-------------------- drivers/staging/imx-drm/imx-drm.h | 5 +-- 2 files changed, 19 insertions(+), 33 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 8e257c5fb041..33c020867ed0 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -15,12 +15,12 @@ */ #include #include +#include +#include #include #include #include #include -#include -#include #include #include @@ -28,12 +28,6 @@ #define MAX_CRTC 4 -struct crtc_cookie { - void *cookie; - int id; - struct list_head list; -}; - struct imx_drm_crtc; struct imx_drm_device { @@ -47,7 +41,8 @@ struct imx_drm_crtc { struct drm_crtc *crtc; int pipe; struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs; - struct crtc_cookie cookie; + void *cookie; + int id; int mux_id; }; @@ -271,9 +266,9 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) goto err_kms; /* - * with vblank_disable_allowed = true, vblank interrupt will be disabled - * by drm timer once a current process gives up ownership of - * vblank event.(after drm_vblank_put function is called) + * with vblank_disable_allowed = true, vblank interrupt will be + * disabled by drm timer once a current process gives up ownership + * of vblank event. (after drm_vblank_put function is called) */ drm->vblank_disable_allowed = true; @@ -348,26 +343,20 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, * The vblank arrays are dimensioned by MAX_CRTC - we can't * pass IDs greater than this to those functions. */ - if (imxdrm->pipes >= MAX_CRTC) { - ret = -EINVAL; - goto err_busy; - } + if (imxdrm->pipes >= MAX_CRTC) + return -EINVAL; - if (imxdrm->drm->open_count) { - ret = -EBUSY; - goto err_busy; - } + if (imxdrm->drm->open_count) + return -EBUSY; imx_drm_crtc = kzalloc(sizeof(*imx_drm_crtc), GFP_KERNEL); - if (!imx_drm_crtc) { - ret = -ENOMEM; - goto err_alloc; - } + if (!imx_drm_crtc) + return -ENOMEM; imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs; imx_drm_crtc->pipe = imxdrm->pipes++; - imx_drm_crtc->cookie.cookie = cookie; - imx_drm_crtc->cookie.id = id; + imx_drm_crtc->cookie = cookie; + imx_drm_crtc->id = id; imx_drm_crtc->mux_id = imx_drm_crtc->pipe; imx_drm_crtc->crtc = crtc; @@ -390,8 +379,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, err_register: imxdrm->crtc[imx_drm_crtc->pipe] = NULL; kfree(imx_drm_crtc); -err_alloc: -err_busy: return ret; } EXPORT_SYMBOL_GPL(imx_drm_add_crtc); @@ -427,8 +414,8 @@ static uint32_t imx_drm_find_crtc_mask(struct imx_drm_device *imxdrm, for (i = 0; i < MAX_CRTC; i++) { struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[i]; - if (imx_drm_crtc && imx_drm_crtc->cookie.id == id && - imx_drm_crtc->cookie.cookie == cookie) + if (imx_drm_crtc && imx_drm_crtc->id == id && + imx_drm_crtc->cookie == cookie) return drm_helper_crtc_possible_mask(imx_drm_crtc->crtc); } diff --git a/drivers/staging/imx-drm/imx-drm.h b/drivers/staging/imx-drm/imx-drm.h index c5b97e9ce9a0..0a26222ec539 100644 --- a/drivers/staging/imx-drm/imx-drm.h +++ b/drivers/staging/imx-drm/imx-drm.h @@ -5,13 +5,14 @@ #define IPU_PIX_FMT_GBR24 v4l2_fourcc('G', 'B', 'R', '3') +struct device_node; struct drm_crtc; struct drm_connector; struct drm_device; struct drm_encoder; -struct imx_drm_crtc; struct drm_fbdev_cma; struct drm_framebuffer; +struct imx_drm_crtc; struct platform_device; int imx_drm_crtc_id(struct imx_drm_crtc *crtc); @@ -47,8 +48,6 @@ int imx_drm_panel_format_pins(struct drm_encoder *encoder, int imx_drm_panel_format(struct drm_encoder *encoder, u32 interface_pix_fmt); -struct device_node; - int imx_drm_encoder_get_mux_id(struct drm_encoder *encoder); int imx_drm_encoder_parse_of(struct drm_device *drm, struct drm_encoder *encoder, struct device_node *np);