From: Daniel Vetter <daniel@ffwll.ch>
To: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/5] drm/modeset: add helper to unplug all connectors from sysfs
Date: Tue, 21 Feb 2012 09:45:13 +0100 [thread overview]
Message-ID: <20120221084513.GC4065@phenom.ffwll.local> (raw)
In-Reply-To: <1329754429-5491-4-git-send-email-airlied@gmail.com>
On Mon, Feb 20, 2012 at 04:13:47PM +0000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> 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@redhat.com>
> ---
> 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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
next prev parent reply other threads:[~2012-02-21 8:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-20 16:13 initial displaylink kms driver + drm hotplug Dave Airlie
2012-02-20 16:13 ` [PATCH 1/5] drm/usb: add a busid implementation Dave Airlie
2012-02-20 18:12 ` Sascha Hauer
2012-02-20 16:13 ` [PATCH 2/5] drm/sysfs: protect sysfs removal code against being run twice Dave Airlie
2012-02-21 8:39 ` Daniel Vetter
2012-02-20 16:13 ` [PATCH 3/5] drm/modeset: add helper to unplug all connectors from sysfs Dave Airlie
2012-02-21 8:45 ` Daniel Vetter [this message]
2012-02-20 16:13 ` [PATCH 4/5] drm: add core support for unplugging a device Dave Airlie
2012-02-21 8:59 ` Daniel Vetter
2012-02-20 16:13 ` [PATCH 5/5] drm/udl: initial UDL driver (v4) Dave Airlie
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=20120221084513.GC4065@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
/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.