Michael S. Tsirkin
2022-May-16 08:33 UTC
[PATCH v2 1/3] vduse: Pass management device pointer to vduse_dev_init_vdpa()
On Mon, May 16, 2022 at 02:03:40PM +0800, Xie Yongji wrote:> Pass management device pointer from vdpa_dev_add() to > vduse_dev_init_vdpa() rather than using the static > variable directly. > > No functional change. > > Signed-off-by: Xie Yongji <xieyongji at bytedance.com>Could you pls add a cover letter explaining what is the patchset trying to achieve? I think I can guess but I'd rather not guess ...> --- > drivers/vdpa/vdpa_user/vduse_dev.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c > index 160e40d03084..d3bf55a58cd2 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -1484,9 +1484,8 @@ static struct device vduse_mgmtdev = { > .release = vduse_mgmtdev_release, > }; > > -static struct vdpa_mgmt_dev mgmt_dev; > - > -static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) > +static int vduse_dev_init_vdpa(struct vduse_dev *dev, > + struct vdpa_mgmt_dev *mdev, const char *name) > { > struct vduse_vdpa *vdev; > int ret; > @@ -1509,7 +1508,7 @@ static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) > } > set_dma_ops(&vdev->vdpa.dev, &vduse_dev_dma_ops); > vdev->vdpa.dma_dev = &vdev->vdpa.dev; > - vdev->vdpa.mdev = &mgmt_dev; > + vdev->vdpa.mdev = mdev; > > return 0; > } > @@ -1526,7 +1525,7 @@ static int vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, > mutex_unlock(&vduse_lock); > return -EINVAL; > } > - ret = vduse_dev_init_vdpa(dev, name); > + ret = vduse_dev_init_vdpa(dev, mdev, name); > mutex_unlock(&vduse_lock); > if (ret) > return ret; > -- > 2.20.1