Skip to content

Commit 5c718e0

Browse files
pinchartltomba
authored andcommitted
drm/omap: dss: Modify omapdss_find_output_from_display() to return channel
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> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent 845417b commit 5c718e0

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

drivers/gpu/drm/omapdrm/dss/base.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
236236
}
237237
EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
238238

239+
enum omap_channel omapdss_device_get_dispc_channel(struct omap_dss_device *dssdev)
240+
{
241+
while (dssdev->src)
242+
dssdev = dssdev->src;
243+
244+
return dssdev->dispc_channel;
245+
}
246+
EXPORT_SYMBOL(omapdss_device_get_dispc_channel);
247+
239248
/* -----------------------------------------------------------------------------
240249
* Components Handling
241250
*/

drivers/gpu/drm/omapdrm/dss/omapdss.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ int omapdss_device_connect(struct dss_device *dss,
504504
struct omap_dss_device *dst);
505505
void omapdss_device_disconnect(struct omap_dss_device *src,
506506
struct omap_dss_device *dst);
507+
enum omap_channel omapdss_device_get_dispc_channel(struct omap_dss_device *dssdev);
507508

508509
int omap_dss_get_num_overlay_managers(void);
509510

@@ -513,8 +514,6 @@ int omapdss_output_set_device(struct omap_dss_device *out,
513514
struct omap_dss_device *dssdev);
514515
int omapdss_output_unset_device(struct omap_dss_device *out);
515516

516-
struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
517-
518517
typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
519518
int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
520519
int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);

drivers/gpu/drm/omapdrm/dss/output.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,6 @@ int omapdss_output_unset_device(struct omap_dss_device *out)
8888
}
8989
EXPORT_SYMBOL(omapdss_output_unset_device);
9090

91-
struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev)
92-
{
93-
while (dssdev->src)
94-
dssdev = dssdev->src;
95-
96-
if (dssdev->id != 0)
97-
return omapdss_device_get(dssdev);
98-
99-
return NULL;
100-
}
101-
EXPORT_SYMBOL(omapdss_find_output_from_display);
102-
10391
int dss_install_mgr_ops(struct dss_device *dss,
10492
const struct dss_mgr_ops *mgr_ops,
10593
struct omap_drm_private *priv)

drivers/gpu/drm/omapdrm/omap_crtc.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,9 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
699699
struct drm_crtc *crtc = NULL;
700700
struct omap_crtc *omap_crtc;
701701
enum omap_channel channel;
702-
struct omap_dss_device *out;
703702
int ret;
704703

705-
out = omapdss_find_output_from_display(dssdev);
706-
channel = out->dispc_channel;
707-
omapdss_device_put(out);
704+
channel = omapdss_device_get_dispc_channel(dssdev);
708705

709706
DBG("%s", channel_names[channel]);
710707

0 commit comments

Comments
 (0)