diff mbox series

[1/2] mmc: remove an extra blk_{get,put}_queue pair

Message ID 20210616053934.880951-2-hch@lst.de
State New
Headers show
Series [1/2] mmc: remove an extra blk_{get,put}_queue pair | expand

Commit Message

Christoph Hellwig June 16, 2021, 5:39 a.m. UTC
The gendisk already acquires a reference to the queue when add_disk
is called, which dropped on put_disk.  So remove the superflous
extra refcounting.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/mmc/core/block.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

Comments

Ulf Hansson June 17, 2021, 9:55 a.m. UTC | #1
On Wed, 16 Jun 2021 at 07:40, Christoph Hellwig <hch@lst.de> wrote:
>

> The gendisk already acquires a reference to the queue when add_disk

> is called, which dropped on put_disk.  So remove the superflous

> extra refcounting.

>

> Signed-off-by: Christoph Hellwig <hch@lst.de>


Nice cleanup!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>


Kind regards
Uffe


> ---

>  drivers/mmc/core/block.c | 14 +-------------

>  1 file changed, 1 insertion(+), 13 deletions(-)

>

> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c

> index 689eb9afeeed..947624e76c33 100644

> --- a/drivers/mmc/core/block.c

> +++ b/drivers/mmc/core/block.c

> @@ -201,7 +201,7 @@ static void mmc_blk_put(struct mmc_blk_data *md)

>         md->usage--;

>         if (md->usage == 0) {

>                 int devidx = mmc_get_devidx(md->disk);

> -               blk_put_queue(md->queue.queue);

> +

>                 ida_simple_remove(&mmc_blk_ida, devidx);

>                 put_disk(md->disk);

>                 kfree(md);

> @@ -2326,18 +2326,6 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,

>

>         md->queue.blkdata = md;

>

> -       /*

> -        * Keep an extra reference to the queue so that we can shutdown the

> -        * queue (i.e. call blk_cleanup_queue()) while there are still

> -        * references to the 'md'. The corresponding blk_put_queue() is in

> -        * mmc_blk_put().

> -        */

> -       if (!blk_get_queue(md->queue.queue)) {

> -               mmc_cleanup_queue(&md->queue);

> -               ret = -ENODEV;

> -               goto err_putdisk;

> -       }

> -

>         md->disk->major = MMC_BLOCK_MAJOR;

>         md->disk->first_minor = devidx * perdev_minors;

>         md->disk->fops = &mmc_bdops;

> --

> 2.30.2

>
diff mbox series

Patch

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 689eb9afeeed..947624e76c33 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -201,7 +201,7 @@  static void mmc_blk_put(struct mmc_blk_data *md)
 	md->usage--;
 	if (md->usage == 0) {
 		int devidx = mmc_get_devidx(md->disk);
-		blk_put_queue(md->queue.queue);
+
 		ida_simple_remove(&mmc_blk_ida, devidx);
 		put_disk(md->disk);
 		kfree(md);
@@ -2326,18 +2326,6 @@  static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 
 	md->queue.blkdata = md;
 
-	/*
-	 * Keep an extra reference to the queue so that we can shutdown the
-	 * queue (i.e. call blk_cleanup_queue()) while there are still
-	 * references to the 'md'. The corresponding blk_put_queue() is in
-	 * mmc_blk_put().
-	 */
-	if (!blk_get_queue(md->queue.queue)) {
-		mmc_cleanup_queue(&md->queue);
-		ret = -ENODEV;
-		goto err_putdisk;
-	}
-
 	md->disk->major	= MMC_BLOCK_MAJOR;
 	md->disk->first_minor = devidx * perdev_minors;
 	md->disk->fops = &mmc_bdops;