]> www.infradead.org Git - users/willy/linux.git/commitdiff
drm: omapdrm: dss: Store dispc ops in dss_device structure
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 13 Feb 2018 12:00:41 +0000 (14:00 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 1 Mar 2018 07:18:18 +0000 (09:18 +0200)
Remove the global dispc ops variable by storing it in the dss_device
structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/dispc.c
drivers/gpu/drm/omapdrm/dss/dss.h
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/omapdrm/omap_drv.c

index 6346bc967a770fddebe2022ecfca32d6bacb5ace..c248c3c319044b57253c0a42bad350e606f0b023 100644 (file)
 #include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/list.h>
+
+#include "dss.h"
 #include "omapdss.h"
 
 static struct dss_device *dss_device;
-static const struct dispc_ops *ops;
 
 static struct list_head omapdss_comp_list;
 
@@ -43,15 +44,9 @@ void omapdss_set_dss(struct dss_device *dss)
 }
 EXPORT_SYMBOL(omapdss_set_dss);
 
-void dispc_set_ops(const struct dispc_ops *o)
-{
-       ops = o;
-}
-EXPORT_SYMBOL(dispc_set_ops);
-
-const struct dispc_ops *dispc_get_ops(void)
+const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
 {
-       return ops;
+       return dss->dispc_ops;
 }
 EXPORT_SYMBOL(dispc_get_ops);
 
index 8019cc9f4f9775ca96f4d7505283836957576bdd..aae6037f499fbf2eab3f1ae5d39dc2e7d8078004 100644 (file)
@@ -4622,7 +4622,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
 
        dispc_runtime_put();
 
-       dispc_set_ops(&dispc_ops);
+       dss->dispc_ops = &dispc_ops;
 
        dispc.debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
                                                &dispc);
@@ -4637,9 +4637,11 @@ err_runtime_get:
 static void dispc_unbind(struct device *dev, struct device *master,
                               void *data)
 {
+       struct dss_device *dss = dispc.dss;
+
        dss_debugfs_remove_file(dispc.debugfs);
 
-       dispc_set_ops(NULL);
+       dss->dispc_ops = NULL;
 
        pm_runtime_disable(dev);
 
index 764c52025a2744bed10efabac1c3204689151179..348378f1b5a53653a89a7459b5c2291cef71859e 100644 (file)
@@ -271,6 +271,8 @@ struct dss_device {
        struct dss_pll *plls[4];
        struct dss_pll  *video1_pll;
        struct dss_pll  *video2_pll;
+
+       const struct dispc_ops *dispc_ops;
 };
 
 /* core */
index 312485714703fa15cd22c40dacb39da103c7fba3..4bf7843b4aec2acb76f6d82643f98085ada4596f 100644 (file)
@@ -733,8 +733,7 @@ struct dispc_ops {
        const u32 *(*ovl_get_color_modes)(enum omap_plane_id plane);
 };
 
-void dispc_set_ops(const struct dispc_ops *o);
-const struct dispc_ops *dispc_get_ops(void);
+const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
 
 bool omapdss_component_is_display(struct device_node *node);
 bool omapdss_component_is_output(struct device_node *node);
index 61d8d17a4243949454969a5b4ddb937118e69ae5..ffe4f698d291bda580e83a495e18fa40556dc9a2 100644 (file)
@@ -117,12 +117,10 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv,
                enum omap_channel channel,
                struct omap_dss_device *dst)
 {
-       const struct dispc_ops *dispc_ops = dispc_get_ops();
-
        if (omap_crtc_output[channel])
                return -EINVAL;
 
-       if ((dispc_ops->mgr_get_supported_outputs(channel) & dst->id) == 0)
+       if (!(priv->dispc_ops->mgr_get_supported_outputs(channel) & dst->id))
                return -EINVAL;
 
        omap_crtc_output[channel] = dst;
index 003445b70ee7306eac0234dc4cd2885b3716191a..a93916cd02587042f5876914cae9eb1b249e7e57 100644 (file)
@@ -520,6 +520,8 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
        DBG("%s", dev_name(dev));
 
        priv->dev = dev;
+       priv->dss = omapdss_get_dss();
+       priv->dispc_ops = dispc_get_ops(priv->dss);
 
        omap_crtc_pre_init(priv);
 
@@ -527,9 +529,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
        if (ret)
                goto err_crtc_uninit;
 
-       priv->dss = omapdss_get_dss();
-       priv->dispc_ops = dispc_get_ops();
-
        soc = soc_device_match(omapdrm_soc_devices);
        priv->omaprev = soc ? (unsigned int)soc->data : 0;
        priv->wq = alloc_ordered_workqueue("omapdrm", 0);