linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt
@ 2012-10-25 16:46 Bill Pemberton
  2012-10-25 16:46 ` [PATCH 1/2] staging: dgrp: remove use of real_raw and read_cnt in dgrp_input Bill Pemberton
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bill Pemberton @ 2012-10-25 16:46 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial


Patches for tty-next to fix dgrp breakage when real_raw and and
read_cnt where removed from tty_struct.

-- 
Bill




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] staging: dgrp: remove use of real_raw and read_cnt in dgrp_input
  2012-10-25 16:46 [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt Bill Pemberton
@ 2012-10-25 16:46 ` Bill Pemberton
  2012-10-25 16:46 ` [PATCH 2/2] staging: dgrp: remove rawreadok module option Bill Pemberton
  2012-10-25 18:23 ` [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Bill Pemberton @ 2012-10-25 16:46 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial

dgrp_input used real_raw and read_cnt from struct tty_struct.  Those
members have gone away.  Rework the code to not use them.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
---
 drivers/staging/dgrp/dgrp_net_ops.c | 67 +++++--------------------------------
 1 file changed, 8 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c
index ab839ea..0788357 100644
--- a/drivers/staging/dgrp/dgrp_net_ops.c
+++ b/drivers/staging/dgrp/dgrp_net_ops.c
@@ -151,20 +151,15 @@ static void dgrp_read_data_block(struct ch_struct *ch, u8 *flipbuf,
  * Copys the rbuf to the flipbuf and sends to line discipline.
  * Sends input buffer data to the line discipline.
  *
- * There are several modes to consider here:
- *    rawreadok, tty->real_raw, and IF_PARMRK
  */
 static void dgrp_input(struct ch_struct *ch)
 {
 	struct nd_struct *nd;
 	struct tty_struct *tty;
-	int remain;
 	int data_len;
 	int len;
-	int flip_len;
 	int tty_count;
 	ulong lock_flags;
-	struct tty_ldisc *ld;
 	u8  *myflipbuf;
 	u8  *myflipflagbuf;
 
@@ -212,37 +207,11 @@ static void dgrp_input(struct ch_struct *ch)
 
 	spin_unlock_irqrestore(&nd->nd_lock, lock_flags);
 
-	/* Decide how much data we can send into the tty layer */
-	if (dgrp_rawreadok && tty->real_raw)
-		flip_len = MYFLIPLEN;
-	else
-		flip_len = TTY_FLIPBUF_SIZE;
-
 	/* data_len should be the number of chars that we read in */
 	data_len = (ch->ch_rin - ch->ch_rout) & RBUF_MASK;
-	remain = data_len;
 
 	/* len is the amount of data we are going to transfer here */
-	len = min(data_len, flip_len);
-
-	/* take into consideration length of ldisc */
-	len = min(len, (N_TTY_BUF_SIZE - 1) - tty->read_cnt);
-
-	ld = tty_ldisc_ref(tty);
-
-	/*
-	 * If we were unable to get a reference to the ld,
-	 * don't flush our buffer, and act like the ld doesn't
-	 * have any space to put the data right now.
-	 */
-	if (!ld) {
-		len = 0;
-	} else if (!ld->ops->receive_buf) {
-		spin_lock_irqsave(&nd->nd_lock, lock_flags);
-		ch->ch_rout = ch->ch_rin;
-		spin_unlock_irqrestore(&nd->nd_lock, lock_flags);
-		len = 0;
-	}
+	len = tty_buffer_request_room(tty, data_len);
 
 	/* Check DPA flow control */
 	if ((nd->nd_dpa_debug) &&
@@ -254,42 +223,22 @@ static void dgrp_input(struct ch_struct *ch)
 
 		dgrp_read_data_block(ch, myflipbuf, len);
 
-		/*
-		 * In high performance mode, we don't have to update
-		 * flag_buf or any of the counts or pointers into flip buf.
-		 */
-		if (!dgrp_rawreadok || !tty->real_raw) {
-			if (I_PARMRK(tty) || I_BRKINT(tty) || I_INPCK(tty))
-				parity_scan(ch, myflipbuf, myflipflagbuf, &len);
-			else
-				memset(myflipflagbuf, TTY_NORMAL, len);
-		}
+		if (I_PARMRK(tty) || I_BRKINT(tty) || I_INPCK(tty))
+			parity_scan(ch, myflipbuf, myflipflagbuf, &len);
+		else
+			memset(myflipflagbuf, TTY_NORMAL, len);
 
 		if ((nd->nd_dpa_debug) &&
 		    (nd->nd_dpa_port == PORT_NUM(MINOR(tty_devnum(tty)))))
 			dgrp_dpa_data(nd, 1, myflipbuf, len);
 
-		/*
-		 * If we're doing raw reads, jam it right into the
-		 * line disc bypassing the flip buffers.
-		 */
-		if (dgrp_rawreadok && tty->real_raw)
-			ld->ops->receive_buf(tty, myflipbuf, NULL, len);
-		else {
-			len = tty_buffer_request_room(tty, len);
-			tty_insert_flip_string_flags(tty, myflipbuf,
-						     myflipflagbuf, len);
-
-			/* Tell the tty layer its okay to "eat" the data now */
-			tty_flip_buffer_push(tty);
-		}
+		tty_insert_flip_string_flags(tty, myflipbuf,
+					     myflipflagbuf, len);
+		tty_flip_buffer_push(tty);
 
 		ch->ch_rxcount += len;
 	}
 
-	if (ld)
-		tty_ldisc_deref(ld);
-
 	/*
 	 * Wake up any sleepers (maybe dgrp close) that might be waiting
 	 * for a channel flag state change.
-- 
1.7.12


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] staging: dgrp: remove rawreadok module option
  2012-10-25 16:46 [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt Bill Pemberton
  2012-10-25 16:46 ` [PATCH 1/2] staging: dgrp: remove use of real_raw and read_cnt in dgrp_input Bill Pemberton
@ 2012-10-25 16:46 ` Bill Pemberton
  2012-10-25 18:23 ` [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Bill Pemberton @ 2012-10-25 16:46 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial

The functionality behind this option has been removed in the driver so
remove the config option to set/unset it.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
---
 drivers/staging/dgrp/dgrp_common.h   |  1 -
 drivers/staging/dgrp/dgrp_driver.c   |  4 ----
 drivers/staging/dgrp/dgrp_specproc.c |  2 --
 drivers/staging/dgrp/dgrp_sysfs.c    | 18 ------------------
 4 files changed, 25 deletions(-)

diff --git a/drivers/staging/dgrp/dgrp_common.h b/drivers/staging/dgrp/dgrp_common.h
index 05ff338..0583fe9 100644
--- a/drivers/staging/dgrp/dgrp_common.h
+++ b/drivers/staging/dgrp/dgrp_common.h
@@ -31,7 +31,6 @@
  * All global storage allocation.
  ************************************************************************/
 
-extern int dgrp_rawreadok;  /* Allow raw writing of input */
 extern int dgrp_register_cudevices; /* enable legacy cu devices */
 extern int dgrp_register_prdevices; /* enable transparent print devices */
 extern int dgrp_poll_tick;          /* Poll interval - in ms */
diff --git a/drivers/staging/dgrp/dgrp_driver.c b/drivers/staging/dgrp/dgrp_driver.c
index 6e4a0eb..aa26258 100644
--- a/drivers/staging/dgrp/dgrp_driver.c
+++ b/drivers/staging/dgrp/dgrp_driver.c
@@ -39,14 +39,10 @@ MODULE_VERSION(DIGI_VERSION);
 struct list_head nd_struct_list;
 struct dgrp_poll_data dgrp_poll_data;
 
-int dgrp_rawreadok = 1;		/* Bypass flipbuf on input */
 int dgrp_register_cudevices = 1;/* Turn on/off registering legacy cu devices */
 int dgrp_register_prdevices = 1;/* Turn on/off registering transparent print */
 int dgrp_poll_tick = 20;	/* Poll interval - in ms */
 
-module_param_named(rawreadok, dgrp_rawreadok, int, 0644);
-MODULE_PARM_DESC(rawreadok, "Bypass flip buffers on input");
-
 module_param_named(register_cudevices, dgrp_register_cudevices, int, 0644);
 MODULE_PARM_DESC(register_cudevices, "Turn on/off registering legacy cu devices");
 
diff --git a/drivers/staging/dgrp/dgrp_specproc.c b/drivers/staging/dgrp/dgrp_specproc.c
index 24327c3..db91f67 100644
--- a/drivers/staging/dgrp/dgrp_specproc.c
+++ b/drivers/staging/dgrp/dgrp_specproc.c
@@ -629,8 +629,6 @@ static int info_proc_show(struct seq_file *m, void *v)
 {
 	seq_printf(m, "version: %s\n", DIGI_VERSION);
 	seq_puts(m, "register_with_sysfs: 1\n");
-	seq_printf(m, "rawreadok: 0x%08x\t(%d)\n",
-		   dgrp_rawreadok, dgrp_rawreadok);
 	seq_printf(m, "pollrate: 0x%08x\t(%d)\n",
 		   dgrp_poll_tick, dgrp_poll_tick);
 
diff --git a/drivers/staging/dgrp/dgrp_sysfs.c b/drivers/staging/dgrp/dgrp_sysfs.c
index e5a3c88..8b513e9 100644
--- a/drivers/staging/dgrp/dgrp_sysfs.c
+++ b/drivers/staging/dgrp/dgrp_sysfs.c
@@ -55,23 +55,6 @@ static DEVICE_ATTR(register_with_sysfs, 0400,
 		   dgrp_class_register_with_sysfs_show, NULL);
 
 
-static ssize_t dgrp_class_rawreadok_show(struct device *c,
-					 struct device_attribute *attr,
-					 char *buf)
-{
-	return snprintf(buf, PAGE_SIZE, "%d\n", dgrp_rawreadok);
-}
-static ssize_t dgrp_class_rawreadok_store(struct device *c,
-					  struct device_attribute *attr,
-					  const char *buf, size_t count)
-{
-	sscanf(buf, "0x%x\n", &dgrp_rawreadok);
-	return count;
-}
-static DEVICE_ATTR(rawreadok, 0600, dgrp_class_rawreadok_show,
-		   dgrp_class_rawreadok_store);
-
-
 static ssize_t dgrp_class_pollrate_show(struct device *c,
 					struct device_attribute *attr,
 					char *buf)
@@ -91,7 +74,6 @@ static DEVICE_ATTR(pollrate, 0600, dgrp_class_pollrate_show,
 
 static struct attribute *dgrp_sysfs_global_settings_entries[] = {
 	&dev_attr_pollrate.attr,
-	&dev_attr_rawreadok.attr,
 	&dev_attr_register_with_sysfs.attr,
 	NULL
 };
-- 
1.7.12


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt
  2012-10-25 16:46 [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt Bill Pemberton
  2012-10-25 16:46 ` [PATCH 1/2] staging: dgrp: remove use of real_raw and read_cnt in dgrp_input Bill Pemberton
  2012-10-25 16:46 ` [PATCH 2/2] staging: dgrp: remove rawreadok module option Bill Pemberton
@ 2012-10-25 18:23 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2012-10-25 18:23 UTC (permalink / raw)
  To: Bill Pemberton; +Cc: linux-serial

On Thu, Oct 25, 2012 at 12:46:20PM -0400, Bill Pemberton wrote:
> 
> Patches for tty-next to fix dgrp breakage when real_raw and and
> read_cnt where removed from tty_struct.

Now applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-25 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25 16:46 [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt Bill Pemberton
2012-10-25 16:46 ` [PATCH 1/2] staging: dgrp: remove use of real_raw and read_cnt in dgrp_input Bill Pemberton
2012-10-25 16:46 ` [PATCH 2/2] staging: dgrp: remove rawreadok module option Bill Pemberton
2012-10-25 18:23 ` [PATCH 0/2] staging: dgrp: remove use of real_raw and read_cnt Greg KH

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).