diff options
Diffstat (limited to 'net/irda')
| -rw-r--r-- | net/irda/af_irda.c | 8 | ||||
| -rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 29 | ||||
| -rw-r--r-- | net/irda/iriap.c | 3 | ||||
| -rw-r--r-- | net/irda/irlmp.c | 10 | 
4 files changed, 33 insertions, 17 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index d07e3a62644..e493b3397ae 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -1386,6 +1386,8 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock,  	IRDA_DEBUG(4, "%s()\n", __func__); +	msg->msg_namelen = 0; +  	skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,  				flags & MSG_DONTWAIT, &err);  	if (!skb) @@ -2583,8 +2585,10 @@ bed:  				    NULL, NULL, NULL);  		/* Check if the we got some results */ -		if (!self->cachedaddr) -			return -EAGAIN;		/* Didn't find any devices */ +		if (!self->cachedaddr) { +			err = -EAGAIN;		/* Didn't find any devices */ +			goto out; +		}  		daddr = self->cachedaddr;  		/* Cleanup */  		self->cachedaddr = 0; diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 9a5fd3c3e53..362ba47968e 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -280,7 +280,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,  	struct tty_port *port = &self->port;  	DECLARE_WAITQUEUE(wait, current);  	int		retval; -	int		do_clocal = 0, extra_count = 0; +	int		do_clocal = 0;  	unsigned long	flags;  	IRDA_DEBUG(2, "%s()\n", __func__ ); @@ -289,8 +289,15 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,  	 * If non-blocking mode is set, or the port is not enabled,  	 * then make the check up front and then exit.  	 */ -	if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ -		/* nonblock mode is set or port is not enabled */ +	if (test_bit(TTY_IO_ERROR, &tty->flags)) { +		port->flags |= ASYNC_NORMAL_ACTIVE; +		return 0; +	} + +	if (filp->f_flags & O_NONBLOCK) { +		/* nonblock mode is set */ +		if (tty->termios.c_cflag & CBAUD) +			tty_port_raise_dtr_rts(port);  		port->flags |= ASYNC_NORMAL_ACTIVE;  		IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __func__ );  		return 0; @@ -315,18 +322,16 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,  	      __FILE__, __LINE__, tty->driver->name, port->count);  	spin_lock_irqsave(&port->lock, flags); -	if (!tty_hung_up_p(filp)) { -		extra_count = 1; +	if (!tty_hung_up_p(filp))  		port->count--; -	} -	spin_unlock_irqrestore(&port->lock, flags);  	port->blocked_open++; +	spin_unlock_irqrestore(&port->lock, flags);  	while (1) {  		if (tty->termios.c_cflag & CBAUD)  			tty_port_raise_dtr_rts(port); -		current->state = TASK_INTERRUPTIBLE; +		set_current_state(TASK_INTERRUPTIBLE);  		if (tty_hung_up_p(filp) ||  		    !test_bit(ASYNCB_INITIALIZED, &port->flags)) { @@ -361,13 +366,11 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,  	__set_current_state(TASK_RUNNING);  	remove_wait_queue(&port->open_wait, &wait); -	if (extra_count) { -		/* ++ is not atomic, so this should be protected - Jean II */ -		spin_lock_irqsave(&port->lock, flags); +	spin_lock_irqsave(&port->lock, flags); +	if (!tty_hung_up_p(filp))  		port->count++; -		spin_unlock_irqrestore(&port->lock, flags); -	}  	port->blocked_open--; +	spin_unlock_irqrestore(&port->lock, flags);  	IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n",  	      __FILE__, __LINE__, tty->driver->name, port->count); diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 29340a9a6fb..e1b37f5a269 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -303,7 +303,8 @@ static void iriap_disconnect_indication(void *instance, void *sap,  {  	struct iriap_cb *self; -	IRDA_DEBUG(4, "%s(), reason=%s\n", __func__, irlmp_reasons[reason]); +	IRDA_DEBUG(4, "%s(), reason=%s [%d]\n", __func__, +		   irlmp_reason_str(reason), reason);  	self = instance; diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 6115a44c0a2..1064621da6f 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -66,8 +66,15 @@ const char *irlmp_reasons[] = {  	"LM_LAP_RESET",  	"LM_INIT_DISCONNECT",  	"ERROR, NOT USED", +	"UNKNOWN",  }; +const char *irlmp_reason_str(LM_REASON reason) +{ +	reason = min_t(size_t, reason, ARRAY_SIZE(irlmp_reasons) - 1); +	return irlmp_reasons[reason]; +} +  /*   * Function irlmp_init (void)   * @@ -747,7 +754,8 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,  {  	struct lsap_cb *lsap; -	IRDA_DEBUG(1, "%s(), reason=%s\n", __func__, irlmp_reasons[reason]); +	IRDA_DEBUG(1, "%s(), reason=%s [%d]\n", __func__, +		   irlmp_reason_str(reason), reason);  	IRDA_ASSERT(self != NULL, return;);  	IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);  |