Skip to content

Commit d3541ca

Browse files
pinchartltomba
authored andcommitted
drm: omapdrm: dss: Store dispc ops in dss_device structure
Remove the global dispc ops variable by storing it in the dss_device structure. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
1 parent 72877cf commit d3541ca

File tree

6 files changed

+14
-19
lines changed

6 files changed

+14
-19
lines changed

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
#include <linux/of.h>
1919
#include <linux/of_graph.h>
2020
#include <linux/list.h>
21+
22+
#include "dss.h"
2123
#include "omapdss.h"
2224

2325
static struct dss_device *dss_device;
24-
static const struct dispc_ops *ops;
2526

2627
static struct list_head omapdss_comp_list;
2728

@@ -43,15 +44,9 @@ void omapdss_set_dss(struct dss_device *dss)
4344
}
4445
EXPORT_SYMBOL(omapdss_set_dss);
4546

46-
void dispc_set_ops(const struct dispc_ops *o)
47-
{
48-
ops = o;
49-
}
50-
EXPORT_SYMBOL(dispc_set_ops);
51-
52-
const struct dispc_ops *dispc_get_ops(void)
47+
const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
5348
{
54-
return ops;
49+
return dss->dispc_ops;
5550
}
5651
EXPORT_SYMBOL(dispc_get_ops);
5752

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4622,7 +4622,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
46224622

46234623
dispc_runtime_put();
46244624

4625-
dispc_set_ops(&dispc_ops);
4625+
dss->dispc_ops = &dispc_ops;
46264626

46274627
dispc.debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
46284628
&dispc);
@@ -4637,9 +4637,11 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
46374637
static void dispc_unbind(struct device *dev, struct device *master,
46384638
void *data)
46394639
{
4640+
struct dss_device *dss = dispc.dss;
4641+
46404642
dss_debugfs_remove_file(dispc.debugfs);
46414643

4642-
dispc_set_ops(NULL);
4644+
dss->dispc_ops = NULL;
46434645

46444646
pm_runtime_disable(dev);
46454647

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ struct dss_device {
271271
struct dss_pll *plls[4];
272272
struct dss_pll *video1_pll;
273273
struct dss_pll *video2_pll;
274+
275+
const struct dispc_ops *dispc_ops;
274276
};
275277

276278
/* core */

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,7 @@ struct dispc_ops {
733733
const u32 *(*ovl_get_color_modes)(enum omap_plane_id plane);
734734
};
735735

736-
void dispc_set_ops(const struct dispc_ops *o);
737-
const struct dispc_ops *dispc_get_ops(void);
736+
const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
738737

739738
bool omapdss_component_is_display(struct device_node *node);
740739
bool omapdss_component_is_output(struct device_node *node);

drivers/gpu/drm/omapdrm/omap_crtc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,10 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv,
117117
enum omap_channel channel,
118118
struct omap_dss_device *dst)
119119
{
120-
const struct dispc_ops *dispc_ops = dispc_get_ops();
121-
122120
if (omap_crtc_output[channel])
123121
return -EINVAL;
124122

125-
if ((dispc_ops->mgr_get_supported_outputs(channel) & dst->id) == 0)
123+
if (!(priv->dispc_ops->mgr_get_supported_outputs(channel) & dst->id))
126124
return -EINVAL;
127125

128126
omap_crtc_output[channel] = dst;

drivers/gpu/drm/omapdrm/omap_drv.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,15 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
520520
DBG("%s", dev_name(dev));
521521

522522
priv->dev = dev;
523+
priv->dss = omapdss_get_dss();
524+
priv->dispc_ops = dispc_get_ops(priv->dss);
523525

524526
omap_crtc_pre_init(priv);
525527

526528
ret = omap_connect_dssdevs();
527529
if (ret)
528530
goto err_crtc_uninit;
529531

530-
priv->dss = omapdss_get_dss();
531-
priv->dispc_ops = dispc_get_ops();
532-
533532
soc = soc_device_match(omapdrm_soc_devices);
534533
priv->omaprev = soc ? (unsigned int)soc->data : 0;
535534
priv->wq = alloc_ordered_workqueue("omapdrm", 0);

0 commit comments

Comments
 (0)