Re: [PATCH 3/5] drm/modeset: add helper to unplug all connectors from sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 20, 2012 at 04:13:47PM +0000, Dave Airlie wrote:
> From: Dave Airlie <airlied@xxxxxxxxxx>
> 
> In order to get correct ordering at hot-unplug for userspace,
> we need to tear down all the sysfs bits at the correct time.
> 
> This adds a helper to allow drivers to remove the sysfs nodes
> for all connectors.
> 
> Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_crtc.c |   11 +++++++++++
>  include/drm/drm_crtc.h     |    2 ++
>  2 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 2c27a2e..e6a2a3e 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -523,6 +523,17 @@ void drm_connector_cleanup(struct drm_connector *connector)
>  }
>  EXPORT_SYMBOL(drm_connector_cleanup);
>  
> +void drm_connector_unplug_all(struct drm_device *dev)
> +{
> +	struct drm_connector *connector;
> +
> +	/* taking the mode config mutex ends up in a clash with sysfs */
> +	list_for_each_entry(connector, &dev->mode_config.connector_list, head)
> +		drm_sysfs_connector_remove(connector);
> +
> +}
> +EXPORT_SYMBOL(drm_connector_unplug_all);

If we ever want to make kms object hotplug/remove work I think we could
just switch over to using a hotplug mutex to protect these lists.
Currently these don't ever change, so I think we should be safe here
(together with the hotremove_mutex proposed in the previous patch).

Maybe add a big comment to explain why things are currently safe and what
needs to be fixed for kms object hotplug (i.e. just parts of a device).

Cheers, Daniel
> +
>  void drm_encoder_init(struct drm_device *dev,
>  		      struct drm_encoder *encoder,
>  		      const struct drm_encoder_funcs *funcs,
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 783322b..927e31b 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -825,6 +825,8 @@ extern void drm_connector_init(struct drm_device *dev,
>  			    int connector_type);
>  
>  extern void drm_connector_cleanup(struct drm_connector *connector);
> +/* helper to unplug all connectors from sysfs for device */
> +extern void drm_connector_unplug_all(struct drm_device *dev);
>  
>  extern void drm_encoder_init(struct drm_device *dev,
>  			     struct drm_encoder *encoder,
> -- 
> 1.7.6
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Mail: daniel@xxxxxxxx
Mobile: +41 (0)79 365 57 48
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux