diff options
| author | George Spelvin <linux@horizon.com> | 2013-02-10 04:41:56 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-13 12:40:35 -0500 |
| commit | 03a7ffe4e542310838bac70ef85acc17536b6d7c (patch) | |
| tree | 2649b0ec20b7c3e4df18bf2da2a76dc64c01f94d /drivers/pps | |
| parent | 513b032c98b4b9414aa4e9b4a315cb1bf0380101 (diff) | |
pps: Use pps_lookup_dev to reduce ldisc coupling
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>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pps')
| -rw-r--r-- | drivers/pps/clients/pps-ldisc.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c index 79451f2dea6a..60cee9e0ecb3 100644 --- a/drivers/pps/clients/pps-ldisc.c +++ b/drivers/pps/clients/pps-ldisc.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status, | 31 | static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status, |
| 32 | struct pps_event_time *ts) | 32 | struct pps_event_time *ts) |
| 33 | { | 33 | { |
| 34 | struct pps_device *pps = (struct pps_device *)tty->disc_data; | 34 | struct pps_device *pps = pps_lookup_dev(tty); |
| 35 | 35 | ||
| 36 | BUG_ON(pps == NULL); | 36 | BUG_ON(pps == NULL); |
| 37 | 37 | ||
| @@ -67,9 +67,9 @@ static int pps_tty_open(struct tty_struct *tty) | |||
| 67 | pr_err("cannot register PPS source \"%s\"\n", info.path); | 67 | pr_err("cannot register PPS source \"%s\"\n", info.path); |
| 68 | return -ENOMEM; | 68 | return -ENOMEM; |
| 69 | } | 69 | } |
| 70 | tty->disc_data = pps; | 70 | pps->lookup_cookie = tty; |
| 71 | 71 | ||
| 72 | /* Should open N_TTY ldisc too */ | 72 | /* Now open the base class N_TTY ldisc */ |
| 73 | ret = alias_n_tty_open(tty); | 73 | ret = alias_n_tty_open(tty); |
| 74 | if (ret < 0) { | 74 | if (ret < 0) { |
| 75 | pr_err("cannot open tty ldisc \"%s\"\n", info.path); | 75 | pr_err("cannot open tty ldisc \"%s\"\n", info.path); |
| @@ -81,7 +81,6 @@ static int pps_tty_open(struct tty_struct *tty) | |||
| 81 | return 0; | 81 | return 0; |
| 82 | 82 | ||
| 83 | err_unregister: | 83 | err_unregister: |
| 84 | tty->disc_data = NULL; | ||
| 85 | pps_unregister_source(pps); | 84 | pps_unregister_source(pps); |
| 86 | return ret; | 85 | return ret; |
| 87 | } | 86 | } |
| @@ -90,11 +89,10 @@ static void (*alias_n_tty_close)(struct tty_struct *tty); | |||
| 90 | 89 | ||
| 91 | static void pps_tty_close(struct tty_struct *tty) | 90 | static void pps_tty_close(struct tty_struct *tty) |
| 92 | { | 91 | { |
| 93 | struct pps_device *pps = (struct pps_device *)tty->disc_data; | 92 | struct pps_device *pps = pps_lookup_dev(tty); |
| 94 | 93 | ||
| 95 | alias_n_tty_close(tty); | 94 | alias_n_tty_close(tty); |
| 96 | 95 | ||
| 97 | tty->disc_data = NULL; | ||
| 98 | dev_info(pps->dev, "removed\n"); | 96 | dev_info(pps->dev, "removed\n"); |
| 99 | pps_unregister_source(pps); | 97 | pps_unregister_source(pps); |
| 100 | } | 98 | } |
