On Tue, Jul 19, 2016 at 12:57:52PM +0200, Daniel Vetter wrote: > connector_id in the uapi actually means drm_connector->base.id, which > is something entirely different. And ->index is also consistent with > plane/encoder/CRTCS and the various drm_*_index() functions. > > While at it also improve/align the kerneldoc comment. > > v2: Mention where those ids are from ... > > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> > Acked-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Acked-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> > Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx> fixed up the s/support/supporting/ that somehow escape git add and then pushed to drm-misc. -Daniel > --- > drivers/gpu/drm/drm_crtc.c | 11 +++++------ > include/drm/drm_crtc.h | 13 ++++++++++--- > 2 files changed, 15 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index c456628740dd..f9f2506b1855 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -934,11 +934,10 @@ int drm_connector_init(struct drm_device *dev, > connector->dev = dev; > connector->funcs = funcs; > > - connector->connector_id = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL); > - if (connector->connector_id < 0) { > - ret = connector->connector_id; > + ret = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL); > + if (ret < 0) > goto out_put; > - } > + connector->index = ret; > > connector->connector_type = connector_type; > connector->connector_type_id = > @@ -986,7 +985,7 @@ out_put_type_id: > ida_remove(connector_ida, connector->connector_type_id); > out_put_id: > if (ret) > - ida_remove(&config->connector_ida, connector->connector_id); > + ida_remove(&config->connector_ida, connector->index); > out_put: > if (ret) > drm_mode_object_unregister(dev, &connector->base); > @@ -1030,7 +1029,7 @@ void drm_connector_cleanup(struct drm_connector *connector) > connector->connector_type_id); > > ida_remove(&dev->mode_config.connector_ida, > - connector->connector_id); > + connector->index); > > kfree(connector->display_info.bus_formats); > drm_mode_object_unregister(dev, &connector->base); > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > index f8ba5aab5d28..4aa4c4341d01 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -1246,7 +1246,6 @@ struct drm_encoder { > * @head: list management > * @base: base KMS object > * @name: human readable name, can be overwritten by the driver > - * @connector_id: compacted connector id useful indexing arrays > * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h > * @connector_type_id: index into connector type enum > * @interlace_allowed: can this connector handle interlaced modes? > @@ -1303,7 +1302,15 @@ struct drm_connector { > struct drm_mode_object base; > > char *name; > - int connector_id; > + > + /** > + * @index: Compacted connector index, which matches the position inside > + * the mode_config.list for drivers not support hot-add/removing. Can be > + * used as an array index. It is invariant over the lifetime of the > + * connector. > + */ > + unsigned index; > + > int connector_type; > int connector_type_id; > bool interlace_allowed; > @@ -2764,7 +2771,7 @@ void drm_connector_unregister(struct drm_connector *connector); > extern void drm_connector_cleanup(struct drm_connector *connector); > static inline unsigned drm_connector_index(struct drm_connector *connector) > { > - return connector->connector_id; > + return connector->index; > } > > extern __printf(5, 6) > -- > 2.8.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx