Hi, On Tue, Feb 13, 2018 at 02:00:40PM +0200, Laurent Pinchart wrote: > The dss_device is the top-level component in the omapdss driver. Give > the omapdrm driver access to the dss_device pointer in order to obtain > pointers to all other components from it. This requires a new global > variable in the omapdss driver that will be removed when merging the > omapdrm and omapdss drivers, but will already allow removal of several > other global variables. > > As this partly duplicates the omapdss_is_initialized() API, reimplement > it as an inline function wrapping omapdss_get_dss(). > > Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > --- Reviewed-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxxxx> -- Sebastian > drivers/gpu/drm/omapdrm/dss/base.c | 14 +++++++------- > drivers/gpu/drm/omapdrm/dss/dss.c | 5 +++-- > drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +++++++--- > drivers/gpu/drm/omapdrm/omap_drv.c | 1 + > drivers/gpu/drm/omapdrm/omap_drv.h | 1 + > 5 files changed, 19 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c > index 67cc87a4f1f6..6346bc967a77 100644 > --- a/drivers/gpu/drm/omapdrm/dss/base.c > +++ b/drivers/gpu/drm/omapdrm/dss/base.c > @@ -20,7 +20,7 @@ > #include <linux/list.h> > #include "omapdss.h" > > -static bool dss_initialized; > +static struct dss_device *dss_device; > static const struct dispc_ops *ops; > > static struct list_head omapdss_comp_list; > @@ -31,17 +31,17 @@ struct omapdss_comp_node { > bool dss_core_component; > }; > > -void omapdss_set_is_initialized(bool set) > +struct dss_device *omapdss_get_dss(void) > { > - dss_initialized = set; > + return dss_device; > } > -EXPORT_SYMBOL(omapdss_set_is_initialized); > +EXPORT_SYMBOL(omapdss_get_dss); > > -bool omapdss_is_initialized(void) > +void omapdss_set_dss(struct dss_device *dss) > { > - return dss_initialized; > + dss_device = dss; > } > -EXPORT_SYMBOL(omapdss_is_initialized); > +EXPORT_SYMBOL(omapdss_set_dss); > > void dispc_set_ops(const struct dispc_ops *o) > { > diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c > index 14d2f024eb70..ca2efb937d42 100644 > --- a/drivers/gpu/drm/omapdrm/dss/dss.c > +++ b/drivers/gpu/drm/omapdrm/dss/dss.c > @@ -1316,6 +1316,7 @@ static const struct soc_device_attribute dss_soc_devices[] = { > > static int dss_bind(struct device *dev) > { > + struct dss_device *dss = dev_get_drvdata(dev); > int r; > > r = component_bind_all(dev, NULL); > @@ -1325,14 +1326,14 @@ static int dss_bind(struct device *dev) > pm_set_vt_switch(0); > > omapdss_gather_components(dev); > - omapdss_set_is_initialized(true); > + omapdss_set_dss(dss); > > return 0; > } > > static void dss_unbind(struct device *dev) > { > - omapdss_set_is_initialized(false); > + omapdss_set_dss(NULL); > > component_unbind_all(dev, NULL); > } > diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h > index 318641f5bc24..312485714703 100644 > --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h > +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h > @@ -59,6 +59,7 @@ > #define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29) > #define DISPC_IRQ_FRAMEDONE3 (1 << 30) > > +struct dss_device; > struct omap_drm_private; > struct omap_dss_device; > struct dss_lcd_mgr_config; > @@ -586,7 +587,12 @@ struct omap_dss_driver { > const struct hdmi_avi_infoframe *avi); > }; > > -bool omapdss_is_initialized(void); > +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(); > +} > > int omapdss_register_display(struct omap_dss_device *dssdev); > void omapdss_unregister_display(struct omap_dss_device *dssdev); > @@ -630,8 +636,6 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev) > struct omap_dss_device * > omapdss_of_find_source_for_first_ep(struct device_node *node); > > -void omapdss_set_is_initialized(bool set); > - > struct device_node *dss_of_port_get_parent_device(struct device_node *port); > u32 dss_of_port_get_port_number(struct device_node *port); > > diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c > index 39e78f765f7e..003445b70ee7 100644 > --- a/drivers/gpu/drm/omapdrm/omap_drv.c > +++ b/drivers/gpu/drm/omapdrm/omap_drv.c > @@ -527,6 +527,7 @@ 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); > diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h > index 49351bb3731e..a7962c14fc7c 100644 > --- a/drivers/gpu/drm/omapdrm/omap_drv.h > +++ b/drivers/gpu/drm/omapdrm/omap_drv.h > @@ -50,6 +50,7 @@ struct omap_drm_private { > struct device *dev; > u32 omaprev; > > + struct dss_device *dss; > const struct dispc_ops *dispc_ops; > > unsigned int num_crtcs; > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > dri-devel mailing list > dri-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/dri-devel
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel