diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-06-04 07:35:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-12 18:50:23 -0400 |
commit | 580d27b449cb8f540bba1cc54066bb44f4e6242d (patch) | |
tree | 1b7d77b121c634238d9a2e7a0d3e18f02e2fdc47 /net/irda/ircomm | |
parent | 2a0213cb1e1ca6b2838595b0d70f09ecc4953ba9 (diff) |
TTY: ircomm, use open counts from tty_port
Switch to tty_port->count and blocked_open.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Samuel Ortiz <samuel@sortiz.org>
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/irda/ircomm')
-rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 61e0adcab964..787578f9f312 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -272,7 +272,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
272 | 272 | ||
273 | /* Wait for carrier detect and the line to become | 273 | /* Wait for carrier detect and the line to become |
274 | * free (i.e., not in use by the callout). While we are in | 274 | * free (i.e., not in use by the callout). While we are in |
275 | * this loop, self->open_count is dropped by one, so that | 275 | * this loop, self->port.count is dropped by one, so that |
276 | * mgsl_close() knows when to free things. We restore it upon | 276 | * mgsl_close() knows when to free things. We restore it upon |
277 | * exit, either normal or abnormal. | 277 | * exit, either normal or abnormal. |
278 | */ | 278 | */ |
@@ -281,16 +281,16 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
281 | add_wait_queue(&self->port.open_wait, &wait); | 281 | add_wait_queue(&self->port.open_wait, &wait); |
282 | 282 | ||
283 | IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", | 283 | IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", |
284 | __FILE__,__LINE__, tty->driver->name, self->open_count ); | 284 | __FILE__, __LINE__, tty->driver->name, self->port.count); |
285 | 285 | ||
286 | /* As far as I can see, we protect open_count - Jean II */ | 286 | /* As far as I can see, we protect port.count - Jean II */ |
287 | spin_lock_irqsave(&self->spinlock, flags); | 287 | spin_lock_irqsave(&self->spinlock, flags); |
288 | if (!tty_hung_up_p(filp)) { | 288 | if (!tty_hung_up_p(filp)) { |
289 | extra_count = 1; | 289 | extra_count = 1; |
290 | self->open_count--; | 290 | self->port.count--; |
291 | } | 291 | } |
292 | spin_unlock_irqrestore(&self->spinlock, flags); | 292 | spin_unlock_irqrestore(&self->spinlock, flags); |
293 | self->blocked_open++; | 293 | self->port.blocked_open++; |
294 | 294 | ||
295 | while (1) { | 295 | while (1) { |
296 | if (tty->termios->c_cflag & CBAUD) { | 296 | if (tty->termios->c_cflag & CBAUD) { |
@@ -330,7 +330,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
330 | } | 330 | } |
331 | 331 | ||
332 | IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", | 332 | IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", |
333 | __FILE__,__LINE__, tty->driver->name, self->open_count ); | 333 | __FILE__, __LINE__, tty->driver->name, self->port.count); |
334 | 334 | ||
335 | schedule(); | 335 | schedule(); |
336 | } | 336 | } |
@@ -341,13 +341,13 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
341 | if (extra_count) { | 341 | if (extra_count) { |
342 | /* ++ is not atomic, so this should be protected - Jean II */ | 342 | /* ++ is not atomic, so this should be protected - Jean II */ |
343 | spin_lock_irqsave(&self->spinlock, flags); | 343 | spin_lock_irqsave(&self->spinlock, flags); |
344 | self->open_count++; | 344 | self->port.count++; |
345 | spin_unlock_irqrestore(&self->spinlock, flags); | 345 | spin_unlock_irqrestore(&self->spinlock, flags); |
346 | } | 346 | } |
347 | self->blocked_open--; | 347 | self->port.blocked_open--; |
348 | 348 | ||
349 | IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", | 349 | IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", |
350 | __FILE__,__LINE__, tty->driver->name, self->open_count); | 350 | __FILE__, __LINE__, tty->driver->name, self->port.count); |
351 | 351 | ||
352 | if (!retval) | 352 | if (!retval) |
353 | self->flags |= ASYNC_NORMAL_ACTIVE; | 353 | self->flags |= ASYNC_NORMAL_ACTIVE; |
@@ -410,14 +410,14 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
410 | } | 410 | } |
411 | /* ++ is not atomic, so this should be protected - Jean II */ | 411 | /* ++ is not atomic, so this should be protected - Jean II */ |
412 | spin_lock_irqsave(&self->spinlock, flags); | 412 | spin_lock_irqsave(&self->spinlock, flags); |
413 | self->open_count++; | 413 | self->port.count++; |
414 | 414 | ||
415 | tty->driver_data = self; | 415 | tty->driver_data = self; |
416 | self->tty = tty; | 416 | self->tty = tty; |
417 | spin_unlock_irqrestore(&self->spinlock, flags); | 417 | spin_unlock_irqrestore(&self->spinlock, flags); |
418 | 418 | ||
419 | IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __func__ , tty->driver->name, | 419 | IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __func__ , tty->driver->name, |
420 | self->line, self->open_count); | 420 | self->line, self->port.count); |
421 | 421 | ||
422 | /* Not really used by us, but lets do it anyway */ | 422 | /* Not really used by us, but lets do it anyway */ |
423 | self->tty->low_latency = (self->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 423 | self->tty->low_latency = (self->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
@@ -504,7 +504,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
504 | return; | 504 | return; |
505 | } | 505 | } |
506 | 506 | ||
507 | if ((tty->count == 1) && (self->open_count != 1)) { | 507 | if ((tty->count == 1) && (self->port.count != 1)) { |
508 | /* | 508 | /* |
509 | * Uh, oh. tty->count is 1, which means that the tty | 509 | * Uh, oh. tty->count is 1, which means that the tty |
510 | * structure will be freed. state->count should always | 510 | * structure will be freed. state->count should always |
@@ -514,16 +514,16 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
514 | */ | 514 | */ |
515 | IRDA_DEBUG(0, "%s(), bad serial port count; " | 515 | IRDA_DEBUG(0, "%s(), bad serial port count; " |
516 | "tty->count is 1, state->count is %d\n", __func__ , | 516 | "tty->count is 1, state->count is %d\n", __func__ , |
517 | self->open_count); | 517 | self->port.count); |
518 | self->open_count = 1; | 518 | self->port.count = 1; |
519 | } | 519 | } |
520 | 520 | ||
521 | if (--self->open_count < 0) { | 521 | if (--self->port.count < 0) { |
522 | IRDA_ERROR("%s(), bad serial port count for ttys%d: %d\n", | 522 | IRDA_ERROR("%s(), bad serial port count for ttys%d: %d\n", |
523 | __func__, self->line, self->open_count); | 523 | __func__, self->line, self->port.count); |
524 | self->open_count = 0; | 524 | self->port.count = 0; |
525 | } | 525 | } |
526 | if (self->open_count) { | 526 | if (self->port.count) { |
527 | spin_unlock_irqrestore(&self->spinlock, flags); | 527 | spin_unlock_irqrestore(&self->spinlock, flags); |
528 | 528 | ||
529 | IRDA_DEBUG(0, "%s(), open count > 0\n", __func__ ); | 529 | IRDA_DEBUG(0, "%s(), open count > 0\n", __func__ ); |
@@ -555,7 +555,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
555 | tty->closing = 0; | 555 | tty->closing = 0; |
556 | self->tty = NULL; | 556 | self->tty = NULL; |
557 | 557 | ||
558 | if (self->blocked_open) { | 558 | if (self->port.blocked_open) { |
559 | if (self->port.close_delay) | 559 | if (self->port.close_delay) |
560 | schedule_timeout_interruptible(self->port.close_delay); | 560 | schedule_timeout_interruptible(self->port.close_delay); |
561 | wake_up_interruptible(&self->port.open_wait); | 561 | wake_up_interruptible(&self->port.open_wait); |
@@ -1007,7 +1007,7 @@ static void ircomm_tty_hangup(struct tty_struct *tty) | |||
1007 | spin_lock_irqsave(&self->spinlock, flags); | 1007 | spin_lock_irqsave(&self->spinlock, flags); |
1008 | self->flags &= ~ASYNC_NORMAL_ACTIVE; | 1008 | self->flags &= ~ASYNC_NORMAL_ACTIVE; |
1009 | self->tty = NULL; | 1009 | self->tty = NULL; |
1010 | self->open_count = 0; | 1010 | self->port.count = 0; |
1011 | spin_unlock_irqrestore(&self->spinlock, flags); | 1011 | spin_unlock_irqrestore(&self->spinlock, flags); |
1012 | 1012 | ||
1013 | wake_up_interruptible(&self->port.open_wait); | 1013 | wake_up_interruptible(&self->port.open_wait); |
@@ -1354,7 +1354,7 @@ static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m) | |||
1354 | seq_putc(m, '\n'); | 1354 | seq_putc(m, '\n'); |
1355 | 1355 | ||
1356 | seq_printf(m, "Role: %s\n", self->client ? "client" : "server"); | 1356 | seq_printf(m, "Role: %s\n", self->client ? "client" : "server"); |
1357 | seq_printf(m, "Open count: %d\n", self->open_count); | 1357 | seq_printf(m, "Open count: %d\n", self->port.count); |
1358 | seq_printf(m, "Max data size: %d\n", self->max_data_size); | 1358 | seq_printf(m, "Max data size: %d\n", self->max_data_size); |
1359 | seq_printf(m, "Max header size: %d\n", self->max_header_size); | 1359 | seq_printf(m, "Max header size: %d\n", self->max_header_size); |
1360 | 1360 | ||