mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Bo Liu <liubo03@inspur.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ptp: Remove usage of the deprecated ida_simple_xxx API
Date: Tue, 27 Sep 2022 08:01:28 -0700	[thread overview]
Message-ID: <YzMQSJtLA1LDMGOm@hoboy.vegasvil.org> (raw)
In-Reply-To: <20220926012744.3363-1-liubo03@inspur.com>

On Sun, Sep 25, 2022 at 09:27:44PM -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.

I can't say that I am excited about this.  It seems like a way to
create a regression.  I don't see any need to change.  After all,
there are many "deprecated" interfaces in use.

> Signed-off-by: Bo Liu <liubo03@inspur.com>
> ---
>  drivers/ptp/ptp_clock.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index 688cde320bb0..51cae72bb6db 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -174,7 +174,7 @@ static void ptp_clock_release(struct device *dev)
>  	mutex_destroy(&ptp->tsevq_mux);
>  	mutex_destroy(&ptp->pincfg_mux);
>  	mutex_destroy(&ptp->n_vclocks_mux);
> -	ida_simple_remove(&ptp_clocks_map, ptp->index);
> +	ida_free(&ptp_clocks_map, ptp->index);
>  	kfree(ptp);
>  }
>  
> @@ -217,7 +217,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
>  	if (ptp == NULL)
>  		goto no_memory;
>  
> -	index = ida_simple_get(&ptp_clocks_map, 0, MINORMASK + 1, GFP_KERNEL);
> +	index = ida_alloc_max(&ptp_clocks_map, MINORMASK, GFP_KERNEL);

Typo?   You changed the value of the second argument.

Thanks,
Richard



>  	if (index < 0) {
>  		err = index;
>  		goto no_slot;
> @@ -332,7 +332,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
>  	mutex_destroy(&ptp->tsevq_mux);
>  	mutex_destroy(&ptp->pincfg_mux);
>  	mutex_destroy(&ptp->n_vclocks_mux);
> -	ida_simple_remove(&ptp_clocks_map, index);
> +	ida_free(&ptp_clocks_map, index);
>  no_slot:
>  	kfree(ptp);
>  no_memory:
> -- 
> 2.27.0
> 

  reply	other threads:[~2022-09-27 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26  1:27 Bo Liu
2022-09-27 15:01 ` Richard Cochran [this message]
2022-09-27 15:05   ` Richard Cochran
2022-09-27 18:32     ` Jakub Kicinski
2022-09-28  0:40 ` patchwork-bot+netdevbpf

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=YzMQSJtLA1LDMGOm@hoboy.vegasvil.org \
    --to=richardcochran@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubo03@inspur.com \
    --cc=netdev@vger.kernel.org \
    /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®