All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Brian Starkey <brian.starkey@arm.com>
Cc: rmk+kernel@armlinux.org.uk, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: tda998x: mali-dp: hdlcd: refactor connector registration
Date: Mon, 24 Oct 2016 16:36:27 +0200	[thread overview]
Message-ID: <20161024143627.GT20761@phenom.ffwll.local> (raw)
In-Reply-To: <1477319279-21726-1-git-send-email-brian.starkey@arm.com>

On Mon, Oct 24, 2016 at 03:27:59PM +0100, Brian Starkey wrote:
> Connectors shouldn't be registered until the rest of the whole device
> is set up, so that consistent state is presented to userspace.
> 
> As such, remove the calls to drm_connector_register() and
> drm_connector_unregister() from tda998x, as these are now handled by
> drm_dev_(un)register() itself.
> 
> To work with this change, the mali-dp and hdlcd bind and unbind
> sequences have to be reordered, to ensure that the componentised
> encoder/connector is bound before drm_dev_register() registers all
> connectors. Similarly, the device must be unregistered before the
> component is unbound.
> 
> Altogether, this allows other drivers using tda998x to be
> de-midlayered, and to have less racy initialisation of their components.
> 
> Splitting this commit into three (one per driver) isn't possible without
> intermediate breakage, so it is all squashed together here.
> 
> Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Brian Starkey <brian.starkey@arm.com>
> Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com>

> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
> index f4315bc..6e6fca2 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -1369,7 +1369,6 @@ const struct drm_connector_helper_funcs tda998x_connector_helper_funcs = {
>  
>  static void tda998x_connector_destroy(struct drm_connector *connector)
>  {
> -	drm_connector_unregister(connector);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -1441,16 +1440,10 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
>  	if (ret)
>  		goto err_connector;
>  
> -	ret = drm_connector_register(&priv->connector);
> -	if (ret)
> -		goto err_sysfs;
> -

Instead of smashing all these patches into one, what about checking here
for midlayer driver set with:

	/* register here for drivers still using midlayer load/unload */
	if (dev->driver->load)
		drm_connector_register(connector),

Similar in other places. That way we wouldn't need to switch the world in
one patch.
-Daniel

>  	drm_mode_connector_attach_encoder(&priv->connector, &priv->encoder);
>  
>  	return 0;
>  
> -err_sysfs:
> -	drm_connector_cleanup(&priv->connector);
>  err_connector:
>  	drm_encoder_cleanup(&priv->encoder);
>  err_encoder:
> @@ -1463,7 +1456,6 @@ static void tda998x_unbind(struct device *dev, struct device *master,
>  {
>  	struct tda998x_priv *priv = dev_get_drvdata(dev);
>  
> -	drm_connector_unregister(&priv->connector);
>  	drm_connector_cleanup(&priv->connector);
>  	drm_encoder_cleanup(&priv->encoder);
>  	tda998x_destroy(priv);
> -- 
> 1.7.9.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2016-10-24 14:36 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 21:33 [PATCH 0/4] drm/tilcdc: Cleanup tilcdc (&tda998x) init sequence Jyri Sarha
2016-10-18 21:33 ` [PATCH 1/4] drm/tilcdc: Remove obsolete drm_connector_register() calls Jyri Sarha
2016-10-19  7:54   ` Laurent Pinchart
2016-10-18 21:33 ` [PATCH 2/4] drm/i2c: tda998x: Remove obsolete drm_connector_register() call Jyri Sarha
2016-10-19  7:54   ` Laurent Pinchart
2016-10-19  8:16     ` Russell King - ARM Linux
2016-10-19  8:52       ` Laurent Pinchart
2016-10-19  9:11         ` Russell King - ARM Linux
2016-10-19  9:19           ` Laurent Pinchart
2016-10-19  9:35             ` Russell King - ARM Linux
2016-10-20  8:20               ` Laurent Pinchart
2016-10-20  9:08                 ` Archit Taneja
2016-10-20  9:15                   ` Russell King - ARM Linux
2016-10-20 11:26                     ` Archit Taneja
2016-10-21 17:28                       ` Jean-Francois Moine
2016-10-22 10:36                         ` Laurent Pinchart
2016-10-21 18:09                       ` Russell King - ARM Linux
2016-10-24  5:09                         ` Archit Taneja
2016-10-30 22:46                           ` Russell King - ARM Linux
2016-10-21 18:43                       ` Russell King - ARM Linux
2016-10-24  5:08                         ` Archit Taneja
2016-10-21 19:04                       ` Jean-Francois Moine
2016-10-22  9:55                         ` Russell King - ARM Linux
2016-10-24  6:28                           ` Archit Taneja
2016-10-24  6:53                             ` Daniel Vetter
2016-10-31  0:09                               ` Russell King - ARM Linux
2016-11-08  9:21                                 ` Daniel Vetter
2016-10-20  9:11                 ` Russell King - ARM Linux
2016-10-19  9:46   ` Brian Starkey
2016-10-22 13:40     ` Russell King - ARM Linux
2016-10-24 14:23       ` Brian Starkey
2016-10-24 14:27         ` [PATCH] drm: tda998x: mali-dp: hdlcd: refactor connector registration Brian Starkey
2016-10-24 14:27           ` Brian Starkey
2016-10-24 14:36           ` Daniel Vetter [this message]
2016-10-24 14:52             ` Brian Starkey
2016-10-24 20:24               ` Daniel Vetter
2016-10-24 20:24                 ` Daniel Vetter
2016-10-25  9:52                 ` Brian Starkey
2016-10-25 10:19                   ` Daniel Vetter
2016-10-25 10:19                     ` Daniel Vetter
2016-10-25 10:40                     ` Brian Starkey
2016-10-25 10:40                       ` Brian Starkey
2016-10-31  9:00                     ` Russell King - ARM Linux
2016-10-31 10:16                       ` Russell King - ARM Linux
2016-10-31  8:58                 ` Russell King - ARM Linux
2016-11-08  9:25                   ` Daniel Vetter
2016-11-08 10:59                     ` Russell King - ARM Linux
2016-11-08 11:27                       ` Daniel Vetter
2016-11-08 11:27                         ` Daniel Vetter
2016-11-15  9:46                       ` [GIT PULL] " Russell King - ARM Linux
2016-11-16 21:31                         ` Russell King - ARM Linux
2016-10-18 21:33 ` [PATCH 3/4] drm/tilcdc: Stop using struct drm_driver load() callback Jyri Sarha
2016-10-19  7:28   ` Daniel Vetter
2016-10-18 21:33 ` [PATCH 4/4] drm/tilcdc: Use unload to handle initialization failures Jyri Sarha
2016-10-19  7:50   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161024143627.GT20761@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=brian.starkey@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.