All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Okash Khawaja <okash.khawaja@gmail.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Gregory Nowak <greg@gregn.net>,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	Kirk Reiser <kirk@reisers.ca>,
	Peter Hurley <peter@hurleysoftware.com>,
	Jiri Slaby <jslaby@suse.com>,
	speakup@linux-speakup.org, John Covici <covici@ccs.covici.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	Chris Brannon <chris@the-brannons.com>
Subject: Re: [PATCH 1/2] vt: selection: allow functions to be called from inside kernel
Date: Tue, 16 Apr 2019 13:37:40 +0200	[thread overview]
Message-ID: <20190416113740.GA18054@kroah.com> (raw)
In-Reply-To: <20190404194530.1170-2-okash.khawaja@gmail.com>

On Thu, Apr 04, 2019 at 08:45:29PM +0100, Okash Khawaja wrote:
> This patch breaks set_selection() into two functions so that when
> called from kernel, copy_from_user() can be avoided. It also exports
> set_selection() and paste_selection().
> 
> These changes are used the following patch where speakup's selection
> functionality calls into the above functions, thereby doing away with
> parallel implementation.
> 
> Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> Tested-by: Gregory Nowak <greg@gregn.net>
> ---
>  drivers/tty/vt/selection.c | 37 ++++++++++++++++++++++++-------------
>  include/linux/selection.h  |  3 +--
>  2 files changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
> index 07496c711d7d..a43f9cd9bdd6 100644
> --- a/drivers/tty/vt/selection.c
> +++ b/drivers/tty/vt/selection.c
> @@ -80,6 +80,7 @@ void clear_selection(void)
>  		sel_start = -1;
>  	}
>  }
> +EXPORT_SYMBOL_GPL(clear_selection);
>  
>  /*
>   * User settable table: what characters are to be considered alphabetic?
> @@ -164,34 +165,42 @@ static int store_utf8(u32 c, char *p)
>   *	 a lot under the lock but its hardly a performance path
>   */
>  int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty)
> +{
> +	struct tiocl_selection v;
> +
> +	if (copy_from_user(&v, sel, sizeof(*sel)))
> +		return -EFAULT;
> +
> +	return do_set_selection(&v, tty);
> +}
> +
> +int do_set_selection(struct tiocl_selection *v, struct tty_struct *tty)

I have no idea what the difference is between set_selection() and
do_set_selection() is now.  Naming is hard, I know :(

How about set_selection_kernel()?  set_selection_tiocl()?

Something to show that one takes a userspace pointer, and the other a
kernel pointer, how about:
	set_selection_user()
	set_selection_kernel()
making it more obvious?

thanks,

greg k-h

  parent reply	other threads:[~2019-04-16 11:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04 19:45 [PATCH 0/2] staging: speakup: factor out selection code Okash Khawaja
2019-04-04 19:45 ` [PATCH 1/2] vt: selection: allow functions to be called from inside kernel Okash Khawaja
2019-04-04 20:35   ` Greg Kroah-Hartman
2019-04-04 20:48     ` Samuel Thibault
2019-04-16 11:37   ` Greg Kroah-Hartman [this message]
2019-04-04 19:45 ` [PATCH 2/2] staging: speakup: refactor to use existing code in vt Okash Khawaja
2019-04-17 12:21 ` [PATCH v2 0/2] staging: speakup: factor out selection code Okash Khawaja
2019-04-17 12:21   ` [PATCH v2 1/2] vt: selection: allow functions to be called from inside kernel Okash Khawaja
2019-04-17 12:21   ` [PATCH v2 2/2] staging: speakup: refactor to use existing code in vt Okash Khawaja
2019-04-19 13:11   ` [PATCH v2 0/2] staging: speakup: factor out selection code Greg Kroah-Hartman

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=20190416113740.GA18054@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=ben@decadent.org.uk \
    --cc=chris@the-brannons.com \
    --cc=covici@ccs.covici.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=greg@gregn.net \
    --cc=jslaby@suse.com \
    --cc=kirk@reisers.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okash.khawaja@gmail.com \
    --cc=peter@hurleysoftware.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=speakup@linux-speakup.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.