mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] mmc: core: Directly use ida_free()
  2022-05-27  7:54 [PATCH] mmc: core: Directly use ida_free() keliu
@ 2022-05-27  7:43 ` Christophe JAILLET
  2022-05-27  8:15 ` Avri Altman
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-05-27  7:43 UTC (permalink / raw)
  To: keliu, ulf.hansson, axboe, Avri.Altman, adrian.hunter, shawn.lin,
	CLoehle, swboyd, digetx, bigeasy, wsa+renesas,
	yoshihiro.shimoda.uh, dev, linux-mmc, linux-kernel

Le 27/05/2022 à 09:54, keliu a écrit :
> Use ida_free() instead of deprecated
> ida_simple_remove() .
> 
> Signed-off-by: keliu <liuke94@huawei.com>
> ---
>   drivers/mmc/core/block.c | 8 ++++----
>   drivers/mmc/core/host.c  | 2 +-
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 506dc900f5c7..c8d702db483d 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -204,7 +204,7 @@ static void mmc_blk_kref_release(struct kref *ref)
>   	int devidx;
>   
>   	devidx = mmc_get_devidx(md->disk);
> -	ida_simple_remove(&mmc_blk_ida, devidx);
> +	ida_free(&mmc_blk_ida, devidx);
>   
>   	mutex_lock(&open_lock);
>   	md->disk->private_data = NULL;
> @@ -2495,7 +2495,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
>    err_kfree:
>   	kfree(md);
>    out:
> -	ida_simple_remove(&mmc_blk_ida, devidx);
> +	ida_free(&mmc_blk_ida, devidx);
>   	return ERR_PTR(ret);
>   }
>   
> @@ -2621,7 +2621,7 @@ static void mmc_blk_rpmb_device_release(struct device *dev)
>   {
>   	struct mmc_rpmb_data *rpmb = dev_get_drvdata(dev);
>   
> -	ida_simple_remove(&mmc_rpmb_ida, rpmb->id);
> +	ida_free(&mmc_rpmb_ida, rpmb->id);
>   	kfree(rpmb);
>   }
>   
> @@ -2643,7 +2643,7 @@ static int mmc_blk_alloc_rpmb_part(struct mmc_card *card,
>   
>   	rpmb = kzalloc(sizeof(*rpmb), GFP_KERNEL);
>   	if (!rpmb) {
> -		ida_simple_remove(&mmc_rpmb_ida, devidx);
> +		ida_free(&mmc_rpmb_ida, devidx);
>   		return -ENOMEM;
>   	}
>   
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 2ed2b4d5e5a5..9332e82e175a 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -76,7 +76,7 @@ static void mmc_host_classdev_release(struct device *dev)
>   	struct mmc_host *host = cls_dev_to_mmc_host(dev);
>   	wakeup_source_unregister(host->ws);
>   	if (of_alias_get_id(host->parent->of_node, "mmc") < 0)
> -		ida_simple_remove(&mmc_host_ida, host->index);
> +		ida_free(&mmc_host_ida, host->index);
>   	kfree(host);
>   }
>   

Hi,

You missed ida_simple_get() that shoud become ida_alloc_max() here.

CJ

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] mmc: core: Directly use ida_free()
@ 2022-05-27  7:54 keliu
  2022-05-27  7:43 ` Christophe JAILLET
  2022-05-27  8:15 ` Avri Altman
  0 siblings, 2 replies; 3+ messages in thread
From: keliu @ 2022-05-27  7:54 UTC (permalink / raw)
  To: ulf.hansson, axboe, Avri.Altman, adrian.hunter, shawn.lin,
	CLoehle, swboyd, digetx, bigeasy, wsa+renesas,
	yoshihiro.shimoda.uh, dev, liuke94, linux-mmc, linux-kernel

Use ida_free() instead of deprecated
ida_simple_remove() .

Signed-off-by: keliu <liuke94@huawei.com>
---
 drivers/mmc/core/block.c | 8 ++++----
 drivers/mmc/core/host.c  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 506dc900f5c7..c8d702db483d 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -204,7 +204,7 @@ static void mmc_blk_kref_release(struct kref *ref)
 	int devidx;
 
 	devidx = mmc_get_devidx(md->disk);
-	ida_simple_remove(&mmc_blk_ida, devidx);
+	ida_free(&mmc_blk_ida, devidx);
 
 	mutex_lock(&open_lock);
 	md->disk->private_data = NULL;
@@ -2495,7 +2495,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
  err_kfree:
 	kfree(md);
  out:
-	ida_simple_remove(&mmc_blk_ida, devidx);
+	ida_free(&mmc_blk_ida, devidx);
 	return ERR_PTR(ret);
 }
 
@@ -2621,7 +2621,7 @@ static void mmc_blk_rpmb_device_release(struct device *dev)
 {
 	struct mmc_rpmb_data *rpmb = dev_get_drvdata(dev);
 
-	ida_simple_remove(&mmc_rpmb_ida, rpmb->id);
+	ida_free(&mmc_rpmb_ida, rpmb->id);
 	kfree(rpmb);
 }
 
@@ -2643,7 +2643,7 @@ static int mmc_blk_alloc_rpmb_part(struct mmc_card *card,
 
 	rpmb = kzalloc(sizeof(*rpmb), GFP_KERNEL);
 	if (!rpmb) {
-		ida_simple_remove(&mmc_rpmb_ida, devidx);
+		ida_free(&mmc_rpmb_ida, devidx);
 		return -ENOMEM;
 	}
 
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 2ed2b4d5e5a5..9332e82e175a 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -76,7 +76,7 @@ static void mmc_host_classdev_release(struct device *dev)
 	struct mmc_host *host = cls_dev_to_mmc_host(dev);
 	wakeup_source_unregister(host->ws);
 	if (of_alias_get_id(host->parent->of_node, "mmc") < 0)
-		ida_simple_remove(&mmc_host_ida, host->index);
+		ida_free(&mmc_host_ida, host->index);
 	kfree(host);
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] mmc: core: Directly use ida_free()
  2022-05-27  7:54 [PATCH] mmc: core: Directly use ida_free() keliu
  2022-05-27  7:43 ` Christophe JAILLET
@ 2022-05-27  8:15 ` Avri Altman
  1 sibling, 0 replies; 3+ messages in thread
From: Avri Altman @ 2022-05-27  8:15 UTC (permalink / raw)
  To: keliu, ulf.hansson, axboe, adrian.hunter, shawn.lin, CLoehle,
	swboyd, digetx, bigeasy, wsa+renesas, yoshihiro.shimoda.uh, dev,
	linux-mmc, linux-kernel

> 
> Use ida_free() instead of deprecated
> ida_simple_remove() .
> 
> Signed-off-by: keliu <liuke94@huawei.com>
Need to replace the corresponding ida_simple_get by ida_alloc.

Thanks,
Avri

> ---
>  drivers/mmc/core/block.c | 8 ++++----
>  drivers/mmc/core/host.c  | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index
> 506dc900f5c7..c8d702db483d 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -204,7 +204,7 @@ static void mmc_blk_kref_release(struct kref *ref)
>         int devidx;
> 
>         devidx = mmc_get_devidx(md->disk);
> -       ida_simple_remove(&mmc_blk_ida, devidx);
> +       ida_free(&mmc_blk_ida, devidx);
> 
>         mutex_lock(&open_lock);
>         md->disk->private_data = NULL;
> @@ -2495,7 +2495,7 @@ static struct mmc_blk_data
> *mmc_blk_alloc_req(struct mmc_card *card,
>   err_kfree:
>         kfree(md);
>   out:
> -       ida_simple_remove(&mmc_blk_ida, devidx);
> +       ida_free(&mmc_blk_ida, devidx);
>         return ERR_PTR(ret);
>  }
> 
> @@ -2621,7 +2621,7 @@ static void mmc_blk_rpmb_device_release(struct
> device *dev)  {
>         struct mmc_rpmb_data *rpmb = dev_get_drvdata(dev);
> 
> -       ida_simple_remove(&mmc_rpmb_ida, rpmb->id);
> +       ida_free(&mmc_rpmb_ida, rpmb->id);
>         kfree(rpmb);
>  }
> 
> @@ -2643,7 +2643,7 @@ static int mmc_blk_alloc_rpmb_part(struct mmc_card
> *card,
> 
>         rpmb = kzalloc(sizeof(*rpmb), GFP_KERNEL);
>         if (!rpmb) {
> -               ida_simple_remove(&mmc_rpmb_ida, devidx);
> +               ida_free(&mmc_rpmb_ida, devidx);
>                 return -ENOMEM;
>         }
> 
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index
> 2ed2b4d5e5a5..9332e82e175a 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -76,7 +76,7 @@ static void mmc_host_classdev_release(struct device
> *dev)
>         struct mmc_host *host = cls_dev_to_mmc_host(dev);
>         wakeup_source_unregister(host->ws);
>         if (of_alias_get_id(host->parent->of_node, "mmc") < 0)
> -               ida_simple_remove(&mmc_host_ida, host->index);
> +               ida_free(&mmc_host_ida, host->index);
>         kfree(host);
>  }
> 
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-27  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27  7:54 [PATCH] mmc: core: Directly use ida_free() keliu
2022-05-27  7:43 ` Christophe JAILLET
2022-05-27  8:15 ` Avri Altman

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®