diff options
author | Hans de Goede <hdegoede@redhat.com> | 2019-03-04 17:47:23 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2019-03-11 17:31:14 +0100 |
commit | e5361b4b2b654ae7f0779de331ccd68e4970e401 (patch) | |
tree | db772e407dcf5939f7834f73a590075424428647 | |
parent | dcf7000bef40fdffc8369faa373a1468e98d8c5c (diff) | |
download | linux-e5361b4b2b654ae7f0779de331ccd68e4970e401.tar.bz2 |
staging/vboxvideo: Refactor vbox_update_mode_hints
Refactor vbox_update_mode_hints to no longer use the obsolete
drm_modeset_lock_all() and switch it over to drm_connector_list_iter
instead of directly accessing the list using list_for_each_entry.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190304164724.10210-3-hdegoede@redhat.com
-rw-r--r-- | drivers/staging/vboxvideo/vbox_irq.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/staging/vboxvideo/vbox_irq.c b/drivers/staging/vboxvideo/vbox_irq.c index 89944134ea86..16a1e29f5292 100644 --- a/drivers/staging/vboxvideo/vbox_irq.c +++ b/drivers/staging/vboxvideo/vbox_irq.c @@ -105,6 +105,7 @@ static void validate_or_set_position_hints(struct vbox_private *vbox) /* Query the host for the most recent video mode hints. */ static void vbox_update_mode_hints(struct vbox_private *vbox) { + struct drm_connector_list_iter conn_iter; struct drm_device *dev = &vbox->ddev; struct drm_connector *connector; struct vbox_connector *vbox_conn; @@ -122,13 +123,10 @@ static void vbox_update_mode_hints(struct vbox_private *vbox) } validate_or_set_position_hints(vbox); - drm_modeset_lock_all(dev); - /* - * FIXME: this needs to use drm_connector_list_iter and some real - * locking for the actual data it changes, not the deprecated - * drm_modeset_lock_all() shotgun approach. - */ - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { + + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); + drm_connector_list_iter_begin(dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { vbox_conn = to_vbox_connector(connector); hints = &vbox->last_mode_hints[vbox_conn->vbox_crtc->crtc_id]; @@ -157,7 +155,8 @@ static void vbox_update_mode_hints(struct vbox_private *vbox) vbox_conn->vbox_crtc->disconnected = disconnected; } - drm_modeset_unlock_all(dev); + drm_connector_list_iter_end(&conn_iter); + drm_modeset_unlock(&dev->mode_config.connection_mutex); } static void vbox_hotplug_worker(struct work_struct *work) |