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

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
...@@ -16,20 +16,6 @@ ...@@ -16,20 +16,6 @@
#include "dss.h" #include "dss.h"
#include "omapdss.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) struct dispc_device *dispc_get_dispc(struct dss_device *dss)
{ {
return dss->dispc; return dss->dispc;
......
...@@ -1308,6 +1308,7 @@ static int dss_bind(struct device *dev) ...@@ -1308,6 +1308,7 @@ static int dss_bind(struct device *dev)
{ {
struct dss_device *dss = dev_get_drvdata(dev); struct dss_device *dss = dev_get_drvdata(dev);
struct platform_device *drm_pdev; struct platform_device *drm_pdev;
struct dss_pdata pdata;
int r; int r;
r = component_bind_all(dev, NULL); r = component_bind_all(dev, NULL);
...@@ -1316,9 +1317,9 @@ static int dss_bind(struct device *dev) ...@@ -1316,9 +1317,9 @@ static int dss_bind(struct device *dev)
pm_set_vt_switch(0); pm_set_vt_switch(0);
omapdss_set_dss(dss); pdata.dss = dss;
drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0); &pdata, sizeof(pdata));
if (IS_ERR(drm_pdev)) { if (IS_ERR(drm_pdev)) {
component_unbind_all(dev, NULL); component_unbind_all(dev, NULL);
return PTR_ERR(drm_pdev); return PTR_ERR(drm_pdev);
...@@ -1335,8 +1336,6 @@ static void dss_unbind(struct device *dev) ...@@ -1335,8 +1336,6 @@ static void dss_unbind(struct device *dev)
platform_device_unregister(dss->drm_pdev); platform_device_unregister(dss->drm_pdev);
omapdss_set_dss(NULL);
component_unbind_all(dev, NULL); component_unbind_all(dev, NULL);
} }
......
...@@ -359,12 +359,9 @@ struct omap_dss_device { ...@@ -359,12 +359,9 @@ struct omap_dss_device {
unsigned int of_port; unsigned int of_port;
}; };
struct dss_device *omapdss_get_dss(void); struct dss_pdata {
void omapdss_set_dss(struct dss_device *dss); struct dss_device *dss;
static inline bool omapdss_is_initialized(void) };
{
return !!omapdss_get_dss();
}
void omapdss_display_init(struct omap_dss_device *dssdev); void omapdss_display_init(struct omap_dss_device *dssdev);
int omapdss_display_get_modes(struct drm_connector *connector, int omapdss_display_get_modes(struct drm_connector *connector,
......
...@@ -568,6 +568,7 @@ static const struct soc_device_attribute omapdrm_soc_devices[] = { ...@@ -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) static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
{ {
const struct soc_device_attribute *soc; const struct soc_device_attribute *soc;
struct dss_pdata *pdata = dev->platform_data;
struct drm_device *ddev; struct drm_device *ddev;
int ret; int ret;
...@@ -582,7 +583,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) ...@@ -582,7 +583,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
ddev->dev_private = priv; ddev->dev_private = priv;
priv->dev = dev; priv->dev = dev;
priv->dss = omapdss_get_dss(); priv->dss = pdata->dss;
priv->dispc = dispc_get_dispc(priv->dss); priv->dispc = dispc_get_dispc(priv->dss);
priv->dispc_ops = dispc_get_ops(priv->dss); priv->dispc_ops = dispc_get_ops(priv->dss);
...@@ -677,9 +678,6 @@ static int pdev_probe(struct platform_device *pdev) ...@@ -677,9 +678,6 @@ static int pdev_probe(struct platform_device *pdev)
struct omap_drm_private *priv; struct omap_drm_private *priv;
int ret; int ret;
if (omapdss_is_initialized() == false)
return -EPROBE_DEFER;
ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to set the DMA mask\n"); dev_err(&pdev->dev, "Failed to set the DMA mask\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment