Skip to content

Commit 81d46d6

Browse files
Longpengmstsirkin
authored andcommitted
vdpa: change the type of nvqs to u32
Change vdpa_device.nvqs and vhost_vdpa.nvqs to use u32 Signed-off-by: Longpeng <longpeng2@huawei.com> Link: https://lore.kernel.org/r/20220315032553.455-3-longpeng2@huawei.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Longpeng &lt;<a href="mailto:longpeng2@huawei.com" target="_blank">longpeng2@huawei.com</a>&gt;<br></blockquote><div><br></div><div>Acked-by: Jason Wang &lt;<a href="mailto:jasowang@redhat.com">jasowang@redhat.com</a>&gt;</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
1 parent a61280d commit 81d46d6

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

drivers/vdpa/vdpa.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static int vdpa_name_match(struct device *dev, const void *data)
232232
return (strcmp(dev_name(&vdev->dev), data) == 0);
233233
}
234234

235-
static int __vdpa_register_device(struct vdpa_device *vdev, int nvqs)
235+
static int __vdpa_register_device(struct vdpa_device *vdev, u32 nvqs)
236236
{
237237
struct device *dev;
238238

@@ -257,7 +257,7 @@ static int __vdpa_register_device(struct vdpa_device *vdev, int nvqs)
257257
*
258258
* Return: Returns an error when fail to add device to vDPA bus
259259
*/
260-
int _vdpa_register_device(struct vdpa_device *vdev, int nvqs)
260+
int _vdpa_register_device(struct vdpa_device *vdev, u32 nvqs)
261261
{
262262
if (!vdev->mdev)
263263
return -EINVAL;
@@ -274,7 +274,7 @@ EXPORT_SYMBOL_GPL(_vdpa_register_device);
274274
*
275275
* Return: Returns an error when fail to add to vDPA bus
276276
*/
277-
int vdpa_register_device(struct vdpa_device *vdev, int nvqs)
277+
int vdpa_register_device(struct vdpa_device *vdev, u32 nvqs)
278278
{
279279
int err;
280280

drivers/vhost/vdpa.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct vhost_vdpa {
4242
struct device dev;
4343
struct cdev cdev;
4444
atomic_t opened;
45-
int nvqs;
45+
u32 nvqs;
4646
int virtio_id;
4747
int minor;
4848
struct eventfd_ctx *config_ctx;
@@ -161,7 +161,8 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
161161
struct vdpa_device *vdpa = v->vdpa;
162162
const struct vdpa_config_ops *ops = vdpa->config;
163163
u8 status, status_old;
164-
int ret, nvqs = v->nvqs;
164+
u32 nvqs = v->nvqs;
165+
int ret;
165166
u16 i;
166167

167168
if (copy_from_user(&status, statusp, sizeof(status)))
@@ -968,7 +969,8 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
968969
struct vhost_vdpa *v;
969970
struct vhost_dev *dev;
970971
struct vhost_virtqueue **vqs;
971-
int nvqs, i, r, opened;
972+
int r, opened;
973+
u32 i, nvqs;
972974

973975
v = container_of(inode->i_cdev, struct vhost_vdpa, cdev);
974976

@@ -1021,7 +1023,7 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
10211023

10221024
static void vhost_vdpa_clean_irq(struct vhost_vdpa *v)
10231025
{
1024-
int i;
1026+
u32 i;
10251027

10261028
for (i = 0; i < v->nvqs; i++)
10271029
vhost_vdpa_unsetup_vq_irq(v, i);

include/linux/vdpa.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct vdpa_device {
8383
unsigned int index;
8484
bool features_valid;
8585
bool use_va;
86-
int nvqs;
86+
u32 nvqs;
8787
struct vdpa_mgmt_dev *mdev;
8888
};
8989

@@ -338,10 +338,10 @@ struct vdpa_device *__vdpa_alloc_device(struct device *parent,
338338
dev_struct, member)), name, use_va), \
339339
dev_struct, member)
340340

341-
int vdpa_register_device(struct vdpa_device *vdev, int nvqs);
341+
int vdpa_register_device(struct vdpa_device *vdev, u32 nvqs);
342342
void vdpa_unregister_device(struct vdpa_device *vdev);
343343

344-
int _vdpa_register_device(struct vdpa_device *vdev, int nvqs);
344+
int _vdpa_register_device(struct vdpa_device *vdev, u32 nvqs);
345345
void _vdpa_unregister_device(struct vdpa_device *vdev);
346346

347347
/**

0 commit comments

Comments
 (0)