Re: [PATCH] misc: xilinx_sdfec: fix xsdfec_poll()'s return type

From: Luc Van Oostenryck
Date: Wed Nov 20 2019 - 13:02:35 EST


On Wed, Nov 20, 2019 at 03:59:24PM +0000, Dragan Cvetic wrote:
> Hi Luc,
>
> For the sake of my understanding I'd like to ask you when the .pole method is defined
> Why I'm asking this? I have a fairly new book (published in 2017) which suggests what is implemented in SDFEC driver.
>
> I'll test your suggestions and will come back to you soon.

Well, yes, it changed in July 2017.

The current definition can be found in include/linux/fs.h:
struct file_operations {
...
__poll_t (*poll) (struct file *, struct poll_table_struct *);
...

The main commit making the change is:
a3f8683bf7d5 ("->poll() methods should return __poll_t")


The result can be verified by compiling the driver with the command
make C=2 path/to/the/driver.o
which will use the static analyser 'sparse' to make additional checks
where the difference between 'unsigned int' and __poll_t will matter.
See Documentation/dev-tools/sparse.rst for more info about it.

Best regards,
-- Luc Van Oostenryck