From: Greg KH <gregkh@linuxfoundation.org>
To: Xie Yongji <xieyongji@bytedance.com>
Cc: virtualization@lists.linux-foundation.org, mst@redhat.com
Subject: Re: [PATCH 1/2] vduse: Remove empty vduse_mgmtdev_release()
Date: Wed, 11 May 2022 16:02:01 +0200 [thread overview]
Message-ID: <YnvB2ZxyzGRkPwbm@kroah.com> (raw)
In-Reply-To: <20220511135523.147-1-xieyongji@bytedance.com>
On Wed, May 11, 2022 at 09:55:22PM +0800, Xie Yongji wrote:
> It's not recommended to provide an "empty" release function
> for the device object as Documentation/core-api/kobject.rst
> mentioned.
"it is a bug to have an empty release function" is more like it :)
> So let's allocate the device object dynamically
> to get rid of it.
Much better, but not quite there, see below for details.
>
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> ---
> drivers/vdpa/vdpa_user/vduse_dev.c | 43 +++++++++++++++++-------------
> 1 file changed, 25 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> index 160e40d03084..a8a5ebaefa10 100644
> --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> @@ -1475,15 +1475,6 @@ static char *vduse_devnode(struct device *dev, umode_t *mode)
> return kasprintf(GFP_KERNEL, "vduse/%s", dev_name(dev));
> }
>
> -static void vduse_mgmtdev_release(struct device *dev)
> -{
> -}
> -
> -static struct device vduse_mgmtdev = {
> - .init_name = "vduse",
> - .release = vduse_mgmtdev_release,
> -};
> -
> static struct vdpa_mgmt_dev mgmt_dev;
Close. This should be a pointer and the device structure within it
should control the lifecycle of that structure. It should not be a
single static structure like this, that's very odd.
thanks,
greg k-h
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next parent reply other threads:[~2022-05-11 14:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220511135523.147-1-xieyongji@bytedance.com>
2022-05-11 14:02 ` Greg KH [this message]
[not found] ` <CACycT3s_-E=whAX02C0KKnr-1qx2yWdvTrRnQN=Km1L98VFThg@mail.gmail.com>
2022-05-12 5:23 ` [PATCH 1/2] vduse: Remove empty vduse_mgmtdev_release() Greg KH
[not found] ` <CACycT3tibej7Hw3LtNRyDiNLLm7W5PzssENbuSGXsvK8-Cg43Q@mail.gmail.com>
2022-05-12 6:19 ` Greg KH
[not found] ` <CACycT3uHn0BnQO8kHY6P+EnLu1-YAVqC3koWP8AKzvcXH4hHYw@mail.gmail.com>
2022-05-12 8:52 ` Jason Wang
2022-05-12 8:58 ` Greg KH
[not found] ` <CACycT3uf61r0Wduw=SSMGvbMRA7XWf208Ow0Thc4N6M6nCd0nA@mail.gmail.com>
2022-05-12 9:40 ` Greg KH
2022-05-13 3:53 ` Jason Wang
[not found] ` <CACycT3tF=zc1P+PBUFoZZqob6P9Hmydexfqj0pWW0_a+dk5Dag@mail.gmail.com>
2022-05-13 6:18 ` Jason Wang
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=YnvB2ZxyzGRkPwbm@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xieyongji@bytedance.com \
/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;
as well as URLs for NNTP newsgroup(s).