[PATCH] drm: drm_connector->s/connector_id/index/ for consistency

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 19 12:00:53 UTC 2016


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 at chris-wilson.co.uk>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Acked-by: Chris Wilson <chris at chris-wilson.co.uk>
> Acked-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  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;

Oh, that is glorious!

>  out_put_id:
>  	if (ret)
> -		ida_remove(&config->connector_ida, connector->connector_id);
> +		ida_remove(&config->connector_ida, connector->index);

ret == connector->index (it's only otherwise set on failure).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list