Message ID | d75c8732adfd071c5561fddd93413ccabb53ea90.1518780268.git.jsarha@ti.com |
---|---|
State | New |
Headers | show |
Series | drm/omap: DSS6 with dynamically allocated objects | expand |
Hi Jyri, Thank you for the patch. On Friday, 16 February 2018 13:25:07 EET Jyri Sarha wrote: > Register the omapdrm device when we know that dss device probe going > to succeed. This avoids DSS6 and DSS2 omapdrm device registration from > colliding with each other. > > Signed-off-by: Jyri Sarha <jsarha@ti.com> > --- > drivers/gpu/drm/omapdrm/dss/core.c | 26 ++------------------------ > drivers/gpu/drm/omapdrm/dss/dss.c | 19 +++++++++++++++++++ > 2 files changed, 21 insertions(+), 24 deletions(-) > > diff --git a/drivers/gpu/drm/omapdrm/dss/core.c > b/drivers/gpu/drm/omapdrm/dss/core.c index acef7ec..6c9f667 100644 > --- a/drivers/gpu/drm/omapdrm/dss/core.c > +++ b/drivers/gpu/drm/omapdrm/dss/core.c > @@ -45,36 +45,14 @@ static struct platform_driver * const omap_dss_drivers[] > = { #endif > }; > > -static struct platform_device *omap_drm_device; > - > static int __init omap_dss_init(void) > { > - int r; > - > - r = platform_register_drivers(omap_dss_drivers, > - ARRAY_SIZE(omap_dss_drivers)); > - if (r) > - goto err_reg; > - > - omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); > - if (IS_ERR(omap_drm_device)) { > - r = PTR_ERR(omap_drm_device); > - goto err_reg; > - } > - > - return 0; > - > -err_reg: > - platform_unregister_drivers(omap_dss_drivers, > - ARRAY_SIZE(omap_dss_drivers)); > - > - return r; > + return platform_register_drivers(omap_dss_drivers, > + ARRAY_SIZE(omap_dss_drivers)); > } > > static void __exit omap_dss_exit(void) > { > - platform_device_unregister(omap_drm_device); > - > platform_unregister_drivers(omap_dss_drivers, > ARRAY_SIZE(omap_dss_drivers)); > } > diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c > b/drivers/gpu/drm/omapdrm/dss/dss.c index 5752328..dda3237 100644 > --- a/drivers/gpu/drm/omapdrm/dss/dss.c > +++ b/drivers/gpu/drm/omapdrm/dss/dss.c > @@ -1314,6 +1314,17 @@ static const struct soc_device_attribute > dss_soc_devices[] = { { /* sentinel */ } > }; > > +static struct platform_device *omap_drm_device; Let's store this in the dss_device structure instead of adding a new global variable. I've spent enough time chasing the globals, I don't want any new one :-) > +static int initialize_omapdrm_device(void) > +{ > + omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); > + if (IS_ERR(omap_drm_device)) > + return PTR_ERR(omap_drm_device); > + > + return 0; > +} > + > static int dss_bind(struct device *dev) > { > struct dss_device *dss = dev_get_drvdata(dev); > @@ -1323,6 +1334,12 @@ static int dss_bind(struct device *dev) > if (r) > return r; > > + r = initialize_omapdrm_device(); > + if (r) { > + component_unbind_all(dev, NULL); > + return r; > + } > + Should this be called after omapdss_gather_components() and omapdss_set_dss() to make sure the omapdrm probe won't be deferred by the DSS not being initialized ? > pm_set_vt_switch(0); > > omapdss_gather_components(dev); > @@ -1335,6 +1352,8 @@ static void dss_unbind(struct device *dev) > { > omapdss_set_dss(NULL); > > + platform_device_unregister(omap_drm_device); > + Same here, should this be called before omapdss_set_dss() for symmetry ? > component_unbind_all(dev, NULL); > }
diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c index acef7ec..6c9f667 100644 --- a/drivers/gpu/drm/omapdrm/dss/core.c +++ b/drivers/gpu/drm/omapdrm/dss/core.c @@ -45,36 +45,14 @@ static struct platform_driver * const omap_dss_drivers[] = { #endif }; -static struct platform_device *omap_drm_device; - static int __init omap_dss_init(void) { - int r; - - r = platform_register_drivers(omap_dss_drivers, - ARRAY_SIZE(omap_dss_drivers)); - if (r) - goto err_reg; - - omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); - if (IS_ERR(omap_drm_device)) { - r = PTR_ERR(omap_drm_device); - goto err_reg; - } - - return 0; - -err_reg: - platform_unregister_drivers(omap_dss_drivers, - ARRAY_SIZE(omap_dss_drivers)); - - return r; + return platform_register_drivers(omap_dss_drivers, + ARRAY_SIZE(omap_dss_drivers)); } static void __exit omap_dss_exit(void) { - platform_device_unregister(omap_drm_device); - platform_unregister_drivers(omap_dss_drivers, ARRAY_SIZE(omap_dss_drivers)); } diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index 5752328..dda3237 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1314,6 +1314,17 @@ static const struct soc_device_attribute dss_soc_devices[] = { { /* sentinel */ } }; +static struct platform_device *omap_drm_device; + +static int initialize_omapdrm_device(void) +{ + omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); + if (IS_ERR(omap_drm_device)) + return PTR_ERR(omap_drm_device); + + return 0; +} + static int dss_bind(struct device *dev) { struct dss_device *dss = dev_get_drvdata(dev); @@ -1323,6 +1334,12 @@ static int dss_bind(struct device *dev) if (r) return r; + r = initialize_omapdrm_device(); + if (r) { + component_unbind_all(dev, NULL); + return r; + } + pm_set_vt_switch(0); omapdss_gather_components(dev); @@ -1335,6 +1352,8 @@ static void dss_unbind(struct device *dev) { omapdss_set_dss(NULL); + platform_device_unregister(omap_drm_device); + component_unbind_all(dev, NULL); }
Register the omapdrm device when we know that dss device probe going to succeed. This avoids DSS6 and DSS2 omapdrm device registration from colliding with each other. Signed-off-by: Jyri Sarha <jsarha@ti.com> --- drivers/gpu/drm/omapdrm/dss/core.c | 26 ++------------------------ drivers/gpu/drm/omapdrm/dss/dss.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 24 deletions(-)