mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Bo Liu <liubo03@inspur.com>
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/connector: Remove usage of the deprecated ida_simple_xxx API
Date: Fri, 24 Jun 2022 23:24:12 +0200	[thread overview]
Message-ID: <YrYrfPkSLNjS5CqW@phenom.ffwll.local> (raw)
In-Reply-To: <20220617082319.7599-1-liubo03@inspur.com>

On Fri, Jun 17, 2022 at 04:23:19AM -0400, Bo Liu wrote:
> Use ida_alloc_xxx()/ida_free() instead of
> ida_simple_get()/ida_simple_remove().
> The latter is deprecated and more verbose.
> 
> Signed-off-by: Bo Liu <liubo03@inspur.com>

Thanks for your patch, applied to drm-misc-next.
-Daniel
> ---
>  drivers/gpu/drm/drm_connector.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 1c48d162c77e..cfba71724f84 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -250,7 +250,7 @@ int drm_connector_init(struct drm_device *dev,
>  	connector->funcs = funcs;
>  
>  	/* connector index is used with 32bit bitmasks */
> -	ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL);
> +	ret = ida_alloc_max(&config->connector_ida, 31, GFP_KERNEL);
>  	if (ret < 0) {
>  		DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
>  			      drm_connector_enum_list[connector_type].name,
> @@ -262,7 +262,7 @@ int drm_connector_init(struct drm_device *dev,
>  
>  	connector->connector_type = connector_type;
>  	connector->connector_type_id =
> -		ida_simple_get(connector_ida, 1, 0, GFP_KERNEL);
> +		ida_alloc_min(connector_ida, 1, GFP_KERNEL);
>  	if (connector->connector_type_id < 0) {
>  		ret = connector->connector_type_id;
>  		goto out_put_id;
> @@ -322,10 +322,10 @@ int drm_connector_init(struct drm_device *dev,
>  	connector->debugfs_entry = NULL;
>  out_put_type_id:
>  	if (ret)
> -		ida_simple_remove(connector_ida, connector->connector_type_id);
> +		ida_free(connector_ida, connector->connector_type_id);
>  out_put_id:
>  	if (ret)
> -		ida_simple_remove(&config->connector_ida, connector->index);
> +		ida_free(&config->connector_ida, connector->index);
>  out_put:
>  	if (ret)
>  		drm_mode_object_unregister(dev, &connector->base);
> @@ -479,11 +479,10 @@ void drm_connector_cleanup(struct drm_connector *connector)
>  	list_for_each_entry_safe(mode, t, &connector->modes, head)
>  		drm_mode_remove(connector, mode);
>  
> -	ida_simple_remove(&drm_connector_enum_list[connector->connector_type].ida,
> +	ida_free(&drm_connector_enum_list[connector->connector_type].ida,
>  			  connector->connector_type_id);
>  
> -	ida_simple_remove(&dev->mode_config.connector_ida,
> -			  connector->index);
> +	ida_free(&dev->mode_config.connector_ida, connector->index);
>  
>  	kfree(connector->display_info.bus_formats);
>  	drm_mode_object_unregister(dev, &connector->base);
> -- 
> 2.27.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2022-06-24 21:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17  8:23 Bo Liu
2022-06-24 21:24 ` Daniel Vetter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-06-16  5:18 Bo Liu
2022-06-16 19:23 ` Christophe JAILLET

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YrYrfPkSLNjS5CqW@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubo03@inspur.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®