Re: [Intel-gfx] [PATCH 6/8] drm/nouveau: Use drm_for_each_connector_encoder_ids()
Hi Ville, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on drm/drm-next] [also build test WARNING on v4.18-rc2 next-20180626] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-Second-attempt-at-fixing-the-fb-helper-best_encoder-mess/20180627-024018 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: x86_64-randconfig-x012-201825 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers/gpu//drm/nouveau/nouveau_connector.c: In function 'nouveau_connector_detect': >> drivers/gpu//drm/nouveau/nouveau_connector.c:606:33: warning: 'nv_encoder' >> may be used uninitialized in this function [-Wmaybe-uninitialized] if (nv_partner && ((nv_encoder->dcb->type == DCB_OUTPUT_ANALOG && ~~^ vim +/nv_encoder +606 drivers/gpu//drm/nouveau/nouveau_connector.c 6ee73861 Ben Skeggs2009-12-11 546 6ee73861 Ben Skeggs2009-12-11 547 static enum drm_connector_status 930a9e28 Chris Wilson 2010-09-14 548 nouveau_connector_detect(struct drm_connector *connector, bool force) 6ee73861 Ben Skeggs2009-12-11 549 { 6ee73861 Ben Skeggs2009-12-11 550 struct drm_device *dev = connector->dev; 77145f1c Ben Skeggs2012-07-31 551 struct nouveau_drm *drm = nouveau_drm(dev); 6ee73861 Ben Skeggs2009-12-11 552 struct nouveau_connector *nv_connector = nouveau_connector(connector); 6ee73861 Ben Skeggs2009-12-11 553 struct nouveau_encoder *nv_encoder = NULL; e19b20bb Ben Skeggs2011-07-12 554 struct nouveau_encoder *nv_partner; 2aa5eac5 Ben Skeggs2015-08-20 555 struct i2c_adapter *i2c; 03cd06ca Francisco Jerez 2010-07-20 556 int type; 5addcf0a Dave Airlie 2012-09-10 557 int ret; 5addcf0a Dave Airlie 2012-09-10 558 enum drm_connector_status conn_status = connector_status_disconnected; 6ee73861 Ben Skeggs2009-12-11 559 b8780e2a Francisco Jerez 2010-01-14 560 /* Cleanup the previous EDID block. */ b8780e2a Francisco Jerez 2010-01-14 561 if (nv_connector->edid) { b8780e2a Francisco Jerez 2010-01-14 562 drm_mode_connector_update_edid_property(connector, NULL); c8ebe275 Xavier Chantry2010-01-11 563 kfree(nv_connector->edid); c8ebe275 Xavier Chantry2010-01-11 564 nv_connector->edid = NULL; b8780e2a Francisco Jerez 2010-01-14 565 } c8ebe275 Xavier Chantry2010-01-11 566 d61a5c10 Lukas Wunner 2018-02-11 567 /* Outputs are only polled while runtime active, so acquiring a d61a5c10 Lukas Wunner 2018-02-11 568 * runtime PM ref here is unnecessary (and would deadlock upon d61a5c10 Lukas Wunner 2018-02-11 569 * runtime suspend because it waits for polling to finish). d61a5c10 Lukas Wunner 2018-02-11 570 */ d61a5c10 Lukas Wunner 2018-02-11 571 if (!drm_kms_helper_is_poll_worker()) { 5addcf0a Dave Airlie 2012-09-10 572 ret = pm_runtime_get_sync(connector->dev->dev); b6c4285a Alexandre Courbot 2014-02-12 573 if (ret < 0 && ret != -EACCES) 5addcf0a Dave Airlie 2012-09-10 574 return conn_status; d61a5c10 Lukas Wunner 2018-02-11 575 } 5addcf0a Dave Airlie 2012-09-10 576 8777c5c1 Ben Skeggs2014-06-06 577 nv_encoder = nouveau_connector_ddc_detect(connector); 8777c5c1 Ben Skeggs2014-06-06 578 if (nv_encoder && (i2c = nv_encoder->i2c) != NULL) { 39c1c901 Lukas Wunner 2016-01-11 579 if ((vga_switcheroo_handler_flags() & 39c1c901 Lukas Wunner 2016-01-11 580 VGA_SWITCHEROO_CAN_SWITCH_DDC) && 39c1c901 Lukas Wunner 2016-01-11 581 nv_connector->type == DCB_CONNECTOR_LVDS) 39c1c901 Lukas Wunner 2016-01-11 582 nv_connector->edid = drm_get_edid_switcheroo(connector, 39c1c901 Lukas Wunner 2016-01-11 583 i2c); 39c1c901 Lukas Wunner 2016-01-11 584 else 2aa5eac5 Ben Skeggs2015-08-20 585 nv_connector->edid = drm_get_edid(connector, i2c); 39c1c901 Lukas Wunner 2016-01-11 586 6ee73861 Ben Skeggs2009-12-11 587 drm_mode_connector_update_edid_property(connector, 6ee73861 Ben Skeggs2009-12-11 588 nv_connector->edid); 6ee73861 Ben Skeggs2009-12-11 589
[Intel-gfx] [PATCH 6/8] drm/nouveau: Use drm_for_each_connector_encoder_ids()
From: Ville Syrjälä Use drm_for_each_connector_encoder_ids() for iterating connector->encoder_ids[]. A bit more convenient not having to deal with the implementation details. Cc: Ben Skeggs Cc: nouv...@lists.freedesktop.org Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/nouveau/nouveau_connector.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 7b557c354307..ea12fbbea92e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -366,14 +366,11 @@ find_encoder(struct drm_connector *connector, int type) struct drm_device *dev = connector->dev; struct nouveau_encoder *nv_encoder; struct drm_encoder *enc; - int i, id; + u32 encoder_id; + int i; - for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { - id = connector->encoder_ids[i]; - if (!id) - break; - - enc = drm_encoder_find(dev, NULL, id); + drm_for_each_connector_encoder_ids(connector, encoder_id, i) { + enc = drm_encoder_find(dev, NULL, encoder_id); if (!enc) continue; nv_encoder = nouveau_encoder(enc); @@ -423,6 +420,7 @@ nouveau_connector_ddc_detect(struct drm_connector *connector) struct nouveau_encoder *nv_encoder; struct drm_encoder *encoder; int i, panel = -ENODEV; + u32 encoder_id; /* eDP panels need powering on by us (if the VBIOS doesn't default it * to on) before doing any AUX channel transactions. LVDS panel power @@ -436,12 +434,8 @@ nouveau_connector_ddc_detect(struct drm_connector *connector) } } - for (i = 0; nv_encoder = NULL, i < DRM_CONNECTOR_MAX_ENCODER; i++) { - int id = connector->encoder_ids[i]; - if (id == 0) - break; - - encoder = drm_encoder_find(dev, NULL, id); + drm_for_each_connector_encoder_ids(connector, encoder_id, i) { + encoder = drm_encoder_find(dev, NULL, encoder_id); if (!encoder) continue; nv_encoder = nouveau_encoder(encoder); -- 2.16.4 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx