diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 14:24:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 14:24:39 -0400 |
commit | 843ec558f91b8e8fdb6efc908f2c0506407cc750 (patch) | |
tree | 1866dccbc298390fc8686875942324075fd83f9d /drivers/isdn | |
parent | 71e7ff2578c3bc67fd893a9ba7f69fd563f271de (diff) | |
parent | fb8ebec00b04f921ea1614a7303f1a8e5e9e47c5 (diff) |
Merge tag 'tty-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull TTY/serial patches from Greg KH:
"tty and serial merge for 3.4-rc1
Here's the big serial and tty merge for the 3.4-rc1 tree.
There's loads of fixes and reworks in here from Jiri for the tty
layer, and a number of patches from Alan to help try to wrestle the vt
layer into a sane model.
Other than that, lots of driver updates and fixes, and other minor
stuff, all detailed in the shortlog."
* tag 'tty-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (132 commits)
serial: pxa: add clk_prepare/clk_unprepare calls
TTY: Wrong unicode value copied in con_set_unimap()
serial: PL011: clear pending interrupts
serial: bfin-uart: Don't access tty circular buffer in TX DMA interrupt after it is reset.
vt: NULL dereference in vt_do_kdsk_ioctl()
tty: serial: vt8500: fix annotations for probe/remove
serial: remove back and forth conversions in serial_out_sync
serial: use serial_port_in/out vs serial_in/out in 8250
serial: introduce generic port in/out helpers
serial: reduce number of indirections in 8250 code
serial: delete useless void casts in 8250.c
serial: make 8250's serial_in shareable to other drivers.
serial: delete last unused traces of pausing I/O in 8250
pch_uart: Add module parameter descriptions
pch_uart: Use existing default_baud in setup_console
pch_uart: Add user_uartclk parameter
pch_uart: Add Fish River Island II uart clock quirks
pch_uart: Use uartclk instead of base_baud
mpc5200b/uart: select more tolerant uart prescaler on low baudrates
tty: moxa: fix bit test in moxa_start()
...
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/capi/capi.c | 13 | ||||
-rw-r--r-- | drivers/isdn/gigaset/common.c | 5 | ||||
-rw-r--r-- | drivers/isdn/gigaset/gigaset.h | 3 | ||||
-rw-r--r-- | drivers/isdn/gigaset/interface.c | 158 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_tty.c | 7 |
5 files changed, 42 insertions, 144 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index e44933d58790..3a7905b06e53 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -1013,16 +1013,12 @@ static const struct file_operations capi_fops = | |||
1013 | static int | 1013 | static int |
1014 | capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty) | 1014 | capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty) |
1015 | { | 1015 | { |
1016 | int idx = tty->index; | 1016 | struct capiminor *mp = capiminor_get(tty->index); |
1017 | struct capiminor *mp = capiminor_get(idx); | 1017 | int ret = tty_standard_install(driver, tty); |
1018 | int ret = tty_init_termios(tty); | ||
1019 | 1018 | ||
1020 | if (ret == 0) { | 1019 | if (ret == 0) |
1021 | tty_driver_kref_get(driver); | ||
1022 | tty->count++; | ||
1023 | tty->driver_data = mp; | 1020 | tty->driver_data = mp; |
1024 | driver->ttys[idx] = tty; | 1021 | else |
1025 | } else | ||
1026 | capiminor_put(mp); | 1022 | capiminor_put(mp); |
1027 | return ret; | 1023 | return ret; |
1028 | } | 1024 | } |
@@ -1290,7 +1286,6 @@ static int __init capinc_tty_init(void) | |||
1290 | kfree(capiminors); | 1286 | kfree(capiminors); |
1291 | return -ENOMEM; | 1287 | return -ENOMEM; |
1292 | } | 1288 | } |
1293 | drv->owner = THIS_MODULE; | ||
1294 | drv->driver_name = "capi_nc"; | 1289 | drv->driver_name = "capi_nc"; |
1295 | drv->name = "capi"; | 1290 | drv->name = "capi"; |
1296 | drv->major = 0; | 1291 | drv->major = 0; |
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index db621db67f61..880f6ef0e18d 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -720,12 +720,11 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
720 | 720 | ||
721 | tasklet_init(&cs->event_tasklet, gigaset_handle_event, | 721 | tasklet_init(&cs->event_tasklet, gigaset_handle_event, |
722 | (unsigned long) cs); | 722 | (unsigned long) cs); |
723 | tty_port_init(&cs->port); | ||
723 | cs->commands_pending = 0; | 724 | cs->commands_pending = 0; |
724 | cs->cur_at_seq = 0; | 725 | cs->cur_at_seq = 0; |
725 | cs->gotfwver = -1; | 726 | cs->gotfwver = -1; |
726 | cs->open_count = 0; | ||
727 | cs->dev = NULL; | 727 | cs->dev = NULL; |
728 | cs->tty = NULL; | ||
729 | cs->tty_dev = NULL; | 728 | cs->tty_dev = NULL; |
730 | cs->cidmode = cidmode != 0; | 729 | cs->cidmode = cidmode != 0; |
731 | cs->tabnocid = gigaset_tab_nocid; | 730 | cs->tabnocid = gigaset_tab_nocid; |
@@ -1051,8 +1050,6 @@ static struct cardstate *gigaset_get_cs_by_minor(unsigned minor) | |||
1051 | 1050 | ||
1052 | struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty) | 1051 | struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty) |
1053 | { | 1052 | { |
1054 | if (tty->index < 0 || tty->index >= tty->driver->num) | ||
1055 | return NULL; | ||
1056 | return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start); | 1053 | return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start); |
1057 | } | 1054 | } |
1058 | 1055 | ||
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 212efaf9a4e4..f877726d664b 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -433,8 +433,7 @@ struct cardstate { | |||
433 | spinlock_t cmdlock; | 433 | spinlock_t cmdlock; |
434 | unsigned curlen, cmdbytes; | 434 | unsigned curlen, cmdbytes; |
435 | 435 | ||
436 | unsigned open_count; | 436 | struct tty_port port; |
437 | struct tty_struct *tty; | ||
438 | struct tasklet_struct if_wake_tasklet; | 437 | struct tasklet_struct if_wake_tasklet; |
439 | unsigned control_state; | 438 | unsigned control_state; |
440 | 439 | ||
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index ee0a549a933a..8f8814afce86 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -146,13 +146,10 @@ static const struct tty_operations if_ops = { | |||
146 | static int if_open(struct tty_struct *tty, struct file *filp) | 146 | static int if_open(struct tty_struct *tty, struct file *filp) |
147 | { | 147 | { |
148 | struct cardstate *cs; | 148 | struct cardstate *cs; |
149 | unsigned long flags; | ||
150 | 149 | ||
151 | gig_dbg(DEBUG_IF, "%d+%d: %s()", | 150 | gig_dbg(DEBUG_IF, "%d+%d: %s()", |
152 | tty->driver->minor_start, tty->index, __func__); | 151 | tty->driver->minor_start, tty->index, __func__); |
153 | 152 | ||
154 | tty->driver_data = NULL; | ||
155 | |||
156 | cs = gigaset_get_cs_by_tty(tty); | 153 | cs = gigaset_get_cs_by_tty(tty); |
157 | if (!cs || !try_module_get(cs->driver->owner)) | 154 | if (!cs || !try_module_get(cs->driver->owner)) |
158 | return -ENODEV; | 155 | return -ENODEV; |
@@ -163,12 +160,10 @@ static int if_open(struct tty_struct *tty, struct file *filp) | |||
163 | } | 160 | } |
164 | tty->driver_data = cs; | 161 | tty->driver_data = cs; |
165 | 162 | ||
166 | ++cs->open_count; | 163 | ++cs->port.count; |
167 | 164 | ||
168 | if (cs->open_count == 1) { | 165 | if (cs->port.count == 1) { |
169 | spin_lock_irqsave(&cs->lock, flags); | 166 | tty_port_tty_set(&cs->port, tty); |
170 | cs->tty = tty; | ||
171 | spin_unlock_irqrestore(&cs->lock, flags); | ||
172 | tty->low_latency = 1; | 167 | tty->low_latency = 1; |
173 | } | 168 | } |
174 | 169 | ||
@@ -178,12 +173,10 @@ static int if_open(struct tty_struct *tty, struct file *filp) | |||
178 | 173 | ||
179 | static void if_close(struct tty_struct *tty, struct file *filp) | 174 | static void if_close(struct tty_struct *tty, struct file *filp) |
180 | { | 175 | { |
181 | struct cardstate *cs; | 176 | struct cardstate *cs = tty->driver_data; |
182 | unsigned long flags; | ||
183 | 177 | ||
184 | cs = (struct cardstate *) tty->driver_data; | 178 | if (!cs) { /* happens if we didn't find cs in open */ |
185 | if (!cs) { | 179 | printk(KERN_DEBUG "%s: no cardstate\n", __func__); |
186 | pr_err("%s: no cardstate\n", __func__); | ||
187 | return; | 180 | return; |
188 | } | 181 | } |
189 | 182 | ||
@@ -193,15 +186,10 @@ static void if_close(struct tty_struct *tty, struct file *filp) | |||
193 | 186 | ||
194 | if (!cs->connected) | 187 | if (!cs->connected) |
195 | gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */ | 188 | gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */ |
196 | else if (!cs->open_count) | 189 | else if (!cs->port.count) |
197 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | 190 | dev_warn(cs->dev, "%s: device not opened\n", __func__); |
198 | else { | 191 | else if (!--cs->port.count) |
199 | if (!--cs->open_count) { | 192 | tty_port_tty_set(&cs->port, NULL); |
200 | spin_lock_irqsave(&cs->lock, flags); | ||
201 | cs->tty = NULL; | ||
202 | spin_unlock_irqrestore(&cs->lock, flags); | ||
203 | } | ||
204 | } | ||
205 | 193 | ||
206 | mutex_unlock(&cs->mutex); | 194 | mutex_unlock(&cs->mutex); |
207 | 195 | ||
@@ -211,18 +199,12 @@ static void if_close(struct tty_struct *tty, struct file *filp) | |||
211 | static int if_ioctl(struct tty_struct *tty, | 199 | static int if_ioctl(struct tty_struct *tty, |
212 | unsigned int cmd, unsigned long arg) | 200 | unsigned int cmd, unsigned long arg) |
213 | { | 201 | { |
214 | struct cardstate *cs; | 202 | struct cardstate *cs = tty->driver_data; |
215 | int retval = -ENODEV; | 203 | int retval = -ENODEV; |
216 | int int_arg; | 204 | int int_arg; |
217 | unsigned char buf[6]; | 205 | unsigned char buf[6]; |
218 | unsigned version[4]; | 206 | unsigned version[4]; |
219 | 207 | ||
220 | cs = (struct cardstate *) tty->driver_data; | ||
221 | if (!cs) { | ||
222 | pr_err("%s: no cardstate\n", __func__); | ||
223 | return -ENODEV; | ||
224 | } | ||
225 | |||
226 | gig_dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __func__, cmd); | 208 | gig_dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __func__, cmd); |
227 | 209 | ||
228 | if (mutex_lock_interruptible(&cs->mutex)) | 210 | if (mutex_lock_interruptible(&cs->mutex)) |
@@ -231,9 +213,7 @@ static int if_ioctl(struct tty_struct *tty, | |||
231 | if (!cs->connected) { | 213 | if (!cs->connected) { |
232 | gig_dbg(DEBUG_IF, "not connected"); | 214 | gig_dbg(DEBUG_IF, "not connected"); |
233 | retval = -ENODEV; | 215 | retval = -ENODEV; |
234 | } else if (!cs->open_count) | 216 | } else { |
235 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | ||
236 | else { | ||
237 | retval = 0; | 217 | retval = 0; |
238 | switch (cmd) { | 218 | switch (cmd) { |
239 | case GIGASET_REDIR: | 219 | case GIGASET_REDIR: |
@@ -285,15 +265,9 @@ static int if_ioctl(struct tty_struct *tty, | |||
285 | 265 | ||
286 | static int if_tiocmget(struct tty_struct *tty) | 266 | static int if_tiocmget(struct tty_struct *tty) |
287 | { | 267 | { |
288 | struct cardstate *cs; | 268 | struct cardstate *cs = tty->driver_data; |
289 | int retval; | 269 | int retval; |
290 | 270 | ||
291 | cs = (struct cardstate *) tty->driver_data; | ||
292 | if (!cs) { | ||
293 | pr_err("%s: no cardstate\n", __func__); | ||
294 | return -ENODEV; | ||
295 | } | ||
296 | |||
297 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 271 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
298 | 272 | ||
299 | if (mutex_lock_interruptible(&cs->mutex)) | 273 | if (mutex_lock_interruptible(&cs->mutex)) |
@@ -309,16 +283,10 @@ static int if_tiocmget(struct tty_struct *tty) | |||
309 | static int if_tiocmset(struct tty_struct *tty, | 283 | static int if_tiocmset(struct tty_struct *tty, |
310 | unsigned int set, unsigned int clear) | 284 | unsigned int set, unsigned int clear) |
311 | { | 285 | { |
312 | struct cardstate *cs; | 286 | struct cardstate *cs = tty->driver_data; |
313 | int retval; | 287 | int retval; |
314 | unsigned mc; | 288 | unsigned mc; |
315 | 289 | ||
316 | cs = (struct cardstate *) tty->driver_data; | ||
317 | if (!cs) { | ||
318 | pr_err("%s: no cardstate\n", __func__); | ||
319 | return -ENODEV; | ||
320 | } | ||
321 | |||
322 | gig_dbg(DEBUG_IF, "%u: %s(0x%x, 0x%x)", | 290 | gig_dbg(DEBUG_IF, "%u: %s(0x%x, 0x%x)", |
323 | cs->minor_index, __func__, set, clear); | 291 | cs->minor_index, __func__, set, clear); |
324 | 292 | ||
@@ -341,16 +309,10 @@ static int if_tiocmset(struct tty_struct *tty, | |||
341 | 309 | ||
342 | static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) | 310 | static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) |
343 | { | 311 | { |
344 | struct cardstate *cs; | 312 | struct cardstate *cs = tty->driver_data; |
345 | struct cmdbuf_t *cb; | 313 | struct cmdbuf_t *cb; |
346 | int retval; | 314 | int retval; |
347 | 315 | ||
348 | cs = (struct cardstate *) tty->driver_data; | ||
349 | if (!cs) { | ||
350 | pr_err("%s: no cardstate\n", __func__); | ||
351 | return -ENODEV; | ||
352 | } | ||
353 | |||
354 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 316 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
355 | 317 | ||
356 | if (mutex_lock_interruptible(&cs->mutex)) | 318 | if (mutex_lock_interruptible(&cs->mutex)) |
@@ -361,11 +323,6 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) | |||
361 | retval = -ENODEV; | 323 | retval = -ENODEV; |
362 | goto done; | 324 | goto done; |
363 | } | 325 | } |
364 | if (!cs->open_count) { | ||
365 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | ||
366 | retval = -ENODEV; | ||
367 | goto done; | ||
368 | } | ||
369 | if (cs->mstate != MS_LOCKED) { | 326 | if (cs->mstate != MS_LOCKED) { |
370 | dev_warn(cs->dev, "can't write to unlocked device\n"); | 327 | dev_warn(cs->dev, "can't write to unlocked device\n"); |
371 | retval = -EBUSY; | 328 | retval = -EBUSY; |
@@ -397,15 +354,9 @@ done: | |||
397 | 354 | ||
398 | static int if_write_room(struct tty_struct *tty) | 355 | static int if_write_room(struct tty_struct *tty) |
399 | { | 356 | { |
400 | struct cardstate *cs; | 357 | struct cardstate *cs = tty->driver_data; |
401 | int retval = -ENODEV; | 358 | int retval = -ENODEV; |
402 | 359 | ||
403 | cs = (struct cardstate *) tty->driver_data; | ||
404 | if (!cs) { | ||
405 | pr_err("%s: no cardstate\n", __func__); | ||
406 | return -ENODEV; | ||
407 | } | ||
408 | |||
409 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 360 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
410 | 361 | ||
411 | if (mutex_lock_interruptible(&cs->mutex)) | 362 | if (mutex_lock_interruptible(&cs->mutex)) |
@@ -414,9 +365,7 @@ static int if_write_room(struct tty_struct *tty) | |||
414 | if (!cs->connected) { | 365 | if (!cs->connected) { |
415 | gig_dbg(DEBUG_IF, "not connected"); | 366 | gig_dbg(DEBUG_IF, "not connected"); |
416 | retval = -ENODEV; | 367 | retval = -ENODEV; |
417 | } else if (!cs->open_count) | 368 | } else if (cs->mstate != MS_LOCKED) { |
418 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | ||
419 | else if (cs->mstate != MS_LOCKED) { | ||
420 | dev_warn(cs->dev, "can't write to unlocked device\n"); | 369 | dev_warn(cs->dev, "can't write to unlocked device\n"); |
421 | retval = -EBUSY; | 370 | retval = -EBUSY; |
422 | } else | 371 | } else |
@@ -429,23 +378,15 @@ static int if_write_room(struct tty_struct *tty) | |||
429 | 378 | ||
430 | static int if_chars_in_buffer(struct tty_struct *tty) | 379 | static int if_chars_in_buffer(struct tty_struct *tty) |
431 | { | 380 | { |
432 | struct cardstate *cs; | 381 | struct cardstate *cs = tty->driver_data; |
433 | int retval = 0; | 382 | int retval = 0; |
434 | 383 | ||
435 | cs = (struct cardstate *) tty->driver_data; | ||
436 | if (!cs) { | ||
437 | pr_err("%s: no cardstate\n", __func__); | ||
438 | return 0; | ||
439 | } | ||
440 | |||
441 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 384 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
442 | 385 | ||
443 | mutex_lock(&cs->mutex); | 386 | mutex_lock(&cs->mutex); |
444 | 387 | ||
445 | if (!cs->connected) | 388 | if (!cs->connected) |
446 | gig_dbg(DEBUG_IF, "not connected"); | 389 | gig_dbg(DEBUG_IF, "not connected"); |
447 | else if (!cs->open_count) | ||
448 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | ||
449 | else if (cs->mstate != MS_LOCKED) | 390 | else if (cs->mstate != MS_LOCKED) |
450 | dev_warn(cs->dev, "can't write to unlocked device\n"); | 391 | dev_warn(cs->dev, "can't write to unlocked device\n"); |
451 | else | 392 | else |
@@ -458,13 +399,7 @@ static int if_chars_in_buffer(struct tty_struct *tty) | |||
458 | 399 | ||
459 | static void if_throttle(struct tty_struct *tty) | 400 | static void if_throttle(struct tty_struct *tty) |
460 | { | 401 | { |
461 | struct cardstate *cs; | 402 | struct cardstate *cs = tty->driver_data; |
462 | |||
463 | cs = (struct cardstate *) tty->driver_data; | ||
464 | if (!cs) { | ||
465 | pr_err("%s: no cardstate\n", __func__); | ||
466 | return; | ||
467 | } | ||
468 | 403 | ||
469 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 404 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
470 | 405 | ||
@@ -472,8 +407,6 @@ static void if_throttle(struct tty_struct *tty) | |||
472 | 407 | ||
473 | if (!cs->connected) | 408 | if (!cs->connected) |
474 | gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */ | 409 | gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */ |
475 | else if (!cs->open_count) | ||
476 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | ||
477 | else | 410 | else |
478 | gig_dbg(DEBUG_IF, "%s: not implemented\n", __func__); | 411 | gig_dbg(DEBUG_IF, "%s: not implemented\n", __func__); |
479 | 412 | ||
@@ -482,13 +415,7 @@ static void if_throttle(struct tty_struct *tty) | |||
482 | 415 | ||
483 | static void if_unthrottle(struct tty_struct *tty) | 416 | static void if_unthrottle(struct tty_struct *tty) |
484 | { | 417 | { |
485 | struct cardstate *cs; | 418 | struct cardstate *cs = tty->driver_data; |
486 | |||
487 | cs = (struct cardstate *) tty->driver_data; | ||
488 | if (!cs) { | ||
489 | pr_err("%s: no cardstate\n", __func__); | ||
490 | return; | ||
491 | } | ||
492 | 419 | ||
493 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 420 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
494 | 421 | ||
@@ -496,8 +423,6 @@ static void if_unthrottle(struct tty_struct *tty) | |||
496 | 423 | ||
497 | if (!cs->connected) | 424 | if (!cs->connected) |
498 | gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */ | 425 | gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */ |
499 | else if (!cs->open_count) | ||
500 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | ||
501 | else | 426 | else |
502 | gig_dbg(DEBUG_IF, "%s: not implemented\n", __func__); | 427 | gig_dbg(DEBUG_IF, "%s: not implemented\n", __func__); |
503 | 428 | ||
@@ -506,18 +431,12 @@ static void if_unthrottle(struct tty_struct *tty) | |||
506 | 431 | ||
507 | static void if_set_termios(struct tty_struct *tty, struct ktermios *old) | 432 | static void if_set_termios(struct tty_struct *tty, struct ktermios *old) |
508 | { | 433 | { |
509 | struct cardstate *cs; | 434 | struct cardstate *cs = tty->driver_data; |
510 | unsigned int iflag; | 435 | unsigned int iflag; |
511 | unsigned int cflag; | 436 | unsigned int cflag; |
512 | unsigned int old_cflag; | 437 | unsigned int old_cflag; |
513 | unsigned int control_state, new_state; | 438 | unsigned int control_state, new_state; |
514 | 439 | ||
515 | cs = (struct cardstate *) tty->driver_data; | ||
516 | if (!cs) { | ||
517 | pr_err("%s: no cardstate\n", __func__); | ||
518 | return; | ||
519 | } | ||
520 | |||
521 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); | 440 | gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__); |
522 | 441 | ||
523 | mutex_lock(&cs->mutex); | 442 | mutex_lock(&cs->mutex); |
@@ -527,11 +446,6 @@ static void if_set_termios(struct tty_struct *tty, struct ktermios *old) | |||
527 | goto out; | 446 | goto out; |
528 | } | 447 | } |
529 | 448 | ||
530 | if (!cs->open_count) { | ||
531 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | ||
532 | goto out; | ||
533 | } | ||
534 | |||
535 | iflag = tty->termios->c_iflag; | 449 | iflag = tty->termios->c_iflag; |
536 | cflag = tty->termios->c_cflag; | 450 | cflag = tty->termios->c_cflag; |
537 | old_cflag = old ? old->c_cflag : cflag; | 451 | old_cflag = old ? old->c_cflag : cflag; |
@@ -588,10 +502,13 @@ out: | |||
588 | /* wakeup tasklet for the write operation */ | 502 | /* wakeup tasklet for the write operation */ |
589 | static void if_wake(unsigned long data) | 503 | static void if_wake(unsigned long data) |
590 | { | 504 | { |
591 | struct cardstate *cs = (struct cardstate *) data; | 505 | struct cardstate *cs = (struct cardstate *)data; |
506 | struct tty_struct *tty = tty_port_tty_get(&cs->port); | ||
592 | 507 | ||
593 | if (cs->tty) | 508 | if (tty) { |
594 | tty_wakeup(cs->tty); | 509 | tty_wakeup(tty); |
510 | tty_kref_put(tty); | ||
511 | } | ||
595 | } | 512 | } |
596 | 513 | ||
597 | /*** interface to common ***/ | 514 | /*** interface to common ***/ |
@@ -644,18 +561,16 @@ void gigaset_if_free(struct cardstate *cs) | |||
644 | void gigaset_if_receive(struct cardstate *cs, | 561 | void gigaset_if_receive(struct cardstate *cs, |
645 | unsigned char *buffer, size_t len) | 562 | unsigned char *buffer, size_t len) |
646 | { | 563 | { |
647 | unsigned long flags; | 564 | struct tty_struct *tty = tty_port_tty_get(&cs->port); |
648 | struct tty_struct *tty; | ||
649 | 565 | ||
650 | spin_lock_irqsave(&cs->lock, flags); | 566 | if (tty == NULL) { |
651 | tty = cs->tty; | ||
652 | if (tty == NULL) | ||
653 | gig_dbg(DEBUG_IF, "receive on closed device"); | 567 | gig_dbg(DEBUG_IF, "receive on closed device"); |
654 | else { | 568 | return; |
655 | tty_insert_flip_string(tty, buffer, len); | ||
656 | tty_flip_buffer_push(tty); | ||
657 | } | 569 | } |
658 | spin_unlock_irqrestore(&cs->lock, flags); | 570 | |
571 | tty_insert_flip_string(tty, buffer, len); | ||
572 | tty_flip_buffer_push(tty); | ||
573 | tty_kref_put(tty); | ||
659 | } | 574 | } |
660 | EXPORT_SYMBOL_GPL(gigaset_if_receive); | 575 | EXPORT_SYMBOL_GPL(gigaset_if_receive); |
661 | 576 | ||
@@ -669,17 +584,15 @@ EXPORT_SYMBOL_GPL(gigaset_if_receive); | |||
669 | void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, | 584 | void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, |
670 | const char *devname) | 585 | const char *devname) |
671 | { | 586 | { |
672 | unsigned minors = drv->minors; | ||
673 | int ret; | 587 | int ret; |
674 | struct tty_driver *tty; | 588 | struct tty_driver *tty; |
675 | 589 | ||
676 | drv->have_tty = 0; | 590 | drv->have_tty = 0; |
677 | 591 | ||
678 | drv->tty = tty = alloc_tty_driver(minors); | 592 | drv->tty = tty = alloc_tty_driver(drv->minors); |
679 | if (tty == NULL) | 593 | if (tty == NULL) |
680 | goto enomem; | 594 | goto enomem; |
681 | 595 | ||
682 | tty->magic = TTY_DRIVER_MAGIC, | ||
683 | tty->type = TTY_DRIVER_TYPE_SERIAL, | 596 | tty->type = TTY_DRIVER_TYPE_SERIAL, |
684 | tty->subtype = SERIAL_TYPE_NORMAL, | 597 | tty->subtype = SERIAL_TYPE_NORMAL, |
685 | tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; | 598 | tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
@@ -687,9 +600,6 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, | |||
687 | tty->driver_name = procname; | 600 | tty->driver_name = procname; |
688 | tty->name = devname; | 601 | tty->name = devname; |
689 | tty->minor_start = drv->minor; | 602 | tty->minor_start = drv->minor; |
690 | tty->num = drv->minors; | ||
691 | |||
692 | tty->owner = THIS_MODULE; | ||
693 | 603 | ||
694 | tty->init_termios = tty_std_termios; | 604 | tty->init_termios = tty_std_termios; |
695 | tty->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 605 | tty->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 2c26b64ebbea..ac4840124bc0 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -1590,12 +1590,9 @@ static int | |||
1590 | isdn_tty_open(struct tty_struct *tty, struct file *filp) | 1590 | isdn_tty_open(struct tty_struct *tty, struct file *filp) |
1591 | { | 1591 | { |
1592 | modem_info *info; | 1592 | modem_info *info; |
1593 | int retval, line; | 1593 | int retval; |
1594 | 1594 | ||
1595 | line = tty->index; | 1595 | info = &dev->mdm.info[tty->index]; |
1596 | if (line < 0 || line >= ISDN_MAX_CHANNELS) | ||
1597 | return -ENODEV; | ||
1598 | info = &dev->mdm.info[line]; | ||
1599 | if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open")) | 1596 | if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open")) |
1600 | return -ENODEV; | 1597 | return -ENODEV; |
1601 | if (!try_module_get(info->owner)) { | 1598 | if (!try_module_get(info->owner)) { |