From: "Michael S. Tsirkin" <mst@redhat.com>
To: keliu <liuke94@huawei.com>
Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio: Directly use ida_alloc()/free()
Date: Fri, 27 May 2022 06:26:02 -0400 [thread overview]
Message-ID: <20220527062533-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220527073302.2474073-1-liuke94@huawei.com>
On Fri, May 27, 2022 at 07:33:02AM +0000, keliu wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
>
> Signed-off-by: keliu <liuke94@huawei.com>
Please Cc people that commented on the original patch. thanks!
> ---
> drivers/virtio/virtio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index 22f15f444f75..143f94652306 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -413,7 +413,7 @@ int register_virtio_device(struct virtio_device *dev)
> device_initialize(&dev->dev);
>
> /* Assign a unique device index and hence name. */
> - err = ida_simple_get(&virtio_index_ida, 0, 0, GFP_KERNEL);
> + err = ida_alloc(&virtio_index_ida, GFP_KERNEL);
> if (err < 0)
> goto out;
>
> @@ -451,7 +451,7 @@ int register_virtio_device(struct virtio_device *dev)
> out_of_node_put:
> of_node_put(dev->dev.of_node);
> out_ida_remove:
> - ida_simple_remove(&virtio_index_ida, dev->index);
> + ida_free(&virtio_index_ida, dev->index);
> out:
> virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);
> return err;
> @@ -469,7 +469,7 @@ void unregister_virtio_device(struct virtio_device *dev)
> int index = dev->index; /* save for after device release */
>
> device_unregister(&dev->dev);
> - ida_simple_remove(&virtio_index_ida, index);
> + ida_free(&virtio_index_ida, index);
> }
> EXPORT_SYMBOL_GPL(unregister_virtio_device);
>
> --
> 2.25.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: keliu <liuke94@huawei.com>
Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] virtio: Directly use ida_alloc()/free()
Date: Fri, 27 May 2022 06:26:02 -0400 [thread overview]
Message-ID: <20220527062533-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220527073302.2474073-1-liuke94@huawei.com>
On Fri, May 27, 2022 at 07:33:02AM +0000, keliu wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
>
> Signed-off-by: keliu <liuke94@huawei.com>
Please Cc people that commented on the original patch. thanks!
> ---
> drivers/virtio/virtio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index 22f15f444f75..143f94652306 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -413,7 +413,7 @@ int register_virtio_device(struct virtio_device *dev)
> device_initialize(&dev->dev);
>
> /* Assign a unique device index and hence name. */
> - err = ida_simple_get(&virtio_index_ida, 0, 0, GFP_KERNEL);
> + err = ida_alloc(&virtio_index_ida, GFP_KERNEL);
> if (err < 0)
> goto out;
>
> @@ -451,7 +451,7 @@ int register_virtio_device(struct virtio_device *dev)
> out_of_node_put:
> of_node_put(dev->dev.of_node);
> out_ida_remove:
> - ida_simple_remove(&virtio_index_ida, dev->index);
> + ida_free(&virtio_index_ida, dev->index);
> out:
> virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);
> return err;
> @@ -469,7 +469,7 @@ void unregister_virtio_device(struct virtio_device *dev)
> int index = dev->index; /* save for after device release */
>
> device_unregister(&dev->dev);
> - ida_simple_remove(&virtio_index_ida, index);
> + ida_free(&virtio_index_ida, index);
> }
> EXPORT_SYMBOL_GPL(unregister_virtio_device);
>
> --
> 2.25.1
next prev parent reply other threads:[~2022-05-27 10:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 7:33 [PATCH] virtio: Directly use ida_alloc()/free() keliu
2022-05-27 10:26 ` Michael S. Tsirkin [this message]
2022-05-27 10:26 ` Michael S. Tsirkin
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=20220527062533-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuke94@huawei.com \
--cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.