netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Virdi <amit.virdi@st.com>
To: <samuel@sortiz.org>, <alan@linux.intel.com>,
	<davem@davemloft.net>, <eric.dumazet@gmail.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <amit.virdi@st.com>, <shiraz.hashim@st.com>,
	<armando.visconti@st.com>, <viresh.kumar@st.com>
Subject: [PATCH] net/irda/ircomm_tty.c: Use flip buffers to deliver data
Date: Thu, 12 May 2011 16:34:40 +0530	[thread overview]
Message-ID: <1305198280-14449-1-git-send-email-amit.virdi@st.com> (raw)

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>
---
 net/irda/ircomm/ircomm_tty.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index a39cca8..b3cc8b3 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -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 */
 
@@ -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__ );
 
@@ -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() */
 
-- 
1.7.3.4

             reply	other threads:[~2011-05-12 11:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-12 11:04 Amit Virdi [this message]
2011-05-12 11:17 ` [PATCH] net/irda/ircomm_tty.c: Use flip buffers to deliver data Alan Cox
2011-05-12 22:03   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305198280-14449-1-git-send-email-amit.virdi@st.com \
    --to=amit.virdi@st.com \
    --cc=alan@linux.intel.com \
    --cc=armando.visconti@st.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=samuel@sortiz.org \
    --cc=shiraz.hashim@st.com \
    --cc=viresh.kumar@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).