2020-02-14 16:09:16

by Sasha Levin

[permalink] [raw]
Subject: [PATCH AUTOSEL 5.4 299/459] misc: xilinx_sdfec: fix xsdfec_poll()'s return type

From: Luc Van Oostenryck <[email protected]>

[ Upstream commit fa4e7fc1386078edcfddd8848cb0374f4af74fe7 ]

xsdfec_poll() is defined as returning 'unsigned int' but the
.poll method is declared as returning '__poll_t', a bitwise type.

Fix this by using the proper return type and using the EPOLL
constants instead of the POLL ones, as required for __poll_t.

CC: Derek Kiernan <[email protected]>
CC: Dragan Cvetic <[email protected]>
Signed-off-by: Luc Van Oostenryck <[email protected]>
Acked-by: Dragan Cvetic <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/misc/xilinx_sdfec.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 11835969e9828..48ba7e02bed72 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -1025,25 +1025,25 @@ static long xsdfec_dev_compat_ioctl(struct file *file, unsigned int cmd,
}
#endif

-static unsigned int xsdfec_poll(struct file *file, poll_table *wait)
+static __poll_t xsdfec_poll(struct file *file, poll_table *wait)
{
- unsigned int mask = 0;
+ __poll_t mask = 0;
struct xsdfec_dev *xsdfec;

xsdfec = container_of(file->private_data, struct xsdfec_dev, miscdev);

if (!xsdfec)
- return POLLNVAL | POLLHUP;
+ return EPOLLNVAL | EPOLLHUP;

poll_wait(file, &xsdfec->waitq, wait);

/* XSDFEC ISR detected an error */
spin_lock_irqsave(&xsdfec->error_data_lock, xsdfec->flags);
if (xsdfec->state_updated)
- mask |= POLLIN | POLLPRI;
+ mask |= EPOLLIN | EPOLLPRI;

if (xsdfec->stats_updated)
- mask |= POLLIN | POLLRDNORM;
+ mask |= EPOLLIN | EPOLLRDNORM;
spin_unlock_irqrestore(&xsdfec->error_data_lock, xsdfec->flags);

return mask;
--
2.20.1


2020-02-15 20:53:47

by Dragan Cvetic

[permalink] [raw]
Subject: RE: [PATCH AUTOSEL 5.4 299/459] misc: xilinx_sdfec: fix xsdfec_poll()'s return type



> -----Original Message-----
> From: Sasha Levin <[email protected]>
> Sent: Friday 14 February 2020 15:59
> To: [email protected]; [email protected]
> Cc: Luc Van Oostenryck <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic
> <[email protected]>; Greg Kroah-Hartman <[email protected]>; Sasha Levin <[email protected]>; linux-arm-
> [email protected]
> Subject: [PATCH AUTOSEL 5.4 299/459] misc: xilinx_sdfec: fix xsdfec_poll()'s return type
>
> From: Luc Van Oostenryck <[email protected]>
>
> [ Upstream commit fa4e7fc1386078edcfddd8848cb0374f4af74fe7 ]
>
> xsdfec_poll() is defined as returning 'unsigned int' but the
> .poll method is declared as returning '__poll_t', a bitwise type.
>
> Fix this by using the proper return type and using the EPOLL
> constants instead of the POLL ones, as required for __poll_t.
>
> CC: Derek Kiernan <[email protected]>
> CC: Dragan Cvetic <[email protected]>
> Signed-off-by: Luc Van Oostenryck <[email protected]>
> Acked-by: Dragan Cvetic <[email protected]>
> Link: https://lore.kernel.org/r/[email protected]
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>
> ---
> drivers/misc/xilinx_sdfec.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
> index 11835969e9828..48ba7e02bed72 100644
> --- a/drivers/misc/xilinx_sdfec.c
> +++ b/drivers/misc/xilinx_sdfec.c
> @@ -1025,25 +1025,25 @@ static long xsdfec_dev_compat_ioctl(struct file *file, unsigned int cmd,
> }
> #endif
>
> -static unsigned int xsdfec_poll(struct file *file, poll_table *wait)
> +static __poll_t xsdfec_poll(struct file *file, poll_table *wait)
> {
> - unsigned int mask = 0;
> + __poll_t mask = 0;
> struct xsdfec_dev *xsdfec;
>
> xsdfec = container_of(file->private_data, struct xsdfec_dev, miscdev);
>
> if (!xsdfec)
> - return POLLNVAL | POLLHUP;
> + return EPOLLNVAL | EPOLLHUP;
>
> poll_wait(file, &xsdfec->waitq, wait);
>
> /* XSDFEC ISR detected an error */
> spin_lock_irqsave(&xsdfec->error_data_lock, xsdfec->flags);
> if (xsdfec->state_updated)
> - mask |= POLLIN | POLLPRI;
> + mask |= EPOLLIN | EPOLLPRI;
>
> if (xsdfec->stats_updated)
> - mask |= POLLIN | POLLRDNORM;
> + mask |= EPOLLIN | EPOLLRDNORM;
> spin_unlock_irqrestore(&xsdfec->error_data_lock, xsdfec->flags);
>
> return mask;
> --
> 2.20.1

Acked-by: Dragan Cvetic <[email protected]>