lkml.org 
[lkml]   [2019]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 1/3] tty: rename tty_kopen() and add new function tty_kopen_shared()
From
Date
Hi Uwe,

I wanted to test the set but unfortunately this
patch does not apply. See below for the apparent reason.

On 12/17/19 5:58 PM, Uwe Kleine-König wrote:
> Introduce a new function tty_kopen_shared() that yields a struct
> tty_struct. The semantic difference to tty_kopen() is that the tty is
> expected to be used already. So rename tty_kopen() to
> tty_kopen_exclusive() for clearness, adapt the single user and put the
> common code in a new static helper function.
>
> tty_kopen_shared is to be used to implement an LED trigger for tty
> devices in one of the next patches.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/staging/speakup/spk_ttyio.c | 2 +-
> drivers/tty/tty_io.c | 58 ++++++++++++++++++++---------
> include/linux/tty.h | 5 ++-
> 3 files changed, 44 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c
> index 5a9eff08cb96..e9db06eae875 100644
> --- a/drivers/staging/speakup/spk_ttyio.c
> +++ b/drivers/staging/speakup/spk_ttyio.c
> @@ -147,7 +147,7 @@ static int spk_ttyio_initialise_ldisc(struct spk_synth *synth)
> if (ret)
> return ret;
>
> - tty = tty_kopen(dev);
> + tty = tty_kopen_exclusive(dev);
> if (IS_ERR(tty))
> return PTR_ERR(tty);
>
> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> index a1453fe10862..b718666ce73c 100644
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -1875,22 +1875,7 @@ static struct tty_driver *tty_lookup_driver(dev_t device, struct file *filp,
> return driver;
> }
>
> -/**
> - * tty_kopen - open a tty device for kernel
> - * @device: dev_t of device to open
> - *
> - * Opens tty exclusively for kernel. Performs the driver lookup,
> - * makes sure it's not already opened and performs the first-time
> - * tty initialization.
> - *
> - * Returns the locked initialized &tty_struct
> - *
> - * Claims the global tty_mutex to serialize:
> - * - concurrent first-time tty initialization
> - * - concurrent tty driver removal w/ lookup
> - * - concurrent tty removal from driver table
> - */
> -struct tty_struct *tty_kopen(dev_t device)
> +static struct tty_struct *tty_kopen(dev_t device, int shared)
> {
> struct tty_struct *tty;
> struct tty_driver *driver;

In mainline, even in v5.5-rc2 we have here NULL assignment:

struct tty_driver *driver = NULL;

> @@ -1905,7 +1890,7 @@ struct tty_struct *tty_kopen(dev_t device)
>


--
Best regards,
Jacek Anaszewski

\
 
 \ /
  Last update: 2019-12-17 19:09    [W:0.069 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site