mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
pps: Use pps_lookup_dev to reduce ldisc coupling
commit 03a7ffe4e5
upstream.
Now that N_TTY uses tty->disc_data for its private data,
'subclass' ldiscs cannot use ->disc_data for their own private data.
(This is a regression is v3.8-rc1)
Use pps_lookup_dev to associate the tty with the pps source instead.
This fixes a crashing regression in 3.8-rc1.
Signed-off-by: George Spelvin <linux@horizon.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Qiang Huang <h.huangqiang@huawei.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Jianguo Wu <wujianguo@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
71a5218987
commit
0965dca06d
1 changed files with 4 additions and 6 deletions
|
@ -31,7 +31,7 @@
|
|||
static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status,
|
||||
struct pps_event_time *ts)
|
||||
{
|
||||
struct pps_device *pps = (struct pps_device *)tty->disc_data;
|
||||
struct pps_device *pps = pps_lookup_dev(tty);
|
||||
|
||||
BUG_ON(pps == NULL);
|
||||
|
||||
|
@ -67,9 +67,9 @@ static int pps_tty_open(struct tty_struct *tty)
|
|||
pr_err("cannot register PPS source \"%s\"\n", info.path);
|
||||
return -ENOMEM;
|
||||
}
|
||||
tty->disc_data = pps;
|
||||
pps->lookup_cookie = tty;
|
||||
|
||||
/* Should open N_TTY ldisc too */
|
||||
/* Now open the base class N_TTY ldisc */
|
||||
ret = alias_n_tty_open(tty);
|
||||
if (ret < 0) {
|
||||
pr_err("cannot open tty ldisc \"%s\"\n", info.path);
|
||||
|
@ -81,7 +81,6 @@ static int pps_tty_open(struct tty_struct *tty)
|
|||
return 0;
|
||||
|
||||
err_unregister:
|
||||
tty->disc_data = NULL;
|
||||
pps_unregister_source(pps);
|
||||
return ret;
|
||||
}
|
||||
|
@ -90,11 +89,10 @@ static void (*alias_n_tty_close)(struct tty_struct *tty);
|
|||
|
||||
static void pps_tty_close(struct tty_struct *tty)
|
||||
{
|
||||
struct pps_device *pps = (struct pps_device *)tty->disc_data;
|
||||
struct pps_device *pps = pps_lookup_dev(tty);
|
||||
|
||||
alias_n_tty_close(tty);
|
||||
|
||||
tty->disc_data = NULL;
|
||||
dev_info(pps->dev, "removed\n");
|
||||
pps_unregister_source(pps);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue