2017-07-09 11:44:35

by Okash Khawaja

[permalink] [raw]
Subject: [patch 2/3] staging: speakup: use tty_kopen instead of tty_open_by_driver

This patch replaces call to tty_open_by_driver with a tty_kopen.

Signed-off-by: Okash Khawaja <[email protected]>

---
drivers/staging/speakup/spk_ttyio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -164,7 +164,7 @@ static int spk_ttyio_initialise_ldisc(st
if (ret)
return ret;

- tty = tty_open_by_driver(dev, NULL, NULL);
+ tty = tty_kopen(dev);
if (IS_ERR(tty))
return PTR_ERR(tty);



2017-07-09 11:51:01

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [patch 2/3] staging: speakup: use tty_kopen instead of tty_open_by_driver

On Sun, Jul 09, 2017 at 12:41:55PM +0100, Okash Khawaja wrote:
> This patch replaces call to tty_open_by_driver with a tty_kopen.
>
> Signed-off-by: Okash Khawaja <[email protected]>
>
> ---
> drivers/staging/speakup/spk_ttyio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/staging/speakup/spk_ttyio.c
> +++ b/drivers/staging/speakup/spk_ttyio.c
> @@ -164,7 +164,7 @@ static int spk_ttyio_initialise_ldisc(st
> if (ret)
> return ret;
>
> - tty = tty_open_by_driver(dev, NULL, NULL);
> + tty = tty_kopen(dev);
> if (IS_ERR(tty))

Hm, the "no tty layer" return value for this will be NULL. I doubt
that's really a big deal, but perhaps just have that return
PTR_ERR(-ENODEV) or something?

thanks,

greg k-h

2017-07-09 12:28:36

by Okash Khawaja

[permalink] [raw]
Subject: Re: [patch 2/3] staging: speakup: use tty_kopen instead of tty_open_by_driver

On Sun, Jul 09, 2017 at 01:50:55PM +0200, Greg Kroah-Hartman wrote:
> On Sun, Jul 09, 2017 at 12:41:55PM +0100, Okash Khawaja wrote:
> > This patch replaces call to tty_open_by_driver with a tty_kopen.
> >
> > Signed-off-by: Okash Khawaja <[email protected]>
> >
> > ---
> > drivers/staging/speakup/spk_ttyio.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- a/drivers/staging/speakup/spk_ttyio.c
> > +++ b/drivers/staging/speakup/spk_ttyio.c
> > @@ -164,7 +164,7 @@ static int spk_ttyio_initialise_ldisc(st
> > if (ret)
> > return ret;
> >
> > - tty = tty_open_by_driver(dev, NULL, NULL);
> > + tty = tty_kopen(dev);
> > if (IS_ERR(tty))
>
> Hm, the "no tty layer" return value for this will be NULL. I doubt
> that's really a big deal, but perhaps just have that return
> PTR_ERR(-ENODEV) or something?
Good point, thanks. Will send a follow up patch

Okash