Skip to content

Commit

Permalink
net/irda/ircomm_tty.c: Use flip buffers to deliver data
Browse files Browse the repository at this point in the history
use tty_insert_flip_string and tty_flip_buffer_push to deliver incoming data
packets from the IrDA device instead of delivering the packets directly to the
line discipline. Following later approach resulted in warning "Sleeping function
called from invalid context".

Signed-off-by: Amit Virdi <amit.virdi@st.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Amit Virdi authored and davem330 committed May 12, 2011
1 parent 7f26705 commit cbfd152
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions net/irda/ircomm/ircomm_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <linux/seq_file.h>
#include <linux/termios.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/interrupt.h>
#include <linux/device.h> /* for MODULE_ALIAS_CHARDEV_MAJOR */

Expand Down Expand Up @@ -1132,7 +1133,6 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
struct sk_buff *skb)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
struct tty_ldisc *ld;

IRDA_DEBUG(2, "%s()\n", __func__ );

Expand Down Expand Up @@ -1161,15 +1161,11 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
}

/*
* Just give it over to the line discipline. There is no need to
* involve the flip buffers, since we are not running in an interrupt
* handler
* Use flip buffer functions since the code may be called from interrupt
* context
*/

ld = tty_ldisc_ref(self->tty);
if (ld)
ld->ops->receive_buf(self->tty, skb->data, NULL, skb->len);
tty_ldisc_deref(ld);
tty_insert_flip_string(self->tty, skb->data, skb->len);
tty_flip_buffer_push(self->tty);

/* No need to kfree_skb - see ircomm_ttp_data_indication() */

Expand Down

0 comments on commit cbfd152

Please sign in to comment.