aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/ircomm/ircomm_tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/ircomm/ircomm_tty.c')
-rw-r--r--net/irda/ircomm/ircomm_tty.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 5b7ce599c709..873c4b707d6a 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -220,10 +220,11 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self)
220 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 220 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
221 221
222 /* Check if already open */ 222 /* Check if already open */
223 if (test_and_set_bit(ASYNCB_INITIALIZED, &self->port.flags)) { 223 if (tty_port_initialized(&self->port)) {
224 pr_debug("%s(), already open so break out!\n", __func__); 224 pr_debug("%s(), already open so break out!\n", __func__);
225 return 0; 225 return 0;
226 } 226 }
227 tty_port_set_initialized(&self->port, 1);
227 228
228 /* Register with IrCOMM */ 229 /* Register with IrCOMM */
229 irda_notify_init(&notify); 230 irda_notify_init(&notify);
@@ -257,7 +258,7 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self)
257 258
258 return 0; 259 return 0;
259err: 260err:
260 clear_bit(ASYNCB_INITIALIZED, &self->port.flags); 261 tty_port_set_initialized(&self->port, 0);
261 return ret; 262 return ret;
262} 263}
263 264
@@ -318,13 +319,12 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
318 spin_unlock_irqrestore(&port->lock, flags); 319 spin_unlock_irqrestore(&port->lock, flags);
319 320
320 while (1) { 321 while (1) {
321 if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags)) 322 if (C_BAUD(tty) && tty_port_initialized(port))
322 tty_port_raise_dtr_rts(port); 323 tty_port_raise_dtr_rts(port);
323 324
324 set_current_state(TASK_INTERRUPTIBLE); 325 set_current_state(TASK_INTERRUPTIBLE);
325 326
326 if (tty_hung_up_p(filp) || 327 if (tty_hung_up_p(filp) || !tty_port_initialized(port)) {
327 !test_bit(ASYNCB_INITIALIZED, &port->flags)) {
328 retval = (port->flags & ASYNC_HUP_NOTIFY) ? 328 retval = (port->flags & ASYNC_HUP_NOTIFY) ?
329 -EAGAIN : -ERESTARTSYS; 329 -EAGAIN : -ERESTARTSYS;
330 break; 330 break;
@@ -876,8 +876,9 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self)
876 IRDA_ASSERT(self != NULL, return;); 876 IRDA_ASSERT(self != NULL, return;);
877 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); 877 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
878 878
879 if (!test_and_clear_bit(ASYNCB_INITIALIZED, &self->port.flags)) 879 if (!tty_port_initialized(&self->port))
880 return; 880 return;
881 tty_port_set_initialized(&self->port, 0);
881 882
882 ircomm_tty_detach_cable(self); 883 ircomm_tty_detach_cable(self);
883 884
@@ -1259,7 +1260,7 @@ static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m)
1259 seq_printf(m, "%cASYNC_CHECK_CD", sep); 1260 seq_printf(m, "%cASYNC_CHECK_CD", sep);
1260 sep = '|'; 1261 sep = '|';
1261 } 1262 }
1262 if (self->port.flags & ASYNC_INITIALIZED) { 1263 if (tty_port_initialized(&self->port)) {
1263 seq_printf(m, "%cASYNC_INITIALIZED", sep); 1264 seq_printf(m, "%cASYNC_INITIALIZED", sep);
1264 sep = '|'; 1265 sep = '|';
1265 } 1266 }