[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f95e669-fba3-32e6-cdb9-41fb415b3b82@cambridgegreys.com>
Date: Thu, 4 Nov 2021 14:11:22 +0000
From: Anton Ivanov <anton.ivanov@...bridgegreys.com>
To: davidcomponentone@...il.com, jdike@...toit.com
Cc: richard@....at, johannes.berg@...el.com, yang.guang5@....com.cn,
linux-um@...ts.infradead.org, linux-kernel@...r.kernel.org,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] um: use swap() to make code cleaner
On 04/11/2021 06:16, davidcomponentone@...il.com wrote:
> From: Yang Guang <yang.guang5@....com.cn>
>
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Yang Guang <yang.guang5@....com.cn>
> ---
> arch/um/os-Linux/sigio.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
> index 9e71794839e8..1eb15f3cfdc8 100644
> --- a/arch/um/os-Linux/sigio.c
> +++ b/arch/um/os-Linux/sigio.c
> @@ -50,7 +50,7 @@ static struct pollfds all_sigio_fds;
>
> static int write_sigio_thread(void *unused)
> {
> - struct pollfds *fds, tmp;
> + struct pollfds *fds;
> struct pollfd *p;
> int i, n, respond_fd;
> char c;
> @@ -77,9 +77,7 @@ static int write_sigio_thread(void *unused)
> "write_sigio_thread : "
> "read on socket failed, "
> "err = %d\n", errno);
> - tmp = current_poll;
> - current_poll = next_poll;
> - next_poll = tmp;
> + swap(current_poll, next_poll);
> respond_fd = sigio_private[1];
> }
> else {
>
You should include minmax.h for the swap macro. While there is a very significant likelihood that it will be pulled up by another something else, it is better to do that explicitly.
--
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/
Powered by blists - more mailing lists