Re: [PATCH] gpiolib: fix compiling when CONFIG_GPIO_CDEV_V1 is not defined

From: Andy Shevchenko
Date: Fri Dec 02 2022 - 09:30:49 EST


On Fri, Dec 02, 2022 at 03:04:54PM +0100, Nick Hainke wrote:

Thank you for the report!

I believe Bart needs to fold it into his patch / PR, because
it's not good to send a broken PR to Linus.

> If CONFIG_GPIO_CDEV_V1 is not defined compiling will fail with:
>
> drivers/gpio/gpiolib-cdev.c: In function 'linereq_ioctl':
> drivers/gpio/gpiolib-cdev.c:1468:16: error: implicit declaration of
> function 'call_ioctl_locked' [-Werror=implicit-function-declaration]
> 1468 | return call_ioctl_locked(file, cmd, arg, lr->gdev,
> | ^~~~~~~~~~~~~~~~~
> drivers/gpio/gpiolib-cdev.c: In function 'linereq_poll':
> drivers/gpio/gpiolib-cdev.c:1503:16: error: implicit declaration of
> function 'call_poll_locked'; did you mean 'wake_up_all_locked'?
> [-Werror=implicit-function-declaration]
> 1503 | return call_poll_locked(file, wait, lr->gdev,
> linereq_poll_unlocked);
> | ^~~~~~~~~~~~~~~~
> | wake_up_all_locked
> drivers/gpio/gpiolib-cdev.c: In function 'linereq_read':
> drivers/gpio/gpiolib-cdev.c:1566:16: error: implicit declaration of
> function 'call_read_locked'; did you mean 'xa_head_locked'?
> [-Werror=implicit-function-declaration]
> 1566 | return call_read_locked(file, buf, count, f_ps, lr->gdev,
> | ^~~~~~~~~~~~~~~~
> | xa_head_locked

Above is a bit too noisy for the commit message. It can be trimmed 3x times.

> Move "call_poll_locked", "call_ioctl_locked", "call_read_locked" and
> the necessary typedefs "poll_fn", "ioctl_fn", "read_fn" in front of the
> ifdef-statement checking CONFIG_GPIO_CDEV_V1.

> Fixes: 98d8b93c6171 ("gpiolib: protect the GPIO device against being dropped while in use by user-space")
>
> Signed-off-by: Nick Hainke <vincent@xxxxxxxxxxxx>

Mustn't be blank line(s) in the tag block.

--
With Best Regards,
Andy Shevchenko