From patchwork Wed Mar 7 00:24:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10263237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4FE2A60211 for ; Wed, 7 Mar 2018 00:27:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FDEA28DE6 for ; Wed, 7 Mar 2018 00:27:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 346D828FA6; Wed, 7 Mar 2018 00:27:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B2F8228DE6 for ; Wed, 7 Mar 2018 00:27:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9BAF6E48A; Wed, 7 Mar 2018 00:24:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from galahad.ideasonboard.com (galahad.ideasonboard.com [185.26.127.97]) by gabe.freedesktop.org (Postfix) with ESMTPS id 310556E521 for ; Wed, 7 Mar 2018 00:24:43 +0000 (UTC) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 3682A22AF6; Wed, 7 Mar 2018 01:22:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1520382143; bh=Bffp+0TpTBNVGh7A7YiSPbtYqQlFla3i4kMF2DaTXvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rJAid/pb9R0NWbt8zvuadqBkXifA7f/shiENNsBb2qyXv+p8pM/z+buVyFrdc9164 ofGgliRxUyc2eyBRNNKu4HkmnIWmx7EbqcFGPY/4ey2mdvwXsrU9dfCJECWB8c1pTq 9fkomI2//FGp+MivJH421NBaebBMuC9lpVxugsQQ= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH/RFC 34/60] drm/omap: dss: Modify omapdss_find_output_from_display() to return channel Date: Wed, 7 Mar 2018 02:24:37 +0200 Message-Id: <20180307002503.19455-35-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180307002503.19455-1-laurent.pinchart@ideasonboard.com> References: <20180307002503.19455-1-laurent.pinchart@ideasonboard.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The omapdss_find_output_from_display() function is only used to retrieve the dispc channel corresponding to the display. Return the dispc channel directly, and rename the function to omapdss_device_get_dispc_channel() to match its new purpose. The dssdev->id check is removed as the dssdev is guaranteed to be an output and have a non-zero id, as proved by the lack of crash despite the caller never checking the returned pointer before dereferencing it. As the function is not specific to outputs anymore, move it from output.c to base.c. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/base.c | 9 +++++++++ drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 +-- drivers/gpu/drm/omapdrm/dss/output.c | 12 ------------ drivers/gpu/drm/omapdrm/omap_crtc.c | 5 +---- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index b4bc58c5134d..7f9d8a8be8c3 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -236,6 +236,15 @@ void omapdss_device_disconnect(struct omap_dss_device *src, } EXPORT_SYMBOL_GPL(omapdss_device_disconnect); +enum omap_channel omapdss_device_get_dispc_channel(struct omap_dss_device *dssdev) +{ + while (dssdev->src) + dssdev = dssdev->src; + + return dssdev->dispc_channel; +} +EXPORT_SYMBOL(omapdss_device_get_dispc_channel); + /* ----------------------------------------------------------------------------- * Components Handling */ diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 2b616ab387aa..7489a301d761 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -502,6 +502,7 @@ int omapdss_device_connect(struct dss_device *dss, struct omap_dss_device *dst); void omapdss_device_disconnect(struct omap_dss_device *src, struct omap_dss_device *dst); +enum omap_channel omapdss_device_get_dispc_channel(struct omap_dss_device *dssdev); int omap_dss_get_num_overlay_managers(void); @@ -511,8 +512,6 @@ int omapdss_output_set_device(struct omap_dss_device *out, struct omap_dss_device *dssdev); int omapdss_output_unset_device(struct omap_dss_device *out); -struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev); - typedef void (*omap_dispc_isr_t) (void *arg, u32 mask); int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask); int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask); diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c index a5df6eed4aef..191b2e801257 100644 --- a/drivers/gpu/drm/omapdrm/dss/output.c +++ b/drivers/gpu/drm/omapdrm/dss/output.c @@ -88,18 +88,6 @@ int omapdss_output_unset_device(struct omap_dss_device *out) } EXPORT_SYMBOL(omapdss_output_unset_device); -struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev) -{ - while (dssdev->src) - dssdev = dssdev->src; - - if (dssdev->id != 0) - return omapdss_device_get(dssdev); - - return NULL; -} -EXPORT_SYMBOL(omapdss_find_output_from_display); - int dss_install_mgr_ops(struct dss_device *dss, const struct dss_mgr_ops *mgr_ops, struct omap_drm_private *priv) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 4ddc4ed18b47..c5f1915aef67 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -699,12 +699,9 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, struct drm_crtc *crtc = NULL; struct omap_crtc *omap_crtc; enum omap_channel channel; - struct omap_dss_device *out; int ret; - out = omapdss_find_output_from_display(dssdev); - channel = out->dispc_channel; - omapdss_device_put(out); + channel = omapdss_device_get_dispc_channel(dssdev); DBG("%s", channel_names[channel]);