Commit 85101487 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Tomi Valkeinen
Browse files

drm/omap: remove global dss_device variable



We can simply provide the device to the omapdrm driver
via pdata. omapdss_is_initialized() is no longer required
(even before this patch), since omapdrm device is only
registered after the pointer is initialized.

Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201215104657.802264-39-tomi.valkeinen@ti.com
parent 59661404
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -16,20 +16,6 @@
#include "dss.h"
#include "omapdss.h"

static struct dss_device *dss_device;

struct dss_device *omapdss_get_dss(void)
{
	return dss_device;
}
EXPORT_SYMBOL(omapdss_get_dss);

void omapdss_set_dss(struct dss_device *dss)
{
	dss_device = dss;
}
EXPORT_SYMBOL(omapdss_set_dss);

struct dispc_device *dispc_get_dispc(struct dss_device *dss)
{
	return dss->dispc;
+4 −5
Original line number Diff line number Diff line
@@ -1308,6 +1308,7 @@ static int dss_bind(struct device *dev)
{
	struct dss_device *dss = dev_get_drvdata(dev);
	struct platform_device *drm_pdev;
	struct dss_pdata pdata;
	int r;

	r = component_bind_all(dev, NULL);
@@ -1316,9 +1317,9 @@ static int dss_bind(struct device *dev)

	pm_set_vt_switch(0);

	omapdss_set_dss(dss);

	drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
	pdata.dss = dss;
	drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
						 &pdata, sizeof(pdata));
	if (IS_ERR(drm_pdev)) {
		component_unbind_all(dev, NULL);
		return PTR_ERR(drm_pdev);
@@ -1335,8 +1336,6 @@ static void dss_unbind(struct device *dev)

	platform_device_unregister(dss->drm_pdev);

	omapdss_set_dss(NULL);

	component_unbind_all(dev, NULL);
}

+3 −6
Original line number Diff line number Diff line
@@ -359,12 +359,9 @@ struct omap_dss_device {
	unsigned int of_port;
};

struct dss_device *omapdss_get_dss(void);
void omapdss_set_dss(struct dss_device *dss);
static inline bool omapdss_is_initialized(void)
{
	return !!omapdss_get_dss();
}
struct dss_pdata {
	struct dss_device *dss;
};

void omapdss_display_init(struct omap_dss_device *dssdev);
int omapdss_display_get_modes(struct drm_connector *connector,
+2 −4
Original line number Diff line number Diff line
@@ -568,6 +568,7 @@ static const struct soc_device_attribute omapdrm_soc_devices[] = {
static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
{
	const struct soc_device_attribute *soc;
	struct dss_pdata *pdata = dev->platform_data;
	struct drm_device *ddev;
	int ret;

@@ -582,7 +583,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
	ddev->dev_private = priv;

	priv->dev = dev;
	priv->dss = omapdss_get_dss();
	priv->dss = pdata->dss;
	priv->dispc = dispc_get_dispc(priv->dss);
	priv->dispc_ops = dispc_get_ops(priv->dss);

@@ -677,9 +678,6 @@ static int pdev_probe(struct platform_device *pdev)
	struct omap_drm_private *priv;
	int ret;

	if (omapdss_is_initialized() == false)
		return -EPROBE_DEFER;

	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
	if (ret) {
		dev_err(&pdev->dev, "Failed to set the DMA mask\n");