All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
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	[thread overview]
Message-ID: <20180307002503.19455-35-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20180307002503.19455-1-laurent.pinchart@ideasonboard.com>

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 <laurent.pinchart@ideasonboard.com>
---
 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]);
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-03-07  0:24 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07  0:24 [PATCH/RFC 00/60] omapdrm: Reverse direction of DSS device (dis)connect operations Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 01/60] drm/omap: Allocate drm_device earlier and unref it as last step Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 02/60] drm/omap: Manage the usable omap_dss_device list within omap_drm_private Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 03/60] drm/omap: Do dss_device (display) ordering in omap_drv.c Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 04/60] drm/omap: dss: Remove display ordering from dss/display.c Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 05/60] drm/omap: dss: Gather OMAP DSS components at probe time Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 06/60] drm/omap: dss: Move platform_device_register from core.c to dss.c probe Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 07/60] drm/omap: dss: Remove omapdss_hdmi_ops set_infoframe operation Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 08/60] drm/omap: dss: Remove omapdss_atv_ops get_wss and set_wss operations Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 09/60] drm/omap: dss: Remove DSS encoders get_timings operation Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 10/60] drm/omap: dss: Remove unused omapdss_default_get_timings() Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 11/60] drm/omap: dss: Constify omap_dss_driver operations structure Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 12/60] drm/omap: displays: Remove videomode from omap_dss_device structure Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 13/60] drm/omap: dss: Remove omap_dss_device panel fields Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 14/60] drm/omap: dss: Rename omap_dss_device list field to output_list Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 15/60] drm/omap: dss: Create global list of all omap_dss_device instances Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 16/60] drm/omap: dss: Create and use omapdss_device_is_registered() Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 17/60] drm/omap: dss: Rework output lookup by port node Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 18/60] drm/omap: dss: Allow looking up any device by port Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 19/60] drm/omap: dss: Move common device operations to common structure Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 20/60] drm/omap: dss: Add functions to connect and disconnect devices Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 21/60] drm/omap: dss: Move debug message and checks to connection handlers Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 22/60] drm/omap: dss: Move src and dst check and set " Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 23/60] drm/omap: displays: Remove input omap_dss_device from panel data Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 24/60] drm/omap: dsi: Simplify debugfs implementation Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 25/60] drm/omap: Move DSI debugfs clocks dump to dsi%u_clks files Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 26/60] drm/omap: dss: Remove output devices list Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 27/60] drm/omap: dss: Rename for_each_dss_dev macro to for_each_dss_display Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 28/60] drm/omap: dss: Make omap_dss_get_next_device() more generic Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 29/60] drm/omap: dss: Split omapdss_register_display() Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 30/60] drm/omap: dss: Remove panel devices list Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 31/60] drm/omap: dss: Move and rename omap_dss_(get|put)_device() Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 32/60] drm/omap: dss: Store dss_device pointer in omap_dss_device Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 33/60] drm/omap: dss: Move DSS mgr ops and private data to dss_device Laurent Pinchart
2018-03-07  0:24 ` Laurent Pinchart [this message]
2018-03-07  0:24 ` [PATCH/RFC 35/60] drm/omap: dss: Replace omap_dss_device port number with bitmask Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 36/60] drm/omap: dss: Extend omapdss_of_find_source_for_first_ep() to sinks Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 37/60] drm/omap: displays: Don't cast dssdev to panel data unnecessarily Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 38/60] drm/omap: dss: Cleanup error paths in output init functions Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 39/60] drm/omap: dss: dsi: Move initialization code from bind to probe Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 40/60] drm/omap: dss: hdmi4: " Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 41/60] drm/omap: dss: hdmi5: " Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 42/60] drm/omap: dss: venc: " Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 43/60] drm/omap: dss: Acquire next dssdev at probe time Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 44/60] drm/omap: dss: Add for_each_dss_output() macro Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 45/60] drm/omap: dss: Add function to retrieve display for an output Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 46/60] drm/omap: dss: Remove duplicated parameter to dss_mgr_(dis)connect() Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 47/60] drm/omap: dss: Get regulators at probe time Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 48/60] drm/omap: Remove unneeded variable assignments in omap_modeset_init Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 49/60] drm/omap: Create all planes before CRTCs Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 50/60] drm/omap: Group CRTC, encoder, connector and dssdev in a structure Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 51/60] drm/omap: Reverse direction of DSS device (dis)connect operations Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 52/60] drm/omap: dss: Move connection checks to omapdss_device_(dis)connect Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 53/60] drm/omap: dss: Move display type validation to initialization time Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 54/60] drm/omap: dss: Merge two disconnection helpers Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 55/60] drm/omap: Pass pipe pointer to omap_crtc_init() Laurent Pinchart
2018-03-07  0:24 ` [PATCH/RFC 56/60] drm/omap: Store CRTC lookup by channel table in omap_drm_private Laurent Pinchart
2018-03-07  0:25 ` [PATCH/RFC 57/60] drm/omap: Remove omap_crtc_output global array Laurent Pinchart
2018-03-07  0:25 ` [PATCH/RFC 58/60] drm/omap: Remove supported output check in CRTC connect handler Laurent Pinchart
2018-03-07  0:25 ` [PATCH/RFC 59/60] drm/omap: Set dispc_channel_connect from DSS output connect handlers Laurent Pinchart
2018-03-07  0:25 ` [PATCH/RFC 60/60] drm/omap: dss: Remove the dss_mgr_(dis)connect() operations Laurent Pinchart
2018-03-07 14:11 ` [PATCH/RFC 00/60] omapdrm: Reverse direction of DSS device (dis)connect operations Tomi Valkeinen
2018-03-07 18:41   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180307002503.19455-35-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.