summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/gma500/psb_device.c
diff options
context:
space:
mode:
authorPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2022-03-22 14:17:38 +0100
committerPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2022-03-23 11:20:22 +0100
commitb1a7d0ddb169774c3db5afe9e64124daea7fdd9f (patch)
tree7170bc137458db6c13aeac1c290bc8fdaef4d752 /drivers/gpu/drm/gma500/psb_device.c
parentdrm/gma500: Uninstall interrupts on driver removal (diff)
downloadlinux-b1a7d0ddb169774c3db5afe9e64124daea7fdd9f.tar.xz
linux-b1a7d0ddb169774c3db5afe9e64124daea7fdd9f.zip
drm/gma500: Make use of the drm connector iterator
This makes sure we're using proper locking when iterating the list of connectors. Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20220322131742.11566-3-patrik.r.jakobsson@gmail.com
Diffstat (limited to 'drivers/gpu/drm/gma500/psb_device.c')
-rw-r--r--drivers/gpu/drm/gma500/psb_device.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/gpu/drm/gma500/psb_device.c b/drivers/gpu/drm/gma500/psb_device.c
index 59f325165667..71534f4ca834 100644
--- a/drivers/gpu/drm/gma500/psb_device.c
+++ b/drivers/gpu/drm/gma500/psb_device.c
@@ -168,8 +168,10 @@ static void psb_init_pm(struct drm_device *dev)
static int psb_save_display_registers(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
+ struct gma_connector *gma_connector;
struct drm_crtc *crtc;
- struct gma_connector *connector;
+ struct drm_connector_list_iter conn_iter;
+ struct drm_connector *connector;
struct psb_state *regs = &dev_priv->regs.psb;
/* Display arbitration control + watermarks */
@@ -189,9 +191,13 @@ static int psb_save_display_registers(struct drm_device *dev)
dev_priv->ops->save_crtc(crtc);
}
- list_for_each_entry(connector, &dev->mode_config.connector_list, base.head)
- if (connector->save)
- connector->save(&connector->base);
+ drm_connector_list_iter_begin(dev, &conn_iter);
+ drm_for_each_connector_iter(connector, &conn_iter) {
+ gma_connector = to_gma_connector(connector);
+ if (gma_connector->save)
+ gma_connector->save(connector);
+ }
+ drm_connector_list_iter_end(&conn_iter);
drm_modeset_unlock_all(dev);
return 0;
@@ -206,8 +212,10 @@ static int psb_save_display_registers(struct drm_device *dev)
static int psb_restore_display_registers(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
+ struct gma_connector *gma_connector;
struct drm_crtc *crtc;
- struct gma_connector *connector;
+ struct drm_connector_list_iter conn_iter;
+ struct drm_connector *connector;
struct psb_state *regs = &dev_priv->regs.psb;
/* Display arbitration + watermarks */
@@ -228,9 +236,13 @@ static int psb_restore_display_registers(struct drm_device *dev)
if (drm_helper_crtc_in_use(crtc))
dev_priv->ops->restore_crtc(crtc);
- list_for_each_entry(connector, &dev->mode_config.connector_list, base.head)
- if (connector->restore)
- connector->restore(&connector->base);
+ drm_connector_list_iter_begin(dev, &conn_iter);
+ drm_for_each_connector_iter(connector, &conn_iter) {
+ gma_connector = to_gma_connector(connector);
+ if (gma_connector->restore)
+ gma_connector->restore(connector);
+ }
+ drm_connector_list_iter_end(&conn_iter);
drm_modeset_unlock_all(dev);
return 0;