aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2015-07-09 17:44:35 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-07-22 11:29:37 -0400
commite4f62546325724168e0b7ee7180762cb07859ca7 (patch)
tree8f864b5c58ffaeec97f10f947b96e67c5eaf915d
parent9e75c0ef1428ae8a6bfb340ba2402471752c4af5 (diff)
drm: Roll out drm_for_each_{plane,crtc,encoder}
Remaining manual work in the drm core&helpers. Nothing special here, no surprises. Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
-rw-r--r--drivers/gpu/drm/drm_crtc.c26
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c2
-rw-r--r--drivers/gpu/drm/drm_fb_cma_helper.c2
-rw-r--r--drivers/gpu/drm/drm_modeset_lock.c7
4 files changed, 19 insertions, 18 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d928bf7ef221..138ef22078d9 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -736,7 +736,7 @@ unsigned int drm_crtc_index(struct drm_crtc *crtc)
736 unsigned int index = 0; 736 unsigned int index = 0;
737 struct drm_crtc *tmp; 737 struct drm_crtc *tmp;
738 738
739 list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) { 739 drm_for_each_crtc(tmp, crtc->dev) {
740 if (tmp == crtc) 740 if (tmp == crtc)
741 return index; 741 return index;
742 742
@@ -1280,7 +1280,7 @@ unsigned int drm_plane_index(struct drm_plane *plane)
1280 unsigned int index = 0; 1280 unsigned int index = 0;
1281 struct drm_plane *tmp; 1281 struct drm_plane *tmp;
1282 1282
1283 list_for_each_entry(tmp, &plane->dev->mode_config.plane_list, head) { 1283 drm_for_each_plane(tmp, plane->dev) {
1284 if (tmp == plane) 1284 if (tmp == plane)
1285 return index; 1285 return index;
1286 1286
@@ -1719,10 +1719,10 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev,
1719 if (ret) 1719 if (ret)
1720 return ret; 1720 return ret;
1721 1721
1722 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 1722 drm_for_each_crtc(crtc, dev)
1723 group->id_list[group->num_crtcs++] = crtc->base.id; 1723 group->id_list[group->num_crtcs++] = crtc->base.id;
1724 1724
1725 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) 1725 drm_for_each_encoder(encoder, dev)
1726 group->id_list[group->num_crtcs + group->num_encoders++] = 1726 group->id_list[group->num_crtcs + group->num_encoders++] =
1727 encoder->base.id; 1727 encoder->base.id;
1728 1728
@@ -1811,15 +1811,17 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
1811 mutex_lock(&dev->mode_config.mutex); 1811 mutex_lock(&dev->mode_config.mutex);
1812 if (!drm_is_primary_client(file_priv)) { 1812 if (!drm_is_primary_client(file_priv)) {
1813 struct drm_connector *connector; 1813 struct drm_connector *connector;
1814 struct drm_encoder *encoder;
1815 struct drm_crtc *crtc;
1814 1816
1815 mode_group = NULL; 1817 mode_group = NULL;
1816 list_for_each(lh, &dev->mode_config.crtc_list) 1818 drm_for_each_crtc(crtc, dev)
1817 crtc_count++; 1819 crtc_count++;
1818 1820
1819 drm_for_each_connector(connector, dev) 1821 drm_for_each_connector(connector, dev)
1820 connector_count++; 1822 connector_count++;
1821 1823
1822 list_for_each(lh, &dev->mode_config.encoder_list) 1824 drm_for_each_encoder(encoder, dev)
1823 encoder_count++; 1825 encoder_count++;
1824 } else { 1826 } else {
1825 1827
@@ -2287,7 +2289,7 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data,
2287 plane_ptr = (uint32_t __user *)(unsigned long)plane_resp->plane_id_ptr; 2289 plane_ptr = (uint32_t __user *)(unsigned long)plane_resp->plane_id_ptr;
2288 2290
2289 /* Plane lists are invariant, no locking needed. */ 2291 /* Plane lists are invariant, no locking needed. */
2290 list_for_each_entry(plane, &config->plane_list, head) { 2292 drm_for_each_plane(plane, dev) {
2291 /* 2293 /*
2292 * Unless userspace set the 'universal planes' 2294 * Unless userspace set the 'universal planes'
2293 * capability bit, only advertise overlays. 2295 * capability bit, only advertise overlays.
@@ -2592,7 +2594,7 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
2592 * connectors from it), hence we need to refcount the fbs across all 2594 * connectors from it), hence we need to refcount the fbs across all
2593 * crtcs. Atomic modeset will have saner semantics ... 2595 * crtcs. Atomic modeset will have saner semantics ...
2594 */ 2596 */
2595 list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) 2597 drm_for_each_crtc(tmp, crtc->dev)
2596 tmp->primary->old_fb = tmp->primary->fb; 2598 tmp->primary->old_fb = tmp->primary->fb;
2597 2599
2598 fb = set->fb; 2600 fb = set->fb;
@@ -2603,7 +2605,7 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
2603 crtc->primary->fb = fb; 2605 crtc->primary->fb = fb;
2604 } 2606 }
2605 2607
2606 list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) { 2608 drm_for_each_crtc(tmp, crtc->dev) {
2607 if (tmp->primary->fb) 2609 if (tmp->primary->fb)
2608 drm_framebuffer_reference(tmp->primary->fb); 2610 drm_framebuffer_reference(tmp->primary->fb);
2609 if (tmp->primary->old_fb) 2611 if (tmp->primary->old_fb)
@@ -5377,15 +5379,15 @@ void drm_mode_config_reset(struct drm_device *dev)
5377 struct drm_encoder *encoder; 5379 struct drm_encoder *encoder;
5378 struct drm_connector *connector; 5380 struct drm_connector *connector;
5379 5381
5380 list_for_each_entry(plane, &dev->mode_config.plane_list, head) 5382 drm_for_each_plane(plane, dev)
5381 if (plane->funcs->reset) 5383 if (plane->funcs->reset)
5382 plane->funcs->reset(plane); 5384 plane->funcs->reset(plane);
5383 5385
5384 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 5386 drm_for_each_crtc(crtc, dev)
5385 if (crtc->funcs->reset) 5387 if (crtc->funcs->reset)
5386 crtc->funcs->reset(crtc); 5388 crtc->funcs->reset(crtc);
5387 5389
5388 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) 5390 drm_for_each_encoder(encoder, dev)
5389 if (encoder->funcs->reset) 5391 if (encoder->funcs->reset)
5390 encoder->funcs->reset(encoder); 5392 encoder->funcs->reset(encoder);
5391 5393
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 4a83c22f5e61..2e89d8b7de18 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -151,7 +151,7 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
151 if (!oops_in_progress) 151 if (!oops_in_progress)
152 WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); 152 WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
153 153
154 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) 154 drm_for_each_encoder(encoder, dev)
155 if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder)) 155 if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder))
156 return true; 156 return true;
157 return false; 157 return false;
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 46c4e6ee1cb1..f01dc25df2dc 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -211,7 +211,7 @@ int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg)
211 struct drm_framebuffer *fb; 211 struct drm_framebuffer *fb;
212 212
213 mutex_lock(&dev->mode_config.fb_lock); 213 mutex_lock(&dev->mode_config.fb_lock);
214 list_for_each_entry(fb, &dev->mode_config.fb_list, head) 214 drm_for_each_fb(fb, dev)
215 drm_fb_cma_describe(fb, m); 215 drm_fb_cma_describe(fb, m);
216 mutex_unlock(&dev->mode_config.fb_lock); 216 mutex_unlock(&dev->mode_config.fb_lock);
217 217
diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
index c0a5cd8c5262..744dfbc6a329 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -276,7 +276,7 @@ void drm_warn_on_modeset_not_all_locked(struct drm_device *dev)
276 if (oops_in_progress) 276 if (oops_in_progress)
277 return; 277 return;
278 278
279 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 279 drm_for_each_crtc(crtc, dev)
280 WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); 280 WARN_ON(!drm_modeset_is_locked(&crtc->mutex));
281 281
282 WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); 282 WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
@@ -464,18 +464,17 @@ EXPORT_SYMBOL(drm_modeset_unlock);
464int drm_modeset_lock_all_crtcs(struct drm_device *dev, 464int drm_modeset_lock_all_crtcs(struct drm_device *dev,
465 struct drm_modeset_acquire_ctx *ctx) 465 struct drm_modeset_acquire_ctx *ctx)
466{ 466{
467 struct drm_mode_config *config = &dev->mode_config;
468 struct drm_crtc *crtc; 467 struct drm_crtc *crtc;
469 struct drm_plane *plane; 468 struct drm_plane *plane;
470 int ret = 0; 469 int ret = 0;
471 470
472 list_for_each_entry(crtc, &config->crtc_list, head) { 471 drm_for_each_crtc(crtc, dev) {
473 ret = drm_modeset_lock(&crtc->mutex, ctx); 472 ret = drm_modeset_lock(&crtc->mutex, ctx);
474 if (ret) 473 if (ret)
475 return ret; 474 return ret;
476 } 475 }
477 476
478 list_for_each_entry(plane, &config->plane_list, head) { 477 drm_for_each_plane(plane, dev) {
479 ret = drm_modeset_lock(&plane->mutex, ctx); 478 ret = drm_modeset_lock(&plane->mutex, ctx);
480 if (ret) 479 if (ret)
481 return ret; 480 return ret;