Re: [PATCH 3/3] staging: fwserial: (coding style) Rewriting a call to a long function
From: Peter Hurley
Date: Fri Apr 01 2016 - 12:38:49 EST
Hi Dominique,
On 03/29/2016 10:14 AM, Dominique van den Broeck wrote:
> Fixing a lone row exceeding 80 columns so the only remaining warnings
> emitted by checkpatch.pl are missing comments on spinlocks and memory
> barriers.
>
> Signed-off-by: Dominique van den Broeck <domdevlin@xxxxxxx>
> ---
> drivers/staging/fwserial/fwserial.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
> index 4dd5304..c5f73ef 100644
> --- a/drivers/staging/fwserial/fwserial.c
> +++ b/drivers/staging/fwserial/fwserial.c
> @@ -1343,9 +1343,11 @@ static int fwtty_break_ctl(struct tty_struct *tty, int state)
>
> if (state == -1) {
> set_bit(STOP_TX, &port->flags);
> - ret = wait_event_interruptible_timeout(port->wait_tx,
> - !test_bit(IN_TX, &port->flags),
> - 10);
> + ret =
> + wait_event_interruptible_timeout(port->wait_tx,
> + !test_bit(IN_TX, &port->flags),
> + 10);
> +
I don't see a > 80-col line here?
And even if I did, this change would be super-ugly.
The preferred way to reduce this is to fold it into a helper function, like
if (state == -1 && fwtty_wait_tx_complete(port))
return -EINTR;
Regards,
Peter Hurley
> if (ret == 0 || ret == -ERESTARTSYS) {
> clear_bit(STOP_TX, &port->flags);
> fwtty_restart_tx(port);
>