2021-02-19 09:30:32

by Yejune Deng

[permalink] [raw]
Subject: [PATCH] virt: acrn: Use vfs_poll() instead of f_op->poll()

In acrn_irqfd_assign(), use vfs_poll() is a more advanced function,
as the same time, modify the definition of events.

Signed-off-by: Yejune Deng <[email protected]>
---
drivers/virt/acrn/irqfd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/virt/acrn/irqfd.c b/drivers/virt/acrn/irqfd.c
index a8766d528e29..19890396e174 100644
--- a/drivers/virt/acrn/irqfd.c
+++ b/drivers/virt/acrn/irqfd.c
@@ -112,9 +112,9 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)
{
struct eventfd_ctx *eventfd = NULL;
struct hsm_irqfd *irqfd, *tmp;
- unsigned int events;
struct fd f;
int ret = 0;
+ __poll_t events;

irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL);
if (!irqfd)
@@ -158,7 +158,7 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)
mutex_unlock(&vm->irqfds_lock);

/* Check the pending event in this stage */
- events = f.file->f_op->poll(f.file, &irqfd->pt);
+ events = vfs_poll(f.file, &irqfd->pt);

if (events & POLLIN)
acrn_irqfd_inject(irqfd);
--
2.29.0


2021-02-20 09:52:46

by Shuo Liu

[permalink] [raw]
Subject: Re: [PATCH] virt: acrn: Use vfs_poll() instead of f_op->poll()

Thanks for the patch.

On Fri 19.Feb'21 at 17:26:12 +0800, Yejune Deng wrote:
>In acrn_irqfd_assign(), use vfs_poll() is a more advanced function,
>as the same time, modify the definition of events.
>
>Signed-off-by: Yejune Deng <[email protected]>
>---
> drivers/virt/acrn/irqfd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/virt/acrn/irqfd.c b/drivers/virt/acrn/irqfd.c
>index a8766d528e29..19890396e174 100644
>--- a/drivers/virt/acrn/irqfd.c
>+++ b/drivers/virt/acrn/irqfd.c
>@@ -112,9 +112,9 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)
> {
> struct eventfd_ctx *eventfd = NULL;
> struct hsm_irqfd *irqfd, *tmp;
>- unsigned int events;
> struct fd f;
> int ret = 0;
>+ __poll_t events;

Can you keep variable declarations is reverse fir tree order which this
driver follows?

>
> irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL);
> if (!irqfd)
>@@ -158,7 +158,7 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)
> mutex_unlock(&vm->irqfds_lock);
>
> /* Check the pending event in this stage */
>- events = f.file->f_op->poll(f.file, &irqfd->pt);
>+ events = vfs_poll(f.file, &irqfd->pt);
>
> if (events & POLLIN)
> acrn_irqfd_inject(irqfd);
>--
>2.29.0
>

2021-02-20 11:09:32

by Yejune Deng

[permalink] [raw]
Subject: Re: [PATCH] virt: acrn: Use vfs_poll() instead of f_op->poll()

OK,I will adopt it and resubmit.


On Sat, Feb 20, 2021 at 5:48 PM Shuo A Liu <[email protected]> wrote:
>
> Thanks for the patch.
>
> On Fri 19.Feb'21 at 17:26:12 +0800, Yejune Deng wrote:
> >In acrn_irqfd_assign(), use vfs_poll() is a more advanced function,
> >as the same time, modify the definition of events.
> >
> >Signed-off-by: Yejune Deng <[email protected]>
> >---
> > drivers/virt/acrn/irqfd.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/virt/acrn/irqfd.c b/drivers/virt/acrn/irqfd.c
> >index a8766d528e29..19890396e174 100644
> >--- a/drivers/virt/acrn/irqfd.c
> >+++ b/drivers/virt/acrn/irqfd.c
> >@@ -112,9 +112,9 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)
> > {
> > struct eventfd_ctx *eventfd = NULL;
> > struct hsm_irqfd *irqfd, *tmp;
> >- unsigned int events;
> > struct fd f;
> > int ret = 0;
> >+ __poll_t events;
>
> Can you keep variable declarations is reverse fir tree order which this
> driver follows?
>
> >
> > irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL);
> > if (!irqfd)
> >@@ -158,7 +158,7 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)
> > mutex_unlock(&vm->irqfds_lock);
> >
> > /* Check the pending event in this stage */
> >- events = f.file->f_op->poll(f.file, &irqfd->pt);
> >+ events = vfs_poll(f.file, &irqfd->pt);
> >
> > if (events & POLLIN)
> > acrn_irqfd_inject(irqfd);
> >--
> >2.29.0
> >