All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] NET: pc300, move to staging as it is broken
@ 2012-04-11  9:14 Jiri Slaby
  2012-04-11  9:14 ` [PATCH 2/3] TTY: con3215, add tty_port Jiri Slaby
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jiri Slaby @ 2012-04-11  9:14 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, jirislaby, David S. Miller, Alan Cox, Andrea Shepard

It was marked as BROKEN back in 2008. It is because the tty handling
in the driver is really broken.

There was some activity in January 2012 to fix the driver, but the
patch was commented to be bogus:
  https://lkml.org/lkml/2012/1/29/160
and we have not heard back from the author since then:
  https://lkml.org/lkml/2012/3/28/412

So since nobody stepped in and rewrote the driver, it is time to move
it out of line now. And drop it some time later if nobody comes up
with patches to fix the driver in staging.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Andrea Shepard <andrea@persephoneslair.org>
---
 drivers/net/wan/Kconfig                          |   31 ------------------
 drivers/net/wan/Makefile                         |    5 ---
 drivers/staging/Kconfig                          |    2 ++
 drivers/staging/Makefile                         |    1 +
 drivers/staging/net/Kconfig                      |   38 ++++++++++++++++++++++
 drivers/staging/net/Makefile                     |    5 +++
 drivers/staging/net/TODO                         |    5 +++
 drivers/{net/wan => staging/net}/pc300-falc-lh.h |    0
 drivers/{net/wan => staging/net}/pc300.h         |    0
 drivers/{net/wan => staging/net}/pc300_drv.c     |    0
 drivers/{net/wan => staging/net}/pc300_tty.c     |    0
 11 files changed, 51 insertions(+), 36 deletions(-)
 create mode 100644 drivers/staging/net/Kconfig
 create mode 100644 drivers/staging/net/Makefile
 create mode 100644 drivers/staging/net/TODO
 rename drivers/{net/wan => staging/net}/pc300-falc-lh.h (100%)
 rename drivers/{net/wan => staging/net}/pc300.h (100%)
 rename drivers/{net/wan => staging/net}/pc300_drv.c (100%)
 rename drivers/{net/wan => staging/net}/pc300_tty.c (100%)

diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index d70ede7..d58431e 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -203,37 +203,6 @@ config WANXL_BUILD_FIRMWARE
 
 	  You should never need this option, say N.
 
-config PC300
-	tristate "Cyclades-PC300 support (RS-232/V.35, X.21, T1/E1 boards)"
-	depends on HDLC && PCI && BROKEN
-	---help---
-	  This driver is broken because of struct tty_driver change.
-
-	  Driver for the Cyclades-PC300 synchronous communication boards.
-
-	  These boards provide synchronous serial interfaces to your
-	  Linux box (interfaces currently available are RS-232/V.35, X.21 and
-	  T1/E1). If you wish to support Multilink PPP, please select the
-	  option later and read the file README.mlppp provided by PC300
-	  package.
-
-	  To compile this as a module, choose M here: the module
-	  will be called pc300.
-
-	  If unsure, say N.
-
-config PC300_MLPPP
-	bool "Cyclades-PC300 MLPPP support"
-	depends on PC300 && PPP_MULTILINK && PPP_SYNC_TTY && HDLC_PPP
-	help
-	  Multilink PPP over the PC300 synchronous communication boards.
-
-comment "Cyclades-PC300 MLPPP support is disabled."
-	depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP)
-
-comment "Refer to the file README.mlppp, provided by PC300 package."
-	depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP)
-
 config PC300TOO
 	tristate "Cyclades PC300 RSV/X21 alternative support"
 	depends on HDLC && PCI
diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
index 19d14bc..eac709b 100644
--- a/drivers/net/wan/Makefile
+++ b/drivers/net/wan/Makefile
@@ -17,10 +17,6 @@ obj-$(CONFIG_HDLC_FR)		+= hdlc_fr.o
 obj-$(CONFIG_HDLC_PPP)		+= hdlc_ppp.o
 obj-$(CONFIG_HDLC_X25)		+= hdlc_x25.o
 
-pc300-y				:= pc300_drv.o
-pc300-$(CONFIG_PC300_MLPPP)	+= pc300_tty.o
-pc300-objs			:= $(pc300-y)
-
 obj-$(CONFIG_HOSTESS_SV11)	+= z85230.o	hostess_sv11.o
 obj-$(CONFIG_SEALEVEL_4021)	+= z85230.o	sealevel.o
 obj-$(CONFIG_COSA)		+= cosa.o
@@ -35,7 +31,6 @@ obj-$(CONFIG_SDLA)		+= sdla.o
 obj-$(CONFIG_CYCLADES_SYNC)	+= cycx_drv.o cyclomx.o
 obj-$(CONFIG_LAPBETHER)		+= lapbether.o
 obj-$(CONFIG_SBNI)		+= sbni.o
-obj-$(CONFIG_PC300)		+= pc300.o
 obj-$(CONFIG_N2)		+= n2.o
 obj-$(CONFIG_C101)		+= c101.o
 obj-$(CONFIG_WANXL)		+= wanxl.o
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 4c99b4c..8d406b5 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -120,6 +120,8 @@ source "drivers/staging/nvec/Kconfig"
 
 source "drivers/staging/media/Kconfig"
 
+source "drivers/staging/net/Kconfig"
+
 source "drivers/staging/omapdrm/Kconfig"
 
 source "drivers/staging/android/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 74662ce..0381958 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -4,6 +4,7 @@
 obj-$(CONFIG_STAGING)		+= staging.o
 
 obj-y				+= media/
+obj-y				+= net/
 obj-$(CONFIG_ET131X)		+= et131x/
 obj-$(CONFIG_SLICOSS)		+= slicoss/
 obj-$(CONFIG_USBIP_CORE)	+= usbip/
diff --git a/drivers/staging/net/Kconfig b/drivers/staging/net/Kconfig
new file mode 100644
index 0000000..a64e56b
--- /dev/null
+++ b/drivers/staging/net/Kconfig
@@ -0,0 +1,38 @@
+if NETDEVICES
+
+if WAN
+
+config PC300
+	tristate "Cyclades-PC300 support (RS-232/V.35, X.21, T1/E1 boards)"
+	depends on HDLC && PCI && BROKEN
+	---help---
+	  This driver is broken because of struct tty_driver change.
+
+	  Driver for the Cyclades-PC300 synchronous communication boards.
+
+	  These boards provide synchronous serial interfaces to your
+	  Linux box (interfaces currently available are RS-232/V.35, X.21 and
+	  T1/E1). If you wish to support Multilink PPP, please select the
+	  option later and read the file README.mlppp provided by PC300
+	  package.
+
+	  To compile this as a module, choose M here: the module
+	  will be called pc300.
+
+	  If unsure, say N.
+
+config PC300_MLPPP
+	bool "Cyclades-PC300 MLPPP support"
+	depends on PC300 && PPP_MULTILINK && PPP_SYNC_TTY && HDLC_PPP
+	help
+	  Multilink PPP over the PC300 synchronous communication boards.
+
+comment "Cyclades-PC300 MLPPP support is disabled."
+	depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP)
+
+comment "Refer to the file README.mlppp, provided by PC300 package."
+	depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP)
+
+endif # WAN
+
+endif # NETDEVICES
diff --git a/drivers/staging/net/Makefile b/drivers/staging/net/Makefile
new file mode 100644
index 0000000..0799c43
--- /dev/null
+++ b/drivers/staging/net/Makefile
@@ -0,0 +1,5 @@
+pc300-y				:= pc300_drv.o
+pc300-$(CONFIG_PC300_MLPPP)	+= pc300_tty.o
+pc300-objs			:= $(pc300-y)
+
+obj-$(CONFIG_PC300)		+= pc300.o
diff --git a/drivers/staging/net/TODO b/drivers/staging/net/TODO
new file mode 100644
index 0000000..e3446f2
--- /dev/null
+++ b/drivers/staging/net/TODO
@@ -0,0 +1,5 @@
+PC300
+The driver is very broken and cannot work with the current TTY layer. It is
+inevitable to convert it to the new TTY API.
+
+If no one steps in to adopt the driver, it will be removed in the 3.7 release.
diff --git a/drivers/net/wan/pc300-falc-lh.h b/drivers/staging/net/pc300-falc-lh.h
similarity index 100%
rename from drivers/net/wan/pc300-falc-lh.h
rename to drivers/staging/net/pc300-falc-lh.h
diff --git a/drivers/net/wan/pc300.h b/drivers/staging/net/pc300.h
similarity index 100%
rename from drivers/net/wan/pc300.h
rename to drivers/staging/net/pc300.h
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/staging/net/pc300_drv.c
similarity index 100%
rename from drivers/net/wan/pc300_drv.c
rename to drivers/staging/net/pc300_drv.c
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/staging/net/pc300_tty.c
similarity index 100%
rename from drivers/net/wan/pc300_tty.c
rename to drivers/staging/net/pc300_tty.c
-- 
1.7.9.2



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

* [PATCH 2/3] TTY: con3215, add tty_port
  2012-04-11  9:14 [PATCH 1/3] NET: pc300, move to staging as it is broken Jiri Slaby
@ 2012-04-11  9:14 ` Jiri Slaby
  2012-04-11  9:14 ` [PATCH 3/3] TTY: con3215, use tty from tty_port Jiri Slaby
  2012-04-13 17:35 ` [PATCH 1/3] NET: pc300, move to staging as it is broken David Miller
  2 siblings, 0 replies; 7+ messages in thread
From: Jiri Slaby @ 2012-04-11  9:14 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, jirislaby, Martin Schwidefsky, Heiko Carstens,
	linux390, linux-s390

And use flags from that. But first we have to get rid of duplicated
flag names. From now on, for the standard ones that are stored in
tty_port->flags, we use ASYNC_* ones.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
 drivers/s390/char/con3215.c |   30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 7e30f85..f7bc23b 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -20,6 +20,7 @@
 #include <linux/interrupt.h>
 #include <linux/err.h>
 #include <linux/reboot.h>
+#include <linux/serial.h> /* ASYNC_* flags */
 #include <linux/slab.h>
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
@@ -44,14 +45,11 @@
 #define RAW3215_TIMEOUT	    HZ/10     /* time for delayed output */
 
 #define RAW3215_FIXED	    1	      /* 3215 console device is not be freed */
-#define RAW3215_ACTIVE	    2	      /* set if the device is in use */
 #define RAW3215_WORKING	    4	      /* set if a request is being worked on */
 #define RAW3215_THROTTLED   8	      /* set if reading is disabled */
 #define RAW3215_STOPPED	    16	      /* set if writing is disabled */
-#define RAW3215_CLOSING	    32	      /* set while in close process */
 #define RAW3215_TIMER_RUNS  64	      /* set if the output delay timer is on */
 #define RAW3215_FLUSHING    128	      /* set to flush buffer (no delay) */
-#define RAW3215_FROZEN	    256	      /* set if 3215 is frozen for suspend */
 
 #define TAB_STOP_SIZE	    8	      /* tab stop size */
 
@@ -76,6 +74,7 @@ struct raw3215_req {
 } __attribute__ ((aligned(8)));
 
 struct raw3215_info {
+	struct tty_port port;
 	struct ccw_device *cdev;      /* device for tty driver */
 	spinlock_t *lock;	      /* pointer to irq lock */
 	int flags;		      /* state flags */
@@ -293,7 +292,7 @@ static void raw3215_timeout(unsigned long __data)
 	if (raw->flags & RAW3215_TIMER_RUNS) {
 		del_timer(&raw->timer);
 		raw->flags &= ~RAW3215_TIMER_RUNS;
-		if (!(raw->flags & RAW3215_FROZEN)) {
+		if (!(raw->port.flags & ASYNC_SUSPENDED)) {
 			raw3215_mk_write_req(raw);
 			raw3215_start_io(raw);
 		}
@@ -309,7 +308,8 @@ static void raw3215_timeout(unsigned long __data)
  */
 static inline void raw3215_try_io(struct raw3215_info *raw)
 {
-	if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FROZEN))
+	if (!(raw->port.flags & ASYNC_INITIALIZED) ||
+			(raw->port.flags & ASYNC_SUSPENDED))
 		return;
 	if (raw->queued_read != NULL)
 		raw3215_start_io(raw);
@@ -484,7 +484,7 @@ static void raw3215_make_room(struct raw3215_info *raw, unsigned int length)
 		/* While console is frozen for suspend we have no other
 		 * choice but to drop message from the buffer to make
 		 * room for even more messages. */
-		if (raw->flags & RAW3215_FROZEN) {
+		if (raw->port.flags & ASYNC_SUSPENDED) {
 			raw3215_drop_line(raw);
 			continue;
 		}
@@ -606,10 +606,10 @@ static int raw3215_startup(struct raw3215_info *raw)
 {
 	unsigned long flags;
 
-	if (raw->flags & RAW3215_ACTIVE)
+	if (raw->port.flags & ASYNC_INITIALIZED)
 		return 0;
 	raw->line_pos = 0;
-	raw->flags |= RAW3215_ACTIVE;
+	raw->port.flags |= ASYNC_INITIALIZED;
 	spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
 	raw3215_try_io(raw);
 	spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
@@ -625,14 +625,15 @@ static void raw3215_shutdown(struct raw3215_info *raw)
 	DECLARE_WAITQUEUE(wait, current);
 	unsigned long flags;
 
-	if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FIXED))
+	if (!(raw->port.flags & ASYNC_INITIALIZED) ||
+			(raw->flags & RAW3215_FIXED))
 		return;
 	/* Wait for outstanding requests, then free irq */
 	spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
 	if ((raw->flags & RAW3215_WORKING) ||
 	    raw->queued_write != NULL ||
 	    raw->queued_read != NULL) {
-		raw->flags |= RAW3215_CLOSING;
+		raw->port.flags |= ASYNC_CLOSING;
 		add_wait_queue(&raw->empty_wait, &wait);
 		set_current_state(TASK_INTERRUPTIBLE);
 		spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
@@ -640,7 +641,7 @@ static void raw3215_shutdown(struct raw3215_info *raw)
 		spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
 		remove_wait_queue(&raw->empty_wait, &wait);
 		set_current_state(TASK_RUNNING);
-		raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING);
+		raw->port.flags &= ~(ASYNC_INITIALIZED | ASYNC_CLOSING);
 	}
 	spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
 }
@@ -663,6 +664,7 @@ static struct raw3215_info *raw3215_alloc_info(void)
 	setup_timer(&info->timer, raw3215_timeout, (unsigned long)info);
 	init_waitqueue_head(&info->empty_wait);
 	tasklet_init(&info->tlet, raw3215_wakeup, (unsigned long)info);
+	tty_port_init(&info->port);
 
 	return info;
 }
@@ -752,7 +754,7 @@ static int raw3215_pm_stop(struct ccw_device *cdev)
 	raw = dev_get_drvdata(&cdev->dev);
 	spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
 	raw3215_make_room(raw, RAW3215_BUFFER_SIZE);
-	raw->flags |= RAW3215_FROZEN;
+	raw->port.flags |= ASYNC_SUSPENDED;
 	spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
 	return 0;
 }
@@ -765,7 +767,7 @@ static int raw3215_pm_start(struct ccw_device *cdev)
 	/* Allow I/O again and flush output buffer. */
 	raw = dev_get_drvdata(&cdev->dev);
 	spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
-	raw->flags &= ~RAW3215_FROZEN;
+	raw->port.flags &= ~ASYNC_SUSPENDED;
 	raw->flags |= RAW3215_FLUSHING;
 	raw3215_try_io(raw);
 	raw->flags &= ~RAW3215_FLUSHING;
@@ -838,7 +840,7 @@ static void con3215_flush(void)
 	unsigned long flags;
 
 	raw = raw3215[0];  /* console 3215 is the first one */
-	if (raw->flags & RAW3215_FROZEN)
+	if (raw->port.flags & ASYNC_SUSPENDED)
 		/* The console is still frozen for suspend. */
 		if (ccw_device_force_console())
 			/* Forcing didn't work, no panic message .. */
-- 
1.7.9.2



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

* [PATCH 3/3] TTY: con3215, use tty from tty_port
  2012-04-11  9:14 [PATCH 1/3] NET: pc300, move to staging as it is broken Jiri Slaby
  2012-04-11  9:14 ` [PATCH 2/3] TTY: con3215, add tty_port Jiri Slaby
@ 2012-04-11  9:14 ` Jiri Slaby
  2012-04-17 16:07   ` [PATCH] s390: fix build failure in con3215.c tty wakeup tasklet Paul Gortmaker
  2012-04-13 17:35 ` [PATCH 1/3] NET: pc300, move to staging as it is broken David Miller
  2 siblings, 1 reply; 7+ messages in thread
From: Jiri Slaby @ 2012-04-11  9:14 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, jirislaby, Martin Schwidefsky, Heiko Carstens,
	linux390, linux-s390

Obtain tty_struct only once in ISR and pass it down to
raw3215_next_io. Other than that, we just use the tty with raised
reference. And set it properly in open and close.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
 drivers/s390/char/con3215.c |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index f7bc23b..e928e04 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -83,7 +83,6 @@ struct raw3215_info {
 	int head;		      /* first free byte in output buffer */
 	int count;		      /* number of bytes in output buffer */
 	int written;		      /* number of bytes in write requests */
-	struct tty_struct *tty;	      /* pointer to tty structure if present */
 	struct raw3215_req *queued_read; /* pointer to queued read requests */
 	struct raw3215_req *queued_write;/* pointer to queued write requests */
 	struct tasklet_struct tlet;   /* tasklet to invoke tty_wakeup */
@@ -343,11 +342,11 @@ static void raw3215_wakeup(unsigned long data)
 /*
  * Try to start the next IO and wake up processes waiting on the tty.
  */
-static void raw3215_next_io(struct raw3215_info *raw)
+static void raw3215_next_io(struct raw3215_info *raw, struct tty_struct *tty)
 {
 	raw3215_mk_write_req(raw);
 	raw3215_try_io(raw);
-	if (raw->tty && RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE)
+	if (tty && RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE)
 		tasklet_schedule(&raw->tlet);
 }
 
@@ -365,10 +364,11 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
 
 	raw = dev_get_drvdata(&cdev->dev);
 	req = (struct raw3215_req *) intparm;
+	tty = tty_port_tty_get(&raw->port);
 	cstat = irb->scsw.cmd.cstat;
 	dstat = irb->scsw.cmd.dstat;
 	if (cstat != 0)
-		raw3215_next_io(raw);
+		raw3215_next_io(raw, tty);
 	if (dstat & 0x01) { /* we got a unit exception */
 		dstat &= ~0x01;	 /* we can ignore it */
 	}
@@ -378,13 +378,13 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
 			break;
 		/* Attention interrupt, someone hit the enter key */
 		raw3215_mk_read_req(raw);
-		raw3215_next_io(raw);
+		raw3215_next_io(raw, tty);
 		break;
 	case 0x08:
 	case 0x0C:
 		/* Channel end interrupt. */
 		if ((raw = req->info) == NULL)
-			return;		     /* That shouldn't happen ... */
+			goto put_tty;	     /* That shouldn't happen ... */
 		if (req->type == RAW3215_READ) {
 			/* store residual count, then wait for device end */
 			req->residual = irb->scsw.cmd.count;
@@ -394,11 +394,10 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
 	case 0x04:
 		/* Device end interrupt. */
 		if ((raw = req->info) == NULL)
-			return;		     /* That shouldn't happen ... */
-		if (req->type == RAW3215_READ && raw->tty != NULL) {
+			goto put_tty;	     /* That shouldn't happen ... */
+		if (req->type == RAW3215_READ && tty != NULL) {
 			unsigned int cchar;
 
-			tty = raw->tty;
 			count = 160 - req->residual;
 			EBCASC(raw->inbuf, count);
 			cchar = ctrlchar_handle(raw->inbuf, count, tty);
@@ -408,7 +407,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
 
 			case CTRLCHAR_CTRL:
 				tty_insert_flip_char(tty, cchar, TTY_NORMAL);
-				tty_flip_buffer_push(raw->tty);
+				tty_flip_buffer_push(tty);
 				break;
 
 			case CTRLCHAR_NONE:
@@ -421,7 +420,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
 				} else
 					count -= 2;
 				tty_insert_flip_string(tty, raw->inbuf, count);
-				tty_flip_buffer_push(raw->tty);
+				tty_flip_buffer_push(tty);
 				break;
 			}
 		} else if (req->type == RAW3215_WRITE) {
@@ -436,7 +435,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
 		    raw->queued_read == NULL) {
 			wake_up_interruptible(&raw->empty_wait);
 		}
-		raw3215_next_io(raw);
+		raw3215_next_io(raw, tty);
 		break;
 	default:
 		/* Strange interrupt, I'll do my best to clean up */
@@ -448,9 +447,10 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
 			raw->flags &= ~RAW3215_WORKING;
 			raw3215_free_req(req);
 		}
-		raw3215_next_io(raw);
+		raw3215_next_io(raw, tty);
 	}
-	return;
+put_tty:
+	tty_kref_put(tty);
 }
 
 /*
@@ -946,7 +946,7 @@ static int tty3215_open(struct tty_struct *tty, struct file * filp)
 		return -ENODEV;
 
 	tty->driver_data = raw;
-	raw->tty = tty;
+	tty_port_tty_set(&raw->port, tty);
 
 	tty->low_latency = 0;  /* don't use bottom half for pushing chars */
 	/*
@@ -977,7 +977,7 @@ static void tty3215_close(struct tty_struct *tty, struct file * filp)
 	raw3215_shutdown(raw);
 	tasklet_kill(&raw->tlet);
 	tty->closing = 0;
-	raw->tty = NULL;
+	tty_port_tty_set(&raw->port, NULL);
 }
 
 /*
-- 
1.7.9.2



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

* Re: [PATCH 1/3] NET: pc300, move to staging as it is broken
  2012-04-11  9:14 [PATCH 1/3] NET: pc300, move to staging as it is broken Jiri Slaby
  2012-04-11  9:14 ` [PATCH 2/3] TTY: con3215, add tty_port Jiri Slaby
  2012-04-11  9:14 ` [PATCH 3/3] TTY: con3215, use tty from tty_port Jiri Slaby
@ 2012-04-13 17:35 ` David Miller
  2012-04-13 17:41   ` Greg KH
  2 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2012-04-13 17:35 UTC (permalink / raw)
  To: jslaby; +Cc: gregkh, linux-kernel, jirislaby, alan, andrea

From: Jiri Slaby <jslaby@suse.cz>
Date: Wed, 11 Apr 2012 11:14:57 +0200

> It was marked as BROKEN back in 2008. It is because the tty handling
> in the driver is really broken.
> 
> There was some activity in January 2012 to fix the driver, but the
> patch was commented to be bogus:
>   https://lkml.org/lkml/2012/1/29/160
> and we have not heard back from the author since then:
>   https://lkml.org/lkml/2012/3/28/412
> 
> So since nobody stepped in and rewrote the driver, it is time to move
> it out of line now. And drop it some time later if nobody comes up
> with patches to fix the driver in staging.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>

No objections, I'll let the staging guy handle this :-)

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH 1/3] NET: pc300, move to staging as it is broken
  2012-04-13 17:35 ` [PATCH 1/3] NET: pc300, move to staging as it is broken David Miller
@ 2012-04-13 17:41   ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2012-04-13 17:41 UTC (permalink / raw)
  To: David Miller; +Cc: jslaby, linux-kernel, jirislaby, alan, andrea

On Fri, Apr 13, 2012 at 01:35:33PM -0400, David Miller wrote:
> From: Jiri Slaby <jslaby@suse.cz>
> Date: Wed, 11 Apr 2012 11:14:57 +0200
> 
> > It was marked as BROKEN back in 2008. It is because the tty handling
> > in the driver is really broken.
> > 
> > There was some activity in January 2012 to fix the driver, but the
> > patch was commented to be bogus:
> >   https://lkml.org/lkml/2012/1/29/160
> > and we have not heard back from the author since then:
> >   https://lkml.org/lkml/2012/3/28/412
> > 
> > So since nobody stepped in and rewrote the driver, it is time to move
> > it out of line now. And drop it some time later if nobody comes up
> > with patches to fix the driver in staging.
> > 
> > Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> 
> No objections, I'll let the staging guy handle this :-)
> 
> Acked-by: David S. Miller <davem@davemloft.net>

Thanks, I will :)

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

* [PATCH] s390: fix build failure in con3215.c tty wakeup tasklet
  2012-04-11  9:14 ` [PATCH 3/3] TTY: con3215, use tty from tty_port Jiri Slaby
@ 2012-04-17 16:07   ` Paul Gortmaker
  2012-04-17 16:14     ` Heiko Carstens
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Gortmaker @ 2012-04-17 16:07 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Jiri Slaby, Martin Schwidefsky, Heiko Carstens,
	Greg Kroah-Hartman, linux390, linux-s390

Commit 86b26007a37d81e7aca242bb5b649473f8f81297 (tty-next)

    "TTY: con3215, use tty from tty_port"

removed the tty struct from the raw struct, causing:

  CC      drivers/s390/char/con3215.o
drivers/s390/char/con3215.c: In function 'raw3215_wakeup':
drivers/s390/char/con3215.c:339:16: error: 'struct raw3215_info' has no member named 'tty'
make[2]: *** [drivers/s390/char/con3215.o] Error 1

We can't simply add a tty to the args of raw3215_wakeup since
it is registered as a tasklet.  The flow is:

	raw3215_irq
		--> tty_port_tty_get
			--> raw3215_next_io
				--> tasklet_schedule
		--> tty_kref_put

so it seems we'll need to do a get/put in the raw3215_wakeup
tasklet as well.

Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index e928e04..759c43c 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -336,7 +336,13 @@ static inline void raw3215_try_io(struct raw3215_info *raw)
 static void raw3215_wakeup(unsigned long data)
 {
 	struct raw3215_info *raw = (struct raw3215_info *) data;
-	tty_wakeup(raw->tty);
+	struct tty_struct *tty = tty_port_tty_get(&raw->port);
+
+	if (tty == NULL)
+		return;
+
+	tty_wakeup(tty);
+	tty_kref_put(tty);
 }
 
 /*
-- 
1.7.9.1


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

* Re: [PATCH] s390: fix build failure in con3215.c tty wakeup tasklet
  2012-04-17 16:07   ` [PATCH] s390: fix build failure in con3215.c tty wakeup tasklet Paul Gortmaker
@ 2012-04-17 16:14     ` Heiko Carstens
  0 siblings, 0 replies; 7+ messages in thread
From: Heiko Carstens @ 2012-04-17 16:14 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Jiri Slaby, Martin Schwidefsky, Greg Kroah-Hartman,
	linux390, linux-s390

On Tue, Apr 17, 2012 at 12:07:09PM -0400, Paul Gortmaker wrote:
> Commit 86b26007a37d81e7aca242bb5b649473f8f81297 (tty-next)
> 
>     "TTY: con3215, use tty from tty_port"
> 
> removed the tty struct from the raw struct, causing:
> 
>   CC      drivers/s390/char/con3215.o
> drivers/s390/char/con3215.c: In function 'raw3215_wakeup':
> drivers/s390/char/con3215.c:339:16: error: 'struct raw3215_info' has no member named 'tty'
> make[2]: *** [drivers/s390/char/con3215.o] Error 1

...

> diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
> index e928e04..759c43c 100644
> --- a/drivers/s390/char/con3215.c
> +++ b/drivers/s390/char/con3215.c
> @@ -336,7 +336,13 @@ static inline void raw3215_try_io(struct raw3215_info *raw)
>  static void raw3215_wakeup(unsigned long data)
>  {
>  	struct raw3215_info *raw = (struct raw3215_info *) data;
> -	tty_wakeup(raw->tty);
> +	struct tty_struct *tty = tty_port_tty_get(&raw->port);
> +
> +	if (tty == NULL)
> +		return;
> +
> +	tty_wakeup(tty);
> +	tty_kref_put(tty);

Yep, I posted a similar patch earlier:
http://marc.info/?l=linux-next&m=133466152209052&w=2

The NULL check is not necessary, because "it cannot happen" ;)

Thanks,
Heiko


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

end of thread, other threads:[~2012-04-17 16:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11  9:14 [PATCH 1/3] NET: pc300, move to staging as it is broken Jiri Slaby
2012-04-11  9:14 ` [PATCH 2/3] TTY: con3215, add tty_port Jiri Slaby
2012-04-11  9:14 ` [PATCH 3/3] TTY: con3215, use tty from tty_port Jiri Slaby
2012-04-17 16:07   ` [PATCH] s390: fix build failure in con3215.c tty wakeup tasklet Paul Gortmaker
2012-04-17 16:14     ` Heiko Carstens
2012-04-13 17:35 ` [PATCH 1/3] NET: pc300, move to staging as it is broken David Miller
2012-04-13 17:41   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.