mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: dhowells@redhat.com, linux-arch@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH 1/8] start unifying termios convertors
Date: Mon, 10 Sep 2018 09:32:34 +0100	[thread overview]
Message-ID: <3018.1536568354@warthog.procyon.org.uk> (raw)
In-Reply-To: <20180910045227.9895-1-viro@ZenIV.linux.org.uk>

Al Viro <viro@ZenIV.linux.org.uk> wrote:

> +static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
> +						 struct ktermios *k)
> +{
> +	int err;
> +	err  = put_user(k->c_iflag, &u->c_iflag);
> +	err |= put_user(k->c_oflag, &u->c_oflag);
> +	err |= put_user(k->c_cflag, &u->c_cflag);
> +	err |= put_user(k->c_lflag, &u->c_lflag);
> +	err |= put_user(k->c_line, &u->c_line);
> +	err |= copy_to_user(u->c_cc, k->c_cc, NCCS);
> +	if (!(k->c_lflag & ICANON)) {
> +		err |= put_user(k->c_cc[VMIN],  &u->c_cc[_VMIN]);
> +		err |= put_user(k->c_cc[VTIME], &u->c_cc[_VTIME]);
> +	} else {
> +		err |= put_user(k->c_cc[VEOF], &u->c_cc[VEOF]);
> +		err |= put_user(k->c_cc[VEOL], &u->c_cc[VEOL]);
> +	}
> +	err |= put_user(k->c_ispeed, &u->c_ispeed);
> +	err |= put_user(k->c_ospeed, &u->c_ospeed);
> +	return err;
> +}

Can you make this use || instead of |= ?  That way if put_user() uses a
goto-out-of-asm it may be a lot more efficient, both in the normal case and
the error case.

David

      parent reply	other threads:[~2018-09-10  8:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10  4:49 [RFC][PATCHES] termios.h cleanups Al Viro
2018-09-10  4:52 ` [RFC][PATCH 1/8] start unifying termios convertors Al Viro
2018-09-10  4:52   ` [RFC][PATCH 2/8] move user_termio_to_kernel_termios/kernel_termios_to_user_termio Al Viro
2018-09-10  4:52   ` [RFC][PATCH 3/8] remove termios-base.h Al Viro
2018-09-10  4:52   ` [RFC][PATCH 4/8] make users of INIT_C_CC pull linux/termios_internal.h Al Viro
2018-09-10  4:52   ` [RFC][PATCH 5/8] make generic INIT_C_CC a bit more generic Al Viro
2018-09-10  4:52   ` [RFC][PATCH 6/8] untangle asm/termios.h mess Al Viro
2018-09-10  4:52   ` [RFC][PATCH 7/8] switch x86 to generic uapi asm/termios.h Al Viro
2018-09-10  4:52   ` [RFC][PATCH 8/8] really consolidate INIT_C_CC definitions Al Viro
2018-09-10 13:33     ` Linus Torvalds
2018-09-10 14:45       ` Al Viro
2018-09-10  8:32 ` David Howells [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3018.1536568354@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome