linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Marcel Holtmann <marcel@holtmann.org>,
	Jiri Slaby <jslaby@suse.com>, Arnd Bergmann <arnd@arndb.de>,
	"Dr . H . Nikolaus Schaller" <hns@goldelico.com>,
	Peter Hurley <peter@hurleysoftware.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Alan Cox <gnomes@lxorguk.ukuu.org.uk>,
	Loic Poulain <loic.poulain@intel.com>,
	Pavel Machek <pavel@ucw.cz>, NeilBrown <neil@brown.name>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/9] tty: move the non-file related parts of tty_release to new tty_release_struct
Date: Sun, 8 Jan 2017 23:42:48 +0100	[thread overview]
Message-ID: <20170108224248.pabp3z7jiclkzh5y@earth> (raw)
In-Reply-To: <20170106162635.19677-2-robh@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]

Hi,

On Fri, Jan 06, 2017 at 10:26:27AM -0600, Rob Herring wrote:
> For in-kernel tty users, we need to be able to create and destroy
> 'struct tty' that are not associated with a file. The creation side is
> fine, but tty_release() needs to be split into the file handle portion
> and the struct tty portion. Introduce a new function, tty_release_struct,
> to handle just the destroying of a struct tty.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/tty/tty_io.c | 42 ++++++++++++++++++++++++------------------
>  include/linux/tty.h  |  1 +
>  2 files changed, 25 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> index 734a635e7363..5ebc090ec47f 100644
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -1744,6 +1744,29 @@ static int tty_release_checks(struct tty_struct *tty, int idx)
>  	return 0;
>  }
>  
> +void tty_release_struct(struct tty_struct *tty, int idx)
> +{
> +	/*
> +	 * Ask the line discipline code to release its structures
> +	 */
> +	tty_ldisc_release(tty);
> +
> +	/* Wait for pending work before tty destruction commmences */
> +	tty_flush_works(tty);
> +
> +	tty_debug_hangup(tty, "freeing structure\n");
> +	/*
> +	 * The release_tty function takes care of the details of clearing
> +	 * the slots and preserving the termios structure. The tty_unlock_pair
> +	 * should be safe as we keep a kref while the tty is locked (so the
> +	 * unlock never unlocks a freed tty).
> +	 */
> +	mutex_lock(&tty_mutex);
> +	release_tty(tty, idx);
> +	mutex_unlock(&tty_mutex);
> +}
> +EXPORT_SYMBOL_GPL(tty_release_struct);

tty_release_struct() is missing kernel docs.

> [...]

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-01-08 22:43 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 16:26 [PATCH 0/9] Serial slave device bus Rob Herring
2017-01-06 16:26 ` [PATCH 1/9] tty: move the non-file related parts of tty_release to new tty_release_struct Rob Herring
2017-01-08 22:42   ` Sebastian Reichel [this message]
2017-01-06 16:26 ` [PATCH 2/9] tty_port: allow a port to be opened with a tty that has no file handle Rob Herring
2017-01-13 16:46   ` Rob Herring
2017-01-06 16:26 ` [PATCH 3/9] tty_port: make tty_port_register_device wrap tty_port_register_device_attr Rob Herring
2017-01-06 16:26 ` [PATCH 4/9] tty: constify tty_ldisc_receive_buf buffer pointer Rob Herring
2017-01-06 16:26 ` [PATCH 5/9] tty_port: Add port client functions Rob Herring
2017-01-06 16:26 ` [PATCH 6/9] dt/bindings: Add a serial/UART attached device binding Rob Herring
2017-01-06 19:21   ` Arnd Bergmann
2017-01-06 20:41     ` Rob Herring
2017-01-10 19:50   ` One Thousand Gnomes
2017-01-10 21:41   ` Pavel Machek
2017-01-06 16:26 ` [PATCH 7/9] serdev: Introduce new bus for serial attached devices Rob Herring
2017-01-07 14:02   ` Andy Shevchenko
2017-01-12 20:13     ` Rob Herring
2017-01-08 22:41   ` Sebastian Reichel
2017-01-10 21:46   ` Pavel Machek
2017-01-12 19:53     ` Rob Herring
2017-01-06 16:26 ` [PATCH 8/9] serdev: add a tty port controller driver Rob Herring
2017-01-07 14:11   ` Andy Shevchenko
2017-01-12 16:01     ` Rob Herring
2017-01-13 15:04       ` Andy Shevchenko
2017-01-13 15:28         ` Rob Herring
2017-01-13 15:55           ` Andy Shevchenko
2017-01-10 22:04   ` Pavel Machek
2017-01-14  2:54     ` Rob Herring
2017-01-06 16:26 ` [PATCH 9/9] tty_port: register tty ports with serdev bus Rob Herring
2017-01-06 19:25 ` [PATCH 0/9] Serial slave device bus Arnd Bergmann
2017-01-07 11:00 ` Andy Shevchenko
2017-01-10 17:24   ` Rob Herring
2017-01-10 18:32     ` Marcel Holtmann
2017-01-08 22:46 ` Sebastian Reichel
2017-01-10 11:44 ` H. Nikolaus Schaller
2017-01-10 12:02   ` Marcel Holtmann
2017-01-10 12:10     ` H. Nikolaus Schaller
2017-01-10 12:20       ` Andy Shevchenko
2017-01-10 12:40         ` H. Nikolaus Schaller
     [not found]   ` <CAL_JsqL-VMQ+zCTN+4+PPPCY+-askp=H908s8R=EjjytzuC8yw@mail.gmail.com>
     [not found]     ` <39C27218-E564-4C7D-A8CD-8D7F654EE2B3@goldelico.com>
2017-01-13 14:48       ` Rob Herring
2017-01-16  6:46         ` H. Nikolaus Schaller
2017-01-10 12:05 ` Marcel Holtmann
2017-01-10 22:05 ` Pavel Machek

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=20170108224248.pabp3z7jiclkzh5y@earth \
    --to=sre@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=hns@goldelico.com \
    --cc=jslaby@suse.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=loic.poulain@intel.com \
    --cc=marcel@holtmann.org \
    --cc=neil@brown.name \
    --cc=pavel@ucw.cz \
    --cc=peter@hurleysoftware.com \
    --cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).