[PATCH v2 23/30] drm: omapdrm: dss: Store dispc ops in dss_device structure
Sebastian Reichel
sre at kernel.org
Tue Feb 13 21:32:29 UTC 2018
Hi,
On Tue, Feb 13, 2018 at 02:00:41PM +0200, Laurent Pinchart wrote:
> Remove the global dispc ops variable by storing it in the dss_device
> structure.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.co.uk>
-- Sebastian
> ---
> drivers/gpu/drm/omapdrm/dss/base.c | 13 ++++---------
> drivers/gpu/drm/omapdrm/dss/dispc.c | 6 ++++--
> drivers/gpu/drm/omapdrm/dss/dss.h | 2 ++
> drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 +--
> drivers/gpu/drm/omapdrm/omap_crtc.c | 4 +---
> drivers/gpu/drm/omapdrm/omap_drv.c | 5 ++---
> 6 files changed, 14 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 6346bc967a77..c248c3c31904 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -18,10 +18,11 @@
> #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);
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 8019cc9f4f97..aae6037f499f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -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 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
> 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);
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 764c52025a27..348378f1b5a5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -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 */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 312485714703..4bf7843b4aec 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -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);
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 61d8d17a4243..ffe4f698d291 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -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;
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 003445b70ee7..a93916cd0258 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -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);
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180213/dd34590b/attachment-0001.sig>
More information about the dri-devel
mailing list